Skip to main content

System Variables

System-defined @ variables used for storing data values.

System-Defined Variables

Caché MVBasic provides a number of system variables, identified by an @ sign as the first character of their names. These variables are set by MVBasic. Unless otherwise indicated, they cannot be set by user programs. If no value is set, these variables contain the empty string.

MVBasic provides four @ sign variables that are reserved as user-defined variables. These are @USER1, @USER2, @USER3, and @USER4. By default they contain the empty string.

MVBasic also supports three other types of user-defined variables: local variables, global variables, and process-private global variables. For further details, refer to the Variables page in this manual.

A special case of these @ variables are the dynamic array level delimiter characters. These always contain the same single characters, represented by @AM, @FM, @IM, @SM, @SVM, @TM, and @VM. For further details on these special characters, refer to the Dynamic Arrays page in this manual.

Caché MVBasic supports most, but not all of the system variables provided by other flavors of MultiValue. The MultiValue Basic Quick Reference contains an @-Variables table showing which UniVerse system variables are supported by Caché MVBasic. The following are the Caché MVBasic system variables:

@ACCOUNT The current account name, which is usually identical to the Caché namespace name. Note that the SYSPROG account corresponds to the %SYS namespace.
@ANS The answer of the last-executed ITYPE() function. This value is user modifiable.
@AUTHORIZATION The current Caché username. This is the same value that is returned by %SYS.ProcessQuery.UserNameOpens in a new tab. This is the username used by the MultiValue Shell start-up routine to match with a corresponding Proc or Paragraph name.
@COMMAND The command line that invoked this program. (See Note 2.) This value is user modifiable.
@COMMAND.STACK The contents of the command stack, a list of commands issued from the MultiValue Shell as a dynamic array (with @FM delimiters) with most recent items first. See also SYSTEM(33) function.
@CONV Used by the CALCULATE function to hold the code string for the OCONV function. This value is user modifiable.
@CRTHIGH Number of lines displayed in the terminal window.
@CRTWIDE Number of columns displayed in the terminal window.
@DATA Returned data, separated by CHAR(13) (carriage return) characters. Provided for compatibility with UniData systems.
@DATA.PENDING Returned data, separated by @AM (CHAR(254)) delimiter characters.
@DATE The date when the current process started, in internal format (see Note 1). To convert to display format, use the OCONV function. (See Note 1.) This value is user modifiable.
@DAY The day of the month when the current process started, specified as an integer. (See Note 1.) This value is user modifiable.
@DICT You must set @DICT to the dictionary of the file you will specify in the CALCULATE function. This value is user modifiable.
@FALSE The 0 character, representing the boolean value.
@FILE.NAME Same as @FILENAME. This value is user modifiable.
@FILENAME The pathname specified in the most recent invocation of OPENSEQ. If the sequential file exists, @FILENAME contains pathname as a file pathname. If the sequential file does not exist, @FILENAME contains pathname as a directory pathname. No other validation is performed on the pathname. This @FILENAME value is only changed by another invocation of OPENSEQ. It is not changed by operations such as creating a file, closing a file, or deleting a file. This value is user modifiable.
@FORMAT Used by the CALCULATE function to hold the format string for the FMT function. This value is user modifiable.
@HEADER Used by the CALCULATE function to hold the header string for the HEADING command. This value is user modifiable.
@ID Current record ID. This value is user modifiable.
@IO.ERROR The error status of the most recent failed I/O operation. Is not modified by a successful I/O operation. This value is user modifiable. Compare with @IO.STATUS.
@IO.STATUS The status of the most recent I/O operation. Contains 0 if the I/O operation succeeded. Contains an error code if the I/O operation failed. This value is user modifiable. Compare with @IO.ERROR.
@ITYPECACHE This value is user modifiable.
@LASTLOGONPROG The name of the last LOGON procedure, paragraph, or program executed. Updated when a process starts the MV Shell or changes accounts using the LOGTO command. Only valid for processes started from the MV Shell.
@LEVEL Nested level of execution. Starts at 0. Reset by ABORT commands.
@LOGNAME The operating system user login name. This is the same value that is returned by %SYS.ProcessQuery.OSUserNameOpens in a new tab. @LOGNAME and @USER are synonyms. Also see @AUTHORIZATION.
@LPTRHIGH Number of lines on the current output device, either a printer or a terminal window.
@LPTRWIDE Number of columns on the current output device, either a printer or a terminal window.
@ME A handle to the object reference from within an instance, method, or property. Contains the current class context. Same as the $THIS special variable in ObjectScript. @ME can reference a multidimensional property using arrow syntax, as follows: @ME->property(subscript). @ME itself is not modifiable, but @ME->property can be used wherever a command uses a SETTING clause to set an output variable.
@MONTH The month of the year when the current process started, specified as an integer. (See Note 1.) This value is user modifiable.
@MV The current value counter, only used for columnar listing. Used only in I-descriptors. Same as @NV. This value is user modifiable.
@NB Current BREAK level number. 1 is the lowest-level break. Used only in I-descriptors. This value is user modifiable.
@ND Number of detail lines since the last BREAK on a break line. Used only in I-descriptors. This value is user modifiable.
@NI Current item counter (the number of items listed or selected to Select List 0). Used only in I-descriptors. Same as @RECCOUNT. This value is user modifiable.
@NS Current subvalue counter for columnar listing only. Used only in I-descriptors. This value is user modifiable.
@NV The current value counter, only used for columnar listing. Used in I-descriptors. Same as @MV. This value is user modifiable.
@PARASENTENCE The command line that invoked this program. (See Note 2)
@PATH The full pathname for the current account. For a terminal session running the MV shell, the pathname is: c:\cachesys\mgr\user.
@PORTNO The current port number, specified as an integer.
@QWHO The current account name when a program is run using the MV Shell. @QWHO retains the name of a Q pointer account if that was the login account. @QWHO does not track account changes caused by changing namespaces using ObjectScript commands. For the current account name for programs run using CSP or class methods, use @WHO.
@RECCOUNT The current item counter (the number of items listed or selected). Used only in I-descriptors. Same as @NI. This value is user modifiable.
@RECORD The current record. This value is user modifiable.
@RECURn A set of variables: @RECUR0, @RECUR1, @RECUR2, @RECUR3, and @RECUR4. These values are user modifiable.
@SELECTED Number of elements selected from the most recent select list. See the SELECT statement. Defaults to 0. This value is user modifiable. If $OPTIONS FSELECT is set, @SELECTED returns the number of elements selected; If $OPTIONS FSELECT is not set, @SELECTED always returns 1. See also SYSTEM(11) function.
@SENTENCE The command line that invoked this program. (See Note 2)
@STDFIL Standard file. The file opened to the default file variable.
@SYS.BELL The ASCII bell character (CHAR(7)). Printing this variable rings the bell.
@SYSTEM.RETURN.CODE Status code for system processes. Returns 0 for success, -1 for error. This variable is not set by I/O operations; I/O operations set @IO.STATUS and @IO.ERROR. This value is user modifiable.
@SYSTEM.SET Status code for system processes. This value is user modifiable.
@TERM.TYPE The terminal type for the current terminal. For example, vt220.
@TIME The time when the current process started, in internal format (see Note 1). (When issued from the MV terminal shell, this is the time that the last command line was invoked.) @TIME rounds to whole seconds. To return the current time in internal format, use the TIME function. The TIME function includes fractional seconds. To convert from internal format to display format, use the OCONV function. This value is user modifiable.
@TRANSACTION An integer that specifies whether a transaction is active. 0 indicates no active transaction.
@TRUE The 1 character, representing the boolean value.
@TTY The terminal device name (Device). For example: |TRM|:|436. This value is user modifiable.
@UDTNO Terminal Number. A unique integer assigned to a terminal job. Corresponds to the port number returned by the LISTME MultiValue command. Exiting and re-entering the MV shell does not change this integer value. Provided for compatibility with UniData systems.
@UID User ID (uid) on a UNIX® system. Returns 0 on non-UNIX® systems. Provided for compatibility with UniData systems.
@USER The operating system user login name. This is the same value that is returned by %SYS.ProcessQuery.OSUserNameOpens in a new tab. @USER and @LOGNAME are synonyms. Provided for D3 compatibility.
@USER.NO Same as @USERNO.
@USERNO The port number of the current process. (See Note 3)
@USER.RETURN.CODE Status code for user processes. This value is user modifiable.
@USER.TYPE Returns 0 if the Caché process is an interactive terminal. Returns 1 if the Caché process is a MultiValue phantom process. Returns 2 if neither of the above, for example a process started via the JOB statement. Provided for compatibility with UniData systems.
@WHO Name of the current account. @WHO tracks account changes caused by changing namespaces using ObjectScript commands. See also @QWHO.
@YEAR The year when the current process started, specified as two digits. The expansion of two-digit years to four digits is governed by the MultiValue CENTURY.PIVOT verb, described in Operational Differences Between MultiValue and Caché. (See Note 1.) This value is user modifiable.
@YEAR4 The year when the current process started, specified as four digits. (See Note 1.) This value is user modifiable.
Note 1

This variable is computed when a program is started and does not change during execution. Time and date variables represent local time and date. Caché MultiValue determines local time and date as follows:

  • It determines the current Coordinated Universal Time (UTC) from the system clock.

  • It adjusts UTC to the local time zone by using the value of the Caché special variable $ZTIMEZONE.

  • It applies local time variant settings (such as Daylight Saving Time) for that time zone from the host operating system.

Note 2

The timing and nature of updates to these variables is very emulation dependent.

Note 3

Port numbers are an optional site configurable value. The default value is the Caché process number.

See Also

  • $MVname special variables in the Caché ObjectScript Reference

  • $MVV(n) special variables in the Caché ObjectScript Reference

FeedbackOpens in a new tab