Domain: PROCEDURE
Command description
The IF command initiates an IF block, i.e. a conditional command sequence: If the condition in the IF command is met, the command sequence following the IF command is executed. Otherwise, the system searches for other ELSE-IF or ELSE commands in the current IF block. If the current IF block does not contain any ELSE-IF or ELSE commands, procedure execution resumes with the command following the appropriate END-IF (see section“Defining conditional branches”).
Format
IF |
CONDITION = <text 0..1800 with-low bool-expr> |
Operands
CONDITION = <text 0..1800 with-low bool-expr>
Logical expression as the condition for executing the command sequence between the IF and ELSE-IF or ELSE command (see chapter “Expressions” for information on logical expression).
If the logical expression includes a single ’=’ sign, then this must be enclosed in parentheses.
Command return codes
(SC2) | SC1 | Maincode | Meaning |
0 | CMD0001 | No error | |
1 | CMD0202 | Syntax error | |
1 | SDP0118 | Command in false context | |
1 | SDP0223 | Incorrect environment | |
3 | CMD2203 | Incorrect syntax file | |
32 | CMD0221 | System error (internal error) | |
64 | SDP0091 | Semantic error | |
130 | SDP0099 | No further address space available |
Example
/A = 2 /B = 3 /IF (A = B) /WRITE-TEXT 'A AND B ARE CORRECTLY INITIALIZED' /ELSE-IF (A > B) /WRITE-TEXT 'A IS TOO LARGE' /ELSE /WRITE-TEXT 'B IS TOO LARGE' /END-IF B IS TOO LARGE
Note on the parentheses in the logical expressions:
(1) | The parentheses can be omitted when the “=” sign is duplicated: |
(2) | The parentheses can be omitted: |