QMBasic Statements and Functions by Type

QMBasic Statements and Functions by Type

Top  Previous  Next

 

Operators

+

-

*

/

~

**

^

//

=

<

>

<=

>=

#

==

:

EQ

LT

GT

LE

GE

NE

<>


AND

&

OR

!

.&

.!



[ ]

< >

MATCHES

LIKE





For all of the above, see Expressions and Operators.

 

 

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
DIMSynonym for DIMENSION
DIMENSIONSet matrix dimensions
DISINHERITDisinherit an object
ENDTerminate program or statement group
EQUATEDefine a symbolic name for a constant or matrix element
FUNCTIONDeclare function name and arguments
GETSynonym for PUBLIC FUNCTION
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
PUTSynonym for PUBLIC SUBROUTINE
REDIMRe-dimension a matrix passed as an argument
REDIMENSIONRe-dimension a matrix passed as an argument
SHAREDDefine shared variables 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
CAUGHT()Test whether a handler exists for a named exception
CHAINTerminate program and execute a command
CONTINUEContinue next iteration of a loop
ENTERSynonym for CALL
ENTER.PACKAGE()Enter a licensed package
EXECUTEExecute a command
EXITLeave a loop
EXIT.PACKAGE()Exit from a licensed package
FOR / NEXTIterative loop construct
GET(ARG.)Retrieve command line arguments
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
PHANTOMStart a phantom process
POOL.IDLEMove a connection pooling phantom process into the idle state
REMOVE.BREAK.HANDLERDeactivate a break handler subroutine
RETURNReturn from CALL or GOSUB
RETURN FROM PROGRAMReturn from CALL
RETURN TOReturn from program or subroutine to a specific label
RQMSynonym for SLEEP
SERVER.WINDOW()Open an asynchronous server application window
SET.BREAK.HANDLEREstablish a break handler subroutine
SIGNAL()Raise a cross-process application signal
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
THROWThrow an exception
TRY/CATCHExecute statements with an exception handler
UNTILLeave loop if condition is met
WAKERestart execution of a process on a PAUSE
WHILELeave loop unless condition is met

 

 

Mathematical and Logical Functions

ABS()Absolute value
ABSS()Multivalued absolute value
ACOS()Arc-cosine
ANDS()Multivalued 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()Multivalued equality test
EXP()Exponential
FIX()Convert a floating point value to a string with a specified precision
GES()Multivalued greater than or equal to test
GTS()Multivalued greater than test
IDIV()Integer division
IFS()Multivalued conditional expression
INT()Truncate value to integer
LES()Multivalued less than test
LN()Natural log
LTS()Multivalued 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()Multivalued modulus value from division
NEG()Arithmetic inverse
NEGS()Multivalued arithmetic inverse
NES()Multivalued inequality test
NOT()Logical NOT
NOTS()Multivalued logical NOT
ORS()Multivalued logical OR
PWR()Raise value to power
RDIV()Rounded integer division
RANDOMIZESet random number seed value
REM()Remainder value from division
REUSE()Reuse element of numeric arrays in mathematical functions
RND()Generate random number
ROUNDDOWN()Round a number towards zero in a specified increment
ROUNDUP()Round a number away from zero in a specified increment
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

