Revised January 2024; see History
The DO file processor supports various special information variables or built-in macros which all have a $ prefix, followed by one or more alphabetic characters and possibly an arithmetic suffix. The supported variables are listed here; those that are A-Shell extensions are noted at the end of the list.
Also note that the special $ variables are only expanded within DO files, not CMD files.
Variable |
Value |
---|---|
$: |
Original device (e.g. "DSK0:") |
$P |
Original ppn (e.g. "7,6") |
$$ |
Real dollar sign |
$TM |
Time of day in 24 hour HH:MM format (e.g. "13:27") |
$TD |
Current date in YYMMDD format |
$TW |
Current day of week as a number (0=Mon, 1=Tue,...) |
$NJ |
Current job name (e.g. "TSKAAA") |
$NT |
Current terminal name |
$ND |
Current terminal driver name |
$NS |
Current OS (e.g. "AIX") |
$SV |
Current OS version |
$UX |
Current radix (e.g. "8" or "16") |
$LG |
Current language (e.g. "ENGLISH") |
$LY |
Yes character (e.g. "Y") |
$LN |
No character (e.g. "N") |
$NU |
Current login name (e.g. "root") |
The following are supported only under A-Shell:
Variable |
Value |
---|---|
$HF |
Current host full path (e.g. "/vm/miame/dsk0/001004") |
$HD |
Current host disk (e.g. "dsk0") |
$HP |
Current host ppn (e.g. "001004") |
$HM |
MIAME environmental variable definition (e.g. "/vm/miame") |
$MMDDYY{+/-##} |
Each of these evaluates to current date in the specified format, with an optional +/- days adjustment. |
$DDMMYY{+/-##} |
|
$YYMMDD{+/-##} |
Comments
These special information variables are typically used in IF statements or in output messages.
Note that unlike ASB string symbols defined with the DEFINE statement, these special $ variables in DO files do not contain their own quotes, so if they are used in a context that requires a quoted string, explicit quotes must be added.
Examples
IF "$NU" = "jack" ; (correct)
IF $NU = jack ; (incorrect)
IF LEFT("$NJ",3) = "TAS" ; (correct)
IF LEFT($NJ,3) = "TAS" ; (incorrect)
IF "LEFT($NJ,3)" = "TAS" ; (incorrect)
If today were December 1, 2023, then:
$MMDDYY equals 120123
$MMDDYY+15 equals 121623
$DDMMYY equals 011223
$DDMMYY-1 equals 301123
$YYMMDD equals 231201
$YYMMDD+32 equals 240101
History
2024 January, A-Shell 7.0.1753: Support added for date variables.