QMBasic Statements and Functions by Type

Top  Previous  Next

 

Program Structure, Declaration and Assignment

CLASSDeclare a class module
CLEARSet all local variables to zero
CLEARCOMMONSet all unnamed common variables to zero
COMMONDefine a common block
DEFFUNDefine a function
DIMENSIONSet matrix dimensions
DIMSynonym for DIMENSION
DISINHERITDisinherit an object
ENDTerminate program or statement group
EQUATEDefine a symbolic name for a constant or matrix element
FUNCTIONDeclare function name and arguments
INHERITInherit an object
MATMatrix initialisation or copy
PRIVATEDeclare private variables in a local subroutine or a class module
PROGRAMDeclare program name
PUBLICDeclare public properties in a class module
SUBROUTINEDeclare subroutine name and arguments
VOIDDiscard the result of evaluating an expression

 

 

Program Control

ABORTAbort to command prompt
ABORTEAbort to command prompt with Pick style message handling
ABORTMAbort to command prompt with Information style message handling
CALLCall an external subroutine
CASEPerform statements according to multiple conditions
CHAINTerminate program and execute a command
CONTINUEContinue next iteration of a loop
ENTERSynonym for CALL
EXECUTEExecute a command
EXITLeave a loop
FOR / NEXTIterative loop construct
GO / GOTOJump to a label
GOSUBEnter an internal subroutine
IF / THEN / ELSEPerform conditional statements
LOCALDeclares an internal subroutine or function that has private local variables
LOOP / REPEATDefine a loop to be repeated
NAPSuspend program for a short period
ON GOSUBJump to one of a list of labels selected by value
ON GOTOEnter one of a list of internal subroutines selected by value
OS.EXECUTEExecute an operating system command
PAUSEPause execution until awoken by another process
PERFORMSynonym for EXECUTE
RETURNReturn from program or subroutine
RETURN TOReturn from program or subroutine to a specific label
RQMSynonym for SLEEP
SLEEPSuspend program to / for given time
STOPTerminate program
STOPETerminate program with Pick style message handling
STOPMTerminate program with Information style message handling
SUBR()Call a subroutine as a function
UNTILLeave loop if condition is met
WHILELeave loop unless condition is met
WAKERestart execution of a process on a PAUSE

 

 

Mathematical and Logical Functions

ABS()Absolute value
ABSS()Multi-valued absolute value
ACOS()Arc-cosine
ANDS()Multi-valued logical AND
ASIN()Arc-sine
ATAN()Arc-tangent        
BITAND()Bitwise logical AND operation
BITNOT()Bitwise logical NOT operation
BITOR()Bitwise logical OR operation
BITRESET()Turn off specified bit
BITSET()Turn on specified bit
BITTEST()Test specified bit
BITXOR()Bitwise logical exclusive OR operation
COS()Cosine
DIV()Divide
EQS()Multi-valued equality test
EXP()Exponential
GES()Multi-valued greater than or equal to test
GTS()Multi-valued greater than test
IDIV()Integer division
IFS()Multi-valued conditional expression
INT()Truncate value to integer
LES()Multi-valued less than test
LN()Natural log
LTS()Multi-valued less than or equal to test
MAX()Returns the greater of two values
MAXIMUM()Find the greatest value in a dynamic array
MIN()Returns the lesser of two values
MINIMUM()Find the lowest value in a dynamic array
MOD()Modulus value from division
MODS()Multi-valued modulus value from division
NEG()Arithmetic inverse
NEGS()Multi-valued arithmetic inverse
NES()Multi-valued inequality test
NOT()Logical NOT
NOTS()Multi-valued logical NOT
ORS()Multi-valued logical OR
PWR()Raise value to power
RDIV()Rounded integer division
REM()Remainder value from division
REUSE()Reuse element of numeric arrays in mathematical functions
RND()Generate random number
SHIFT()Perform bit shift
SIN()Sine
SQRT()Square root
SUM()Sum lowest level elements of a numeric array
SUMMATION()Sum all elements of a numeric array
TAN()Tangent

 

 

