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
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
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
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
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
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
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
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
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()Dequote 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
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
ENCRYPT()Encrypt data
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
FMTS()Format a dynamic array
FOLD()Break a string into sections, splitting at spaces where possible
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
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
MATCHES()Matches a string against a pattern template
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
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
PARSE()Parse a string against a pattern template
OCONV()Perform output conversion
OCONVS()Perform output conversion on a dynamic array
QUOTE()Enclose a string in double quotes
QUOTES()Enclose each element of a dynamic array in double quotes
RAISE()Convert delimiters to higher level
REMOVERemove an item from a dynamic array
REMOVE()Remove an item from a dynamic array
REMOVEF()Extract data from a delimited character string
REPLACE()Replace a field, value or subvalue
SEQ()Get collating sequence value for a given ASCII character
SETREMSet remove pointer position
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
STR()Create a string from a repeated substring
STRS()Multivalued variant of STR()
SUBSTITUTE()Multivalued substring replacement
SUBSTRINGS()Multivalued 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()Multivalued variant of TRIMB()
TRIMF()Trim spaces from front of string
TRIMFS()Multivalued variant of TRIMF()
TRIMS()Multivalued variant of TRIM()
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

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
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
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
OSDELETEDelete a file by pathname
OSREADRead a file by pathname
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
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
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
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
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
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
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
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
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
TESTLOCKTest state of a task lock
UNASSIGNED()Test whether variable is unassigned
UNLOCKRelease task lock
XTD()Convert a hexadecimal number