Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

IF Initiate IF block

&pagelevel(4)&pagelevel

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


0CMD0001No error

1CMD0202Syntax error

1SDP0118Command in false context

1SDP0223Incorrect environment

3CMD2203Incorrect syntax file

32CMD0221System error (internal error)

64SDP0091Semantic error

130SDP0099No 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: /IFA==B

(2)

The parentheses can be omitted: /ELSE-IFA > B