String Handling

ASCII()Convert an EBCDIC string to ASCII
ALPHA()Test if string holds only alphabetic characters
CATS()Concatenate elements of a dynamic array
CHANGE()Replace substring in a string
CHAR()Get ASCII character for a given collating sequence value
COL1()Start of substring position from FIELD()
COL2()End of substring position from FIELD()
COMPARE()Compare strings
CONVERTSubstitute characters with replacements
CONVERT()Substitute characters with replacements
COUNT()Count occurrences of substring in string
COUNTS()Multi-valued variant of COUNT()
CROP()Remove redundant mark characters
CSVDQ()Dequote a CSV string
DCOUNT()Count delimited substrings in string
DECRYPT()Decrypt text
DPARSESplit elements of a delimited string
DPARSE.CSVSplit elements of a CSV format delimited string
DELDelete a field, value or subvalue
DELETE()Delete a field, value or subvalue
DOWNCASE()Convert string to lowercase
DQUOTE()Synonym for QUOTE()
EBCDIC()Convert an ASCII string to EBCDIC
ENCRYPT()Encrypt data
EXTRACT()Extract a field, value or subvalue
FIELD()Extract delimited fields
FIELDS()Multi-valued variant of FIELD()
FIELDSTORE()Replace or insert delimited fields
FINDFind a string in a dynamic array element
FINDSTRFind a substring in a dynamic array element
FMT()Format a string
FMTS()Format a dynamic array
FOLD()Break a string into sections, splitting at spaces where possible
FOLDS()Multi-valued variant of FOLD()
GETREM()Get remove pointer position
ICONV()Perform input conversion
ICONVS()Perform input conversion on a dynamic array
INDEX()Locate occurrence of substring within a string
INDEXS()Multi-valued equivalent of INDEX()
INSInsert a field, value or subvalue
INSERT()Insert a field, value or subvalue
LEN()Return length of a string
LENS()Multi-valued equivalent of LEN()
LISTINDEX()Return position of an item in a delimited list
LOCATELocate string in dynamic array
LOCATE()Locate string in dynamic array
LOWER()Convert delimiters to lower level
MATBUILDBuild a dynamic array from matrix elements
MATCHFIELD()Return portion of string matching pattern
MATPARSEBreak a dynamic array into matrix elements
NUM()Test if string holds a numeric value
NUMS()Multi-valued variant of NUM()
OCONV()Perform output conversion
OCONVS()Perform output conversion on a dynamic array
QUOTE()Enclose a string in double quotes
RAISE()Convert delimiters to higher level
REMOVERemove an item from a dynamic array
REMOVE()Remove an item from a dynamic array
REPLACE()Replace a field, value or subvalue
SEQ()Get collating sequence value for a given ASCII character
SETREMSet remove pointer position
SOUNDEX()Form a soundex code value for a string
SOUNDEXS()Multi-valued variant of SOUNDEX()
SPACE()Create a string of spaces
SPACES()Multi-valued variant of SPACE()
SPLICE()Concatenates elements of two dynamic arrays, inserting a string between the items.
SQUOTE()Enclose a string in single quotes
STR()Create a string from a repeated substring
STRS()Multi-valued variant of STR()
SUBSTITUTE()Multi-valued substring replacement
SUBSTRINGS()Multi-valued substring extraction
SWAP()Synonym for CHANGE()
SWAPCASE()Invert case of alphabetic characters in a string
TRIM()Trim characters from string
TRIMB()Trim spaces from back of string
TRIMBS()Multi-valued variant of TRIMB()
TRIMF()Trim spaces from front of string
TRIMFS()Multi-valued variant of TRIMF()
TRIMS()Multi-valued variant of TRIM()
UPCASE()Convert string to uppercase
VSLICE()Extract a value slice from a dynamic array

 

 

File Handling