ALPHA()Test if string holds only alphabetic characters
ASCII()Convert an EBCDIC string to ASCII
CATS()Concatenate elements of a dynamic array
CHANGE()Replace substring in a string
CHAR()Get ASCII character for a given collating sequence value
CHARS()Evaluates the CHAR() function for each element of a dynamic array
COL1()Start of substring position from FIELD()
COL2()End of substring position from FIELD()
COMPARE()Compare strings
COMPARES()Multivalued variant of COMPARE()
CONVERTSubstitute characters with replacements
CONVERT()Substitute characters with replacements
COUNT()Count occurrences of substring in string
COUNTS()Multivalued variant of COUNT()
CROP()Remove redundant mark characters
CSVDQ()De-quote a CSV string
CSV.MODESet CSV conversion mode
DCOUNT()Count delimited substrings in string
DECRYPT()Decrypt text
DELDelete a field, value or subvalue
DELETE()Delete a field, value or subvalue
DISPLAY.WIDTH()Return the number of character positions required to display a string
DISPLAY.WIDTHS()Evaluates the DISPLAY.WIDTH() function for each element of a dynamic array
DOWNCASE()Convert string to lowercase
DPARSESplit elements of a delimited string
DPARSE.CSVSplit elements of a CSV format delimited string
DQUOTE()Synonym for QUOTE()
DQUOTES()Synonym for QUOTES()
EBCDIC()Convert an ASCII string to EBCDIC
ECHAR()Returns the ECS character with a given codepoint value
ECHARS()Evaluates the ECHAR() function for each element of a dynamic array
ELEMENT.EXISTS()Test for presence of a data collection element
ENCRYPT()Encrypt data
ENUMERATE()Build a dynamic array of element names in a data collection
EREPLACE()Replace substring in a string
EXTRACT()Extract a field, value or subvalue
FIELD()Extract delimited fields
FIELDS()Multivalued 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
FMTDW()Format a string based on display width
FMTDWS()Format a dynamic array based on display width
FMTS()Format a dynamic array
FOLD()Break a string into sections, splitting at spaces where possible
FOLDDW()Break a string into sections based on display width, splitting at spaces where possible
FOLDDWS()Multivalued variant of FOLDDW()
FOLDS()Multivalued 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()Multivalued equivalent of INDEX()
INSInsert a field, value or subvalue
INSERT()Insert a field, value or subvalue
IS.ALNUM()Test whether a character is alphanumeric
IS.ALPHA()Test whether a character is a letter
IS.DIGIT()Test whether a character is a digit
IS.ECS()Test whether a character string contains ECS characters
IS.GRAPH()Test whether a character is a graphic
IS.MARK()Test whether a character is a mark
IS.SPACE()Test whether a character is a space
IS.USER.CHAR()Test whether a character has the user definable attribute set
IS.WIDESTR()Determine whether a string contains any wide characters
JBUILD()Build a JSON string from a data collection
JPARSE()Parse a JSON string into a data collection
LAST()Extract the final substring from a delimited string
LASTS()Multivalued equivalent of LAST()
LEFT()Return leading substring
LEN()Return length of a string
LENS()Multivalued 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
MATCHESS()Matches each element of a dynamic array against a pattern template
MATCHFIELD()Return portion of string matching pattern
MATCHFIELDS()Return portion of string matching pattern for each element of a dynamic array
MATPARSEBreak a dynamic array into matrix elements
MATSTR()Convert a dimensioned matrix to a dynamic array
MD5()Convert a string to its 32 digit message digest value.
NS()Return a dynamic array of subvalue positions for supplied data
NUM()Test if string holds a numeric value
NUMS()Multivalued variant of NUM()
NV()Return a dynamic array of value positions for supplied data
OCONV()Perform output conversion
OCONVS()Perform output conversion on a dynamic array
PARSE()Parse a string against a pattern template
QUOTE()Enclose a string in double quotes
QUOTES()Enclose each element of a dynamic array in double quotes
RAISE()Convert delimiters to higher level
REGEX()Test a string against a regular expression
REMOVEExtract an item from a dynamic array
REMOVE()Extract an item from a dynamic array
REMOVEF()Extract data from a delimited character string
REPLACE()Replace a field, value or subvalue
RIGHT()Return trailing substring
RMVD()Extract an item from a dynamic array
SADD()Perform integer addition of two numeric strings of any length
SCMP()Compare two integer numeric strings of any length
SDIV()Perform integer division of two numeric strings of any length
SEQ()Get collating sequence value for a given ASCII character
SEQS()Evaluates the SEQ() function for each element of a dynamic array
SET.ECS.MAP()Select an ECS character map
SETREMSet remove pointer position
SMUL()Perform integer multiplication of two numeric strings of any length
SORT.COMPARE()Compare items according to sort rules
SOUNDEX()Form a Soundex code value for a string
SOUNDEXS()Multivalued variant of SOUNDEX()
SPACE()Create a string of spaces
SPACES()Multivalued variant of SPACE()
SPLICE()Concatenates elements of two dynamic arrays, inserting a string between the items.
SQUOTE()Enclose a string in single quotes
SQUOTES()Enclose each element of a dynamic array in single quotes
SSUB()Perform integer subtraction of two numeric strings of any length
STR()Create a string from a repeated substring
STRS()Multivalued variant of STR()
SUBSTITUTE()Multivalued substring replacement
SUBSTRDW()Extract a substring based on its display width
SUBSTRDWS()Multivalued equivalent of SUBSTRDW()
SUBSTRINGS()Multivalued substring extraction
SWAP()Synonym for CHANGE()
SWAPCASE()Invert case of alphabetic characters in a string
SWAPMARKS()Exchange mark characters with displaced Unicode accented characters
TRANSLITERATE()Replace characters by 8 bit transliteration substitutes
TRIM()Trim characters from string
TRIMB()Trim spaces from back of string
TRIMBS()Multivalued variant of TRIMB()
TRIMF()Trim spaces from front of string
TRIMFS()Multivalued variant of TRIMF()
TRIMS()Multivalued variant of TRIM()
TRIMW()Trim whitespace characters from string
TRIMWS()Multivalued variant of TRIMW()
UPCASE()Convert string to uppercase
VSLICE()Extract a value or subvalue slice from a dynamic array

 

 

Date and Time

DATE()Return the current date as a day number
EPOCH()Return time and date as an epoch value
MVDATE()Extract the multivalue style date from an epoch value
MVDATE.TIME()Extract the multivalue style date and time from an epoch value
MVEPOCH()Convert a multivalue style date and time to an epoch value
MVTIME()Extract the multivalue style time from an epoch value
SET.TIMEZONESet time zone for use by the epoch conversion code
TIME()Return the current time
TIMEDATE()Return the date and time as a string

 

 

File Handling

