Previous Topic

Next Topic

Book Contents

Book Index

DO IF / DO ELSE / DO ENDIF: Automated Console Action Parameter

DO IF, DO ELSE, and DO ENDIF statements provide Control-O with Boolean "IF" logic capability. These statements permit branching based on different criteria. The examples at the end of this section demonstrate combination of these statements.

Figure 155 DO IF/DO ELSE/DO ENDIF Statements Format

Type IF in the DO field and press Enter. The word DO is replaced by the word IF on the screen. The same will occur when specifying ELSE and ENDIF in the DO fields.

Figure 156 shows the basic format of the IF/ ELSE/ ENDIF control statements.

Figure 156 IF/ ELSE/ ENDIF Statements Format

IF conditional-expresssion1 [{AND|OR} conditional-expression2]

DO action

DO action

     .

     .

     .

     .

  DO action

ELSE

  DO action

  DO action

     .

     .

     .

     .

ENDIF

The IF conditional expression has the following format:

IF operand operator operand

Valid logical operators are shown in Table 131.

Table 131 Logical Operators for IF Statement

Operator

Definition

EQ
EQ#

is equal to

NE
NE#

is not equal to

GT
GT#

is greater than

GE
GE#

is greater than or equal to

LT
LT#

is less than

LE
LE#

is less than or equal to

Valid Boolean operators are shown in Table 132.

Table 132 Boolean Operators for IF Statement

Operator

Definition

AND

both expressions must be true

OR

either expression must be true

Operators that end with the pound sign (#) are used for numerical comparisons, as opposed to string comparisons.

An operand can be any character string. It can also be composed of AutoEdit symbols. In such cases, it is resolved into a character string before the conditional expression is analyzed at execution time.

Whenever non-numeric comparison operators are specified, operands are compared as character strings from left to right. For example, in the expression

IF 91 GT 1000

91 is greater than 1000 (because 9 is greater than 1).

An operand cannot be resolved into nulls (as in CLISTs). If it is possible that an operand will resolve into nulls, place a character before the first and second operands.

In the following example, the character B is placed before the two operands:

IF B%%A GT B%%C

An IF expression must be terminated with an ENDIF statement. The ELSE statement is optional.

Parent Topic

Rule Parameters