IF-THEN-ELSE
Syntax
IF expression THEN instruction1; ELSE instruction2
IF-THEN-ELSE conditionally processes an instruction depending on the evaluation of the expression. The expression is evaluated and results in 0 (false) or 1 (true). The instruction after the THEN clause is processed only if the result is 1 (true). If you specify an ELSE clause, the instruction after the ELSE clause is processed only if the result of the evaluation is 0 (false).
Example:
IF result > 0 then exit 99; else ADD(TEST01)
Note:
Example:
- If the ELSE clause is on the same line as the last instruction of the THEN clause, it must be preceded by a semicolon (;) followed immediately by a blank character.
- If the ELSE clause is on the line following the last instruction of the THEN clause, that last THEN clause line must end with a semicolon followed immediately by a comma.
if substr(&OYMD1,5,2) = 30 then GOTO DAY30;,
else EXIT 50 The ELSE clause binds to the nearest IF instruction
at the same level.The expression can contain concatenation, comparison, and logical operators. An operator represents an operation, such as addition, to be performed on one or two terms.