ACCOUNT.PATH()Return pathname for a given account
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
DFPART()Access a part file within a distributed file
DIR()Return the contents of a directory
DISABLE.KEYDisable access to a password protected encryption key
ENABLE.KEYEnable access to a password protected encryption key
END TRANSACTIONTerminate a transaction
FCONTROL()Perform control action on an open file
FILEOpen a file and access data by field name
FILE.EVENT()Create a file event monitoring variable
FILEINFO()Return information about an open file
FILELOCKLock a file
FILEUNLOCKUnlock a file
FLUSHFlush sequential file data to disk
FLUSH.DH.CACHEFlush dynamic file cache
GETLOCKSReturns information about file and record locks
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
MATWRITECSVWrite CSV form data from matrix elements to a sequential file
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
OPENTEMPCreate and open a temporary file
OSDELETEDelete a file by pathname
OSPATH()Perform action on operating system file
OSREADRead a file by pathname
OSRENAME()Rename an operating system file or directory
OSWRITEWrite a file by pathname
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
VOCPATH()Resolve a filename to its corresponding pathname
WAIT.FILE.EVENT()Wait for a file monitoring event to occur
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
BREAK.COUNT()Return the value of the break inhibit counter
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
FORMCSV()Transforms a string to a CSV standard compliant item
GETPU()Get a characteristic of a print unit
HEADINGSet heading text
HUSHSuppress or enable display output
INRead a single byte from the terminal with an optional timeout
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
INPUTFIELDVInput a string with function key handling
INPUTNULLSet a special character to return a null string in INPUT @ and INPUTFIELD.
INPUTTRAPDefines characters with special actions in INPUT @ and INPUTFIELD
KEYCODE()Input a single keystroke from the keyboard with terminfo translation
KEYCODEV()Input a single keystroke from the keyboard with terminfo translation to a code point value
KEYEDITDefine editing keys for INPUT @
KEYEXITDefine exit keys for INPUT @
KEYINR()Input a single keystroke from the keyboard in raw mode (no internal processing)
KEYIN()Input a single keystroke from the keyboard
KEYINC()Input a single keystroke from the keyboard with case inversion
KEYINCV()Input a single keystroke from the keyboard with case inversion, returning a code point value
KEYINV()Input a single keystroke from the keyboard, returning a code point value
KEYREADY()Test for keyboard input
KEYTRAPDefine trap keys for INPUT @
MOUSEEnable or disable mouse 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
PRINTCSVPrint data in comma separated variable format
PRINTERRDisplay an error message
PROMPTSet the input prompt character
PTERM()Set/clear/query terminal settings
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
TERMINFO.EX()Retrieve extended 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 numbered select list from a dynamic array
FORMLISTVCreate a select list variable from a dynamic array
GETLISTRestore a saved select list to a numbered list
GETLISTVRestore a saved select list to a select list variable
INDICES()Return information about alternate key indices
KEEP.SELECTIndicate that the default select list should not be cleared on return to the command processor
MERGELIST()Combine two field mark delimited sorted lists
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 numbered select list of all records in an open file
SELECTETransfer select list 0 to a select list variable
SELECTINDEXBuild a numbered select list from an alternate key index
SELECTINDEXVBuild a select list variable from an alternate key index
SELECTINFO()Return information regarding a select list
SELECTLEFTScan left through an alternate key index, creating a numbered select list
SELECTLEFTVScan left through an alternate key index, creating a select list variable
SELECTNBuild a numbered select list of all records in an open file
SELECTRIGHTScan right through an alternate key index, creating a numbered select list
SELECTRIGHTVScan right through an alternate key index, creating a select list variable
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 numbered select list of all records in an open file
SSELECTVBuild a sorted select list variable of all records in an open file
WRITELISTCreate a saved select list from a dynamic array

 

 

Sorting

SORT()Initialise a sort session
SORTADDAdd an item to a sort session
SORTCLEARTerminate a sort session
SORTDATA()Retrieve sorted data from a sort session
SORTNEXT()Retrieve a single item from a sort session

 

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
SELECT.SOCKET()Monitor events on multiple sockets
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
ARG.PRESENT()Test for presence of an argument in a subroutine or function
ASSIGNED()Test whether variable is assigned
CATALOGUED()Check catalogue entry
CHECKSUM()Calculate a checksum value for a supplied data item
CHILD()Test if a phantom process is still running
COLLECTION()Create or copy a data collection
CONFIG()Returns the value of a configuration parameter
CONNECT.PORT()Connect a serial port to a phantom process
DEBUGEnter debugger
DTX()Convert a number to hexadecimal
ENV()Retrieve an operating system environment variable
EVALUATEEvaluate an I-type expression, trapping errors
EXPAND()Expand a linked data collection
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
MAT()Create or copy a data collection array
NULLNo operation
OBJECT()Instantiates an object
OBJINFO()Returns information about an object variable
OPTION()Return setting of an option switch
OS.ERROR()Return operating system error information
PDUMPGenerate a process dump file
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
SET.STATUSSet the STATUS() value
STATUS()Return status from previous operation
SYSMSG()Retrieve a message from the MESSAGES library
SYSTEM()Return system information
TCLREADReturns the sentence that started the current program
TESTLOCK()Test state of a task lock
UNASSIGNED()Test whether variable is unassigned
UNLOCKRelease task lock
VARTYPE()Determine data type of a variable
XTD()Convert a hexadecimal number