@-Variables

@-Variables

Top  Previous  Next

 

QMBasic provides a number of special variables and constants with names prefixed by the @ character. Some @-variables can be updated by QMBasic programs though most are read-only.

 

Many of the @-variables are also available for use in I-type definitions or within paragraphs. A complete list of @-variables appears below.

 

 

Compile-time Constants

 

These constants are available in QMBasic programs and I-type definitions to improve readability.

 

@AMAttribute mark (synonym for @FM)
@FMField mark
@IMItem mark
@SMSubvalue mark
@SVMSubvalue mark (synonym for @SM)
@TMText mark
@VMValue mark
@FALSEBoolean value. Used as a number, this evaluates to zero.
@TRUEBoolean value. Used as a number, this evaluates to one.

 

@BUILD.TIMEDate/time at which the program was compiled as an epoch value.

 

 

Variables

 

Except where indicated in the descriptions, these items are read-only

 

@ABORT.CODE

A value indicating the cause of execution of the last abort. This variable is particularly useful within ON.ABORT paragraphs or programs invoked from them. Values are:

0No abort has occurred
1A QMBasic ABORT statement or the ABORT command has been used
2The Abort option has been selected after the break key was pressed
3An internal error has been detected

The value of @ABORT.CODE is initially zero and is reset to zero only by the EXECUTE statement

@ABORT.MESSAGE

Contains the text of any message associated with the most recent abort event.

@ACALL.FNO

The field number associated with a CALL correlative in an A or S-type dictionary item.

@ACCOUNT

Synonym for @WHO.

@ANS

Contains the result of the last virtual attribute expression evaluated. This variable can be updated, usually only in C-type dictionary items.

@BPV

Previous value of breakpoint item when using X breakpoint control option.

@COMMAND

The last command entered at the command prompt or initiated using the QMBasic EXECUTE statement. This variable is stacked across an EXECUTE and reverts to its previous value on completion of the executed command. If multiple commands are executed in a single  EXECUTE statement, the @COMMAND variable will be updated at each command.

@COMMAND.STACK

This variable holds the history of commands executed at the command prompt as a field mark delimited dynamic array. The most recent command is field 1.

@CONV

Extended information for user defined conversion codes.

@CRTHIGH

Contains the number of lines per page of the display.

@CRTWIDE

Contains the width of the display.

@DATA

Data from REFORMAT command.

@DATA.PENDING

Contains the data on the DATA queue, if any. Each item, including the last, is followed by an item mark character.

@DATE

The internal format date value (days since 31 December 1967) at which the last command started execution. Any changes made to this variable will also be reflected in the values of the @DAY, @MONTH, @YEAR and @YEAR4 variables described below.

@DAY

The day of the month at which the last command started execution as a two digit value. Changing @DATE will also change this value.

@DICTRECS

The query processor sets this variable to an item mark delimited copy of the dictionary records that were used to construct the display clause elements of the query (including any item with the BREAK.SUP prefix). For dictionary records that contain object code (C/I types and A/S types with correlatives), the object code is omitted. Field 1, value 2 of each element contains the item name. This variable can be of use in post-processing query processor output.

@DRIVE

The drive letter of the QMSYS directory (Windows only, null on other platforms).

@DS

Contains the operating system specific directory delimiter character, \ on Windows, / on other platforms.

@EXCEPTION

Contains the name of the last exception thrown by the QMBasic THROW statement. This variable can be modified by applications.

@EXCEPTION.DATA

Contains any qualifying data associated with the last exception thrown by the QMBasic THROW statement. This variable can be modified by applications.

@EXCEPTION.ORIGIN

Contains the program name and line number at which the last exception was thrown separated by a field mark. If the program has no cross-reference tables, the line number will be -1. This variable can be modified by applications.

@EXCEPTION.STACK

Dynamic array containing a full stack dump in the form created by SYSTEM(1002) at the point of throwing an exception for which the SAVE.STACK option of the CATCH clause was used. This variable can be modified by applications.

@FILE.NAME

The name of the file referenced in the most recent query processor command. This variable may be updated by a QMBasic program.

@FILENAME

Synonym for @FILE.NAME

@FMT

The query processor sets this variable to a field mark delimited list of the width and justification codes for each item in the display clause of the query (including any item with the BREAK.SUP prefix). This variable can be of use in post-processing query processor output.

@GID

User's group id number for all platforms except Windows. Same as SYSTEM(29).

@HOSTNAME

The name of the server computer system. Same as SYSTEM(1015).

@ID

The record id of the record being processed by a query processor command or an I-type function. This variable may be updated by a QMBasic program.

@IP.ADDR

The IP address associated with a network user. Same as SYSTEM(42).

@ITYPE.MODE

This variable can be used to determine the mode of execution of an I-type. It has three possible values:

0Normal
1Evaluation of the old index value when updating or deleting a record from a file with an alternate key index.
2Evaluation of the new index value when updating or adding a record to a file with an alternate key index.

@LEVEL

The current command processor depth (EXECUTE level). The initial command processor is level one, each EXECUTE level increments this by one, decrementing on return from that level.

@LINE

The current source line number in the module being compiled, possibly useful in error messages. See also @WHERE.