BEGIN TRANSACTIONStart a new transaction
CLEARFILEClear a file, deleting all records and releasing disk space
CLOSEClose a file
CLOSESEQClose a record opened for sequential access
COMMITCommit transaction updates
CREATECreate an empty sequential file record
CREATE.FILECreate a file
DELETEDelete record from a file
DELETESEQDelete an operating system file
DELETEUDelete record from a file preserving locks
DIR()Return the contents of a directory
END TRANSACTIONTerminate a transaction
FILEOpen a file and access data by field name
FILEINFO()Return information about an open file
FILELOCKLock a file
FILEUNLOCKUnlock a file
FLUSHFlush sequential file data to disk
GET.PORT.PARAMS()Get serial port parameters
MARK.MAPPINGControl field mark translation in directory files
MATREADRead a record, parsing into a matrix
MATREADCSVRead a CSV format text item into a matrix
MATREADLRead a record setting a read lock, parsing into a matrix
MATREADURead a record setting an update lock, parsing into a matrix
MATWRITEWrite a record from matrix elements
MATWRITEUWrite a record from matrix elements, retaining any lock
NOBUFTurn off buffering for a record opened using OPENSEQ
OPENOpen a file
OPENPATHOpen a file by pathname
OPENSEQOpen a record for sequential access
OUTERJOIN()Fetch data from a file using an "outer join"
READRead a record from a file
READBLKRead bytes from a sequential file
READCSVRead a CSV format text item
READLRead a record from a file, setting a read lock
READSEQRead from a sequential file
READURead a record from a file, setting an update lock
READVRead a field from a record in a file
READVLRead a field from a record in a file, setting a read lock
READVURead a field from a record in a file, setting an update lock
RECORDLOCKED()Test if record is locked
RECORDLOCKLSet a read lock on a record
RECORDLOCKUSet an update lock on a record
RELEASERelease record or file locks
ROLLBACKDiscard transaction updates
RTRANS()Fetch data from a file
SEEKPosition a sequential file
SET.PORT.PARAMS()Set serial port parameters
STATUSReturns a dynamic array of information about an open file
TIMEOUTSets a timeout for READBLK and READSEQ
TRANS()Fetch data from a file
TRANSACTION ABORTAbort a transaction
TRANSACTION COMMITCommit a transaction
TRANSACTION STARTStart a new transaction
WEOFSEQWrite end of file position to sequential file
WRITEWrite a record to a file
WRITEBLKWrite bytes to a sequential file
WRITECSVWrite CSV format data to a sequential file
WRITESEQWrite to sequential file
WRITESEQFWrite to sequential file, flushing to disk
WRITEUWrite a record to a file, retaining any lock
WRITEVWrite a field to a record in a file
WRITEVUWrite a field to a record in a file, retaining any lock
XLATE()Synonym for TRANS()

 

 

Printer, Keyboard and Display Handling

@(x,y)Terminal cursor movement and control
BINDKEY()Set, remove, query, save or restore key bindings
BREAKEnable or disable break key handling
CLEARDATAClear DATA queue
CLEARINPUTClear keyboard type-ahead
CRTSynonym for DISPLAY
DATASave text in DATA queue
DISPLAYOutput to the display
ECHOEnable or disable input echo
ERRMSGDisplay a Pick style message from the ERRMSG file
FOOTINGSet footing text
GETPUGet a characteristic of a print unit
HEADINGSet heading text
HUSHSuppress or enable display output
INPUTInput a string from the keyboard or data queue
INPUT @Input a string from the keyboard or data queue
INPUTCLEARSynonym for CLEARINPUT
INPUTCSVInput CSV format data
INPUTERRSynonym for PRINTERR
INPUTFIELDInput a string with function key handling
KEYCODE()Input a single keystroke from the keyboard with terminfo translation
KEYEDITDefine editing keys for INPUT @
KEYEXITDefine exit keys for INPUT @
KEYIN()Input a single keystroke from the keyboard
KEYINC()Input a single keystroke from the keyboard with case inversion
KEYINR()Input a single keystroke from the keyboard in raw mode (no internal processing)
KEYREADY()Test for keyboard input
KEYTRAPDefine trap keys for INPUT @
PAGEStart a new page
PRINTOutput to a logical print unit
PRINTER CLOSEClose a print unit
PRINTER DISPLAYAssociate a print unit with the display
PRINTER FILEAssociate a file with a print unit
PRINTER NAMEAssociate a print device with a print unit
PRINTER OFFDisable print unit zero
PRINTER ONEnable print unit zero
PRINTER RESETReset default print unit and display
PRINTER SETTINGSet a print unit parameter
PRINTER.SETTING()Set or retrieve a print unit parameter
PRINTERRDisplay an error message
PROMPTSet the input prompt character
RESTORE.SCREENRestore screen image data
SAVE.SCREEN()Save screen image data
SETPUSet a characteristic of a print unit
TERMINFO()Retrieve information from the terminfo database
TTYGET()Get current terminal mode settings
TTYSETSet terminal modes

 

 

