The IF-ELSEIF-ELSE-ENDIF construct consists of conditional clauses in a pattern that use expressions to determine which actions to execute. The construct is flexible and allows you to define actions that should occur if certain conditions are true or not true.
Format
IF expression [action]... [ELSEIF expression [action]...]... [ELSE [action]...] ENDIF
Conditional Clauses
Table 4–10 describes the clauses of a conditional construct.
Table 14. Conditional Clauses
Clause | Description |
---|---|
IF | Indicates the beginning of the conditional construction. Expression is required; an action is optional. |
ELSEIF | Introduces an optional clause that includes a condition that is checked if the expression from the IF clause or previous ELSEIF clause evaluates to false. If the ELSEIF expression evaluates to true, the following set of actions is executed. You can specify multiple ELSEIF clauses in a conditional construct. |
ELSE | Introduces an optional clause that includes a set of actions that are executed if none of the expressions in the preceding IF and ELSEIF clauses evaluate to true. |
ENDIF | Indicates the end of the conditional construct. |
where:
is a condition that must evaluate to true for the specified actions to occur. See Section 5.
action
Any autoaction you can specify with an ACTION command
SET action
RESET action
CREATE action
DESTROY action
A nested conditional construct
Sequence of Conditional Action Processing
Conditional action processing occurs in the sequence specified in the conditional construct. For instance, in a simple conditional action construct, the processing would occur in the following sequence.
Clause | Expression Is True (Nonzero) | Expression Is Not True (Zero) |
---|---|---|
Step 1: IF | AMS performs the actions specified following the IF clause and proceeds to step 4. |
|
Step 2: ELSEIF | AMS performs the actions specified following the ELSEIF clause and proceeds to step 4. |
|
Step 3: ELSE | No expression is associated with the ELSE clause. If processing reaches this point, the IF clause and all ELSEIF clauses evaluated to false. The actions specified following the ELSE clause are performed. | |
Step 4: ENDIF | Conditional processing ends
|