@LOGNAME

User's login name. On Windows, this is converted to uppercase.

@LPTRHIGH

Contains the number of lines per page of print unit zero. Depending on the current setting of the PRINTER flag, this may refer to the display or to the printer.

@LPTRWIDE

Contains the width of print unit zero. Depending on the current setting of the PRINTER flag, this may refer to the display or to the printer.

@MBUTTON

The button number related to the most recent mouse click trapped by KEYCODE() or KEYCODEV().

@MCOL

The screen column number related to the most recent mouse click trapped by KEYCODE() or KEYCODEV().

@MONTH

The month in which the last command started execution as a two digit value. Changing @DATE will also change this value.

@MROW

The screen row number related to the most recent mouse click trapped by KEYCODE() or KEYCODEV().

@NB

Break number level. Set to zero on detail lines and one upwards on break lines. A value of 255 represents the grand total line.

@NI

Item counter. Used in I-types, this holds the number of records retrieved by the query processor command. This variable can be updated, primarily for interaction with I-type dictionary items.

@NULL

SQL style null data constant for compatibility with data collections that may be converted to JSON string format.

@OPTION

Contains a copy of field 4 of the V-type VOC entry when a verb starts execution. Use of this variable enables related commands to be handled by a single program.

@PARASENTENCE

The sentence that invoked the most recent paragraph or sentence. On entering a command at the keyboard, this variable will be set to the same value as @COMMAND. If the command is a paragraph or sentence which invokes a further paragraph or sentence, the value will be updated to be the command which started this new paragraph or sentence.

@PATH

The pathname of the current account.

@PIB

The PROC primary input buffer. This variable can be modified by applications.

@POB

The PROC primary output buffer. This variable can be modified by applications.

@PSTAT

May be set by an application to contain diagnostic text that will be included in the output of the PSTAT command.

@QM.GROUP

The QM user group to which the user running this session belongs, a null string if none.

@QMSYS

The pathname of the system account.

@RECORD

The data of the record being processed by an I-type function. This variable may be updated by a QMBasic program.

@SELECTED

Contains the total record count for the most recent SELECT or SSELECT operation. Note that a QMBasic SELECT operation against a dynamic file processes the file one group at a time and this variable will show the record count for the group being processed. Note also that processing items from the select list does not decrement this value. To find the current state of a select list, use the SELECTINFO() function.

@SENTENCE

The currently active sentence. This is different from @COMMAND if the command runs a paragraph, sentence or menu.

@SEQNO

Hold file sequence number for most recent print job using uniquely sequenced file numbers.

@SIB

The PROC secondary input buffer. This variable can be modified by applications.

@SOB

The PROC secondary output buffer. This variable can be modified by applications.

@SOCKET

Socket file variable in a phantom process started with socket inheritability enabled. This variable can be modified by applications.

@STDFIL

Default file variable.

@SYSTEM.RETURN.CODE

A status value returned from most commands.

@SYS.BELL

This variable is available to QMBasic programs and initially contains the ASCII BEL character (character 7) which, when sent to the display, causes the audible warning to sound. The BELL OFF command changes @SYS.BELL to a null string and BELL ON reverts to the default character. Thus use of @SYS.BELL in QMBasic programs results in an audible alarm which can be disabled by the user.

@TERM.TYPE

Terminal type.

@TIME

The internal format time value (seconds since midnight) at which the last command started execution. This value may be updated by a QMBasic program.

@TRANSACTION.ID

The unique id number for the currently active transaction. Zero if no transaction is active. Same as SYSTEM(1007).

@TRANSACTION.LEVEL

The transaction depth. Zero when no transaction is active, incremented for each active transaction, decremented when a transaction terminates. Same as SYSTEM(1008).

@TRIGGER.RETURN.CODE

A status value returned set by trigger functions that return a STATUS() value of ER$TRIGGER.

@TTY

Terminal device name. This variable is provided for compatibility with other systems. It contains one of the following values:

consoleQMConsole interactive session on Windows
/dev/...QMConsole interactive session on other platforms
telnetTelnet session
phantomPhantom process
portSerial port connection
startupProcess started from STARTUP configuration parameter
vbsrvrQMClient process

Other process types may be added in future.

@UID

User's user id number for all platforms except Windows. Same as SYSTEM(27).

@USER

Synonym for @LOGNAME

@USER0 to @USER4

These variables are initially set to zero and may be updated by QMBasic programs to provide status information, etc. QM places no rules on the use of these variables and does not update them at any time.

@USERNO

User number.

@USER.NO

Synonym for @USERNO.

@USER.RETURN.CODE

This variable is initially set to zero and may be updated by QMBasic programs to provide status information, etc. QM places no rules on the use of this variable and does not update it at any time.

@VOC

This @VOC variable can be used as the file variable for the VOC in place of opening it explicitly within user written application code.

@WHERE

The current source line number in the module being compiled together with line numbers in nested include records in the form "21.4.3". Possibly useful in error messages. See also @LINE.

@WHO

User's account name.

@YEAR

The last two digits of the year in which the last command started execution. Changing @DATE will also change this value.

@YEAR4

The four digit year number in which the last command started execution. Changing @DATE will also change this value.