Special $ Variables

Reviewed and reorganized June 2020

The DO file processor supports various special information variables or built-in macros which take the form $x or $xx, where x is alphabetic. The supported variables are listed here; those that are A-Shell extensions are noted at the end of the list.

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 env var definition (e.g. "/vm/miame")

 

These special information variables are typically used in IF statements or in output messages.

Note that unlike BASIC 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. For example:

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)

 

Also note that the special $ variables are only expanded within DO files, not CMD files.