Select Lists and Alternate Key Indices

CLEARSELECTClear one or all select lists
DELETELISTDelete a saved select list
FORMLISTCreate a select list from a dynamic array
GETLISTRestore a saved select list
INDICES()Return information about alternate key indices
READLISTSave a select list in a dynamic array
READNEXTRead a record id from a select list
SAVELISTSave a select list in the $SAVEDLISTS file
SELECTBuild a select list of all records in an open file
SELECTETransfer select list 0 to a select list variable
SELECTINDEXBuild a select list from an alternate key index
SELECTINFO()Return information regarding a select list
SELECTLEFTScan left through an alternate key index
SELECTNBuild a numbered select list of all records in an open file
SELECTRIGHTScan right through an alternate key index
SELECTVBuild a select list variable of all records in an open file
SETLEFTSet alternate key index scan position to leftmost
SETRIGHTSet alternate key index scan position to rightmost
SSELECTBuild a sorted select list of all records in an open file

 

 

Socket Interface

ACCEPT.SOCKET.CONNECTION()Accept an incoming connection on a server socket
CLOSE.SOCKETClose a socket
CREATE.SERVER.SOCKET()Open a server socket
OPEN.SOCKET()Open a socket connection
READ.SOCKET()Read data from a socket
SERVER.ADDR()Find the IP address for a given server name
SET.SOCKET.MODE()Set mode of a socket
SOCKET.INFO()Retrieve information about a socket
WRITE.SOCKET()Write data to a socket

 

 

Miscellaneous

ARG()Returns an argument variable based on its argument list position
ARG.COUNT()Returns the number of arguments passed into a subroutine
ASSIGNED()Test whether variable is assigned
CATALOGUED()Check catalogue entry
CONFIG()Returns the value of a configuration parameter
CONNECT.PORT()Connect a serial port to a phantom process
DATE()Return the current date as a day number
DEBUGEnter debugger
DTX()Convert a number to hexadecimal
ENV()Retrieve an operating system environment variable
GET.MESSAGES()Retrieve messages from the message queue
GETNLS()Get national language support parameter value
INMAT()Return status of matrix operations
ITYPE()Execute a compiled I-type
LOCKSet task lock
LOGMSGAdd an entry to the system error log
NULLNo operation
OBJECT()Instantiates an object
OBJINFO()Returns information about an object variable
OS.ERROR()Return operating system error information
PRECISIONSet number of decimal places in numeric conversion
PROCREADRead data from the PROC primary input buffer
PROCWRITEWrite data to the PROC primary input buffer
REMARKAlternative syntax for comments
SENTENCE()Returns the command line that started the current program
SET.ARGSets an argument variable based on its argument list position
SET.EXIT.STATUSSet final exit status value
SETNLS()Set national language support parameter value
STATUS()Return status from previous operation
SYSTEM()Return system information
TCLREADReturns the sentence that started the current program
TIME()Return the current time
TIMEDATE()Return the date and time as a string
UNASSIGNED()Test whether variable is unassigned
UNLOCKRelease task lock
XTD()Convert a hexadecimal number