TACL Reference Manual

Built-In Functions and Variables
HP NonStop TACL Reference Manual429513-018
9-194
#IF Built-In Function
Examples
1. The macro, furd, outputs each of its arguments on a separate line:
[#DEF furd MACRO |BODY|
== Output current argument
#OUTPUT %1%
== Test for more arguments
[#IF NOT [#EMPTY %2 TO *%] |THEN|
furd %2 TO *% == Call self without 1st arg
]
]
2. This example illustrates the use of a numeric expression:
[#IF 3 | THEN | . . .
3. This example illustrates the use of a variable name containing a decimal number:
#SET var 3
[#IF var | THEN | . . .
4. This example illustrates the use of an arithmetic expression enclosed in
parentheses:
#SET var 4
[#IF (var-1 = 3) | THEN | . . .
5. This example shows an #IF with a contingent control path, to be taken if the
numeric expression is false:
#SET tversion [#TACLVERSION]
#CHARGETV tversion tgeneric 1 TO 6
[#IF tgeneric '<' "T9205C" |THEN|
SINK [#LOAD /KEEP 1/ $vol.subvol.firstlib]
.
.
.
|ELSE|
ATTACHSEG SHARED mysegf :mydir
USE :mydir
]
6. This example illustrates an #IF with no enclosure, deleting the result of
#ARGUMENT while still allowing #ARGUMENT to accomplish its action, assigning
the argument value to NUM:
#IF [#ARGUMENT /VALUE num/ NUMBER]