TACL Reference Manual

Variables
HP NonStop TACL Reference Manual429513-018
4-7
Sample Declarations
For example, if you replace the TACL STATUS command with a macro called
STATUS, you can no longer use the TACL STATUS command. To access the TACL
STATUS command, you must make the variable S an alias for :UTILS:TACL:STATUS.
You can also use alias variables to define function keys. For more information, see the
Guardian User’s Guide.
Sample Declarations
This definition defines the variable S as an alias for the STATUS command:
[#DEF s ALIAS |BODY| STATUS]
After loading this definition, type the letter s to obtain status information.
Limitations
An alias must define something TACL can actually execute. TACL generates an error if
an alias returns simple text. A macro (described in MACRO Variables) does not have
this restriction. For example, given these definitions:
34> [#DEF a ALIAS |BODY| Huzzah]
35> [#DEF m MACRO |BODY| Huzzah]
you could do this:
36> #OUTPUT [m]
Huzzah
but not this:
37> #OUTPUT [a]
Huzzah
^
Expecting ...
followed by lists of what the alias could have been, followed by
#OUTPUT [a]
^
*ERROR* Cannot resolve alias
38>
MACRO Variables
A macro variable contains TACL statements; a macro can include conditional logic and
can invoke other macros and functions. When TACL encounters a macro name, it
replaces that name with the entire contents of the macro and interprets it, performing
the specified work.
If you declare variables within the macro and use #FRAME and #UNFRAME to
precede and follow their declaration and use, TACL deletes the variables before you
exit the macro.