ObjectScript Special Variables
Special variables are variables that are maintained by the system. They are also referred to as system variables, but are here referred to as special variables to avoid confusion with structured system variables.
Special variable names begin with a dollar sign ($). They can be distinguished from functions because they are not followed by parentheses and take no arguments. Special variable names are not case-sensitive. Many special variable names can be abbreviated. In the Synopsis for each special variable, the full name syntax is first presented, and below it is shown the abbreviated name (if one exists).
Historically, special variables have held scalar values. The system automatically updates these special variables to reflect various aspects of the operating environment. For example, the $IO special variable contains the ID of the current device. The $JOB special variable contains the ID of the current job.
Although you can set some special variables, most are read-only. With the exception of this read-only constraint, you can treat the special variables just as you would any other variable. For example, you can reference a special variable in an expression and assign its current value to another (user-defined) variable.
Any implementation-specific special variable form is marked with the abbreviation of the platform that supports it (Windows or UNIX®). Any form that is not marked with a platform abbreviation is supported by all platforms.
Special variables are listed in alphabetical order.
- $DEVICE – Contains user-specified device status information.
- $ECODE – Contains the current error code string.
- $ESTACK – Contains the number of context frames saved on the call stack from a user-defined point.
- $ETRAP – Contains a string of ObjectScript commands to be executed when an error occurs.
- $HALT – Contains a halt trap routine call.
- $HOROLOG – Contains the local date and time for the current process.
- $IO – Contains the ID of the current input/output device.
- $JOB – Contains the ID of the current process.
- $KEY – Contains the terminator character from the most recent READ.
- $NAMESPACE – Contains the namespace for the current stack level.
- $PRINCIPAL – Contains the ID of the principal I/O device.
- $QUIT – Contains a flag indicating what kind of QUIT is required to exit the current context.
- $ROLES – Contains the roles assigned to the current process.
- $STACK – Special variable that contains the number of context frames saved on the call stack.
- $STORAGE – Contains the number of bytes available for local variable storage.
- $SYSTEM – Contains system information about system objects.
- $TEST – Contains the truth value resulting from the last command using the timeout option.
- $THIS – Contains the current class context.
- $THROWOBJ – Contains the OREF from an unsuccessful THROW.
- $TLEVEL – Contains the current nesting level for transaction processing.
- $USERNAME – Contains the username for the current process.
- $X – Contains the current horizontal position of the cursor.
- $Y – Contains the current vertical position of the cursor.
- $ZA – Contains the status of the last READ on the current device.
- $ZB – Contains status information for the current I/O device.
- $ZCHILD – Contains the ID of the last child process.
- $ZEOF – Contains flag indicating whether end-of-file has been reached.
- $ZEOS – Contains end-of-stream status when reading a compressed stream.
- $ZERROR – Contains the name and location of the last error.
- $ZHOROLOG – Contains the number of seconds elapsed since InterSystems IRIS startup.
- $ZIO – Contains information about the current terminal I/O device.
- $ZJOB – Contains job status information.
- $ZMODE – Contains current I/O device OPEN parameters.
- $ZNAME – Special variable that contains the current routine name.
- $ZNSPACE – Contains the current namespace name.
- $ZORDER – Contains the value of the next global node.
- $ZPARENT – Contains the ID of the parent process of the current process.
- $ZPI – Contains the value of pi.
- $ZPOS – Contains the current file position during the reading of a sequential file.
- $ZREFERENCE – Contains the current global reference.
- $ZSTORAGE – Contains the maximum available memory for a process.
- $ZTIMESTAMP – Contains the current date and time in Coordinated Universal Time format.
- $ZTIMEZONE – Contains the time zone offset from the Greenwich meridian.
- $ZTRAP – Contains the location of the current error trap handler.
- $ZVERSION – Contains a string describing the current version of InterSystems IRIS.