TACL Reference Manual

Built-In Functions and Variables
HP NonStop TACL Reference Manual429513-018
9-193
#IF Built-In Function
#IF Built-In Function
Use #IF to obtain one set of text (typically TACL statements), contained within the #IF
construct, if a given condition is met.
NOT
specifies that #IF should negate numeric-expression after evaluating it; that is,
the condition is met if numeric-expression is NOT true.
numeric-expression
is a decimal number, the name of a variable level containing a decimal number, or
an arithmetic, relational, or logical expression that evaluates to true or false:
enclosure
is an enclosure containing a THEN or an ELSE label. Each label is optionally
followed by text that typically consists of one or more functions that can be
executed if the option is chosen.
Result
If the expression evaluation is true, #IF returns the part of the enclosure labeled
|THEN|, if it exists. If the expression is evaluated as being false, #IF returns the part of
the enclosure labeled |ELSE|, if it exists. Any label not chosen is ignored.
Considerations
#IF statements can be nested.
The |THEN| and |ELSE| must be outside all square brackets within the enclosure
or they are not recognized.
You can omit both |THEN| and |ELSE| labels to make, in effect, a “don’t care”
condition. For example, the #IF can be used in this way as a carrier for another
function, deleting any numeric result of that function by testing it without acting on
it.
As with any function that contains an enclosure, the entire #IF construct must be
enclosed in square brackets.
#IF [ NOT ] numeric-expression [ enclosure ]
true = a numeric value other than zero
false = zero