System Variables, as its name suggests, are Global variables that store various settings pertaining to various aspects of the current Operating System environment.
The table below details the most common uses of System Variables.
Use Case | Description |
---|---|
Application variables | It is common for Applications to specify several system variables |
FileSwitch variables | Relates to current Filing System in use |
File types | Specify how specific file type should be handled by the OS |
Filing Systems | Specify how absenst Filing Systems should be handled |
CLI | Settings specific to the Command Line Interpreter |
Configuration | Various OS related settings are stored as System Variables |
System Path | Specify pathnames that will be searched for files during read or execute operations |
Obey files | Specify the directory from which an Obey file is being run |
Time and date | Used to evaluate time, date and years |
Return codes | Provides access to the last returned value given by OS_Exit |
!System and !Scrap pathname |
Provides full pathnames to the respective directories |
Desktop | Various settings and values specific to the desktop environment |
TaskWindow | Specify pathname to application that was used to start up task windows |
Devices | Various settings specific to devices attached to the system |
Printing | Specify various settings specific to the Printing device |
There are several types of system variable
Type | Description | How to Set | How to Remove |
---|---|---|---|
String | Contains any characters you like; these are returned when the string is read | *Set | *Unset |
Integer | are four-byte signed integers | *SetEval | *Unset |
Macros | Macros are strings that are passed through OS_GSTrans when the string is read. This means that if the macro contains references to variables or other OS_GSReadable items, the appropriate translation takes place whenever the variable is accessed | *SetMacro | *Unset |
Example: To set the command line prompt (CLI$Prompt ) to the current time, followed by a space, you would use: |
|||
*SetMacro CLI$prompt <Sys$Time><&20> |
|||
Machine Code | A routine is called whenever the variable is to be read, and another when it is set. This allows great flexibility in the way in which such variables behave | OS_SetVarVal | OS_ReadVarVal |
Example: you could make a variable directly control a CMOS RAM location using this technique | |||
Sys$Time is a good example of a code variable |
You must not use wholly numeric names. e.g. 123 as this causes difficulties when the OS_GSRead and OS_GSTrans operations are used to lookup the value of the variable. In particular, they will always take <123> to mean the ASCII code 123, and will not attempt to look up the name as a variable.
Names may contain any non-space, non-control character.
When a variable is created, the case of the letters is preserved, however, when returning the values, the case is not important.
You can use the characters ‘#’ and ‘*’ – just like looking up filenames.