TACL Reference Manual

Lexical Elements
HP NonStop TACL Reference Manual429513-018
2-4
Metacharacters
you can enclose var1 in square brackets to obtain the contents of var1 or you can
omit the brackets to obtain the text var1:
12> #OUTPUT [var1]
3
13> #OUTPUT var1
var1
14>
If the variable is a routine that contains executable TACL statements, TACL
interprets the executable statements and replaces the variable name with the result
of the statements.
When specifying the contents of a variable as an argument to a command or built-in
function, you do not always need to enclose the variable name in square brackets:
Commands and built-in functions such as VCHANGE and #CHARGETV expect a
variable name for one or more arguments. When you supply a variable name as an
argument to one of these commands or built-in functions, you do not need to
enclose a variable name in square brackets. (In these cases, if you wish to supply
text in place of a variable name, you must enclose the text in double quotation
marks.)
Commands and built-in functions such as #IF and #COMPUTE expect expressions
as arguments. When you supply a variable name as an argument to one of these
commands or built-in functions, you do not need to enclose a variable name in
square brackets. For more information about expressions, see Section 3,
Expressions.
TACL evaluates the contents of square brackets before other portions of a statement.
This example illustrates the effect of square brackets on invocation sequence.
#OUTPUT is a built-in function that sends its argument to the TACL OUT file.
18> #OUTPUT #PMSEARCHLIST
#PMSEARCHLIST
19> #OUTPUT [#PMSEARCHLIST]
#DEFAULTS $HOME.SUBV $SYSTEM.SYSTEM
20> [#OUTPUT] #PMSEARCHLIST
#PMSEARCHLIST expanded to:
#DEFAULTS $HOME.SUBV $SYSTEM.SYSTEM
In the first case, line 18, TACL expands the #OUTPUT function first because it
encounters it first; there are no square brackets in the command line. The #OUTPUT
function uses the simple text “#PMSEARCHLIST” as its argument.
In the second case, line 19, TACL expands #PMSEARCHLIST first because of the
brackets. The #PMSEARCHLIST built-in variable returns the list of subvolumes in the
program and macro search list; TACL then expands #OUTPUT with that text as its
argument.