Previous Topic

Next Topic

Book Contents

Book Index

DO WHILE / DO ENDWHILE: Action Parameter

The DO block can optionally include WHILE/ENDWHILE blocks. DO WHILE and DO ENDWHILE statements enable use of repetition (loop) logic in a rule. These statements can be used to repeatedly perform other DO actions for as long as a specified condition is met.

Type WHILE in the DO field and press Enter. The word DO is replaced by the word WHILE on the screen. The same will occur when you type ENDWHILE in a DO field.

The following figure shows the basic format of the WHILE and ENDWHILE statements.

Fig.JV.3.24a WHILE/ ENDWHILE Statements Format

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

 DO action

     .

     .

     .

  DO action

ENDWHILE

The WHILE conditional expression has the following format:

WHILE operand operator operand

Valid logical operators are shown in the following table. For numeric comparisons, use the logical operators with the "#" symbol.

Tab.JV.3.20 Logical Operators for WHILE 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 the following table.

Tab.JV.3.20a Boolean Operators for WHILE 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

WHILE 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:

WHILE B%%A GT B%%C

Each WHILE expression must be terminated with an ENDWHILE statement.

Parent Topic

Parameter Descriptions