The IF statement is a valuable tool used to verify a conditional
expression. The conditional expression can be as basic as testing the
value of a variable or can be expanded to use VER statement constructs
and Boolean capabilities. This topic first defines the complete
syntax of the IF statement. Other more detailed topics describe:
- Basic IF value testing
- IF statement with VER constructs
- IF statement with Boolean operators
- IF statement with VSYM built-in function
IF statements are valid in the )INIT, )REINIT, )PROC, )ABCINIT,
and )ABCPROC panel sections.
The syntax of the IF statement is shown here.

>>-IF(-| conditional-expression |------------------------------->
>--+--------------------------------------------------+--)-----><
| .----------------------------------------------. |
| V | |
'---boolean-operator--| conditional-expression |-+-'
conditional-expression
.-,-----.
V |
|--+-variable--operator----value-+-----------------------------------+--|
| .-,---------. |
| V | |
'-VER--(--variable--+-------------+--,--keyword----+-------+-+--)-'
'-,--NONBLANK-' '-value-'
IF statement…
⋮
(Optional ELSE statement…)
⋮
where:
- Boolean-operator
- The character symbol & or characters AND
(AND Boolean operator) or the character symbol | or characters
OR (OR Boolean operator).
- ELSE
- The optional statement that specifies alternate processing if
the IF condition is not satisfied.