
Chapter 8 715
Command Definitions SP-Z
WHILE
WHILE
Used to control the execution sequence of a job, session, UDC, or command file. (Native
Mode)
Syntax
WHILE expression [ DO]
Parameters
expression Logical expression, consisting of operands and relational operators. Table
8-1 lists the operators that may be incorporated in expression.
Table 8-1 Logical Operators - The WHILE Command
Use HELP FUNCTIONS |OPERATORS |EXPRESSIONS for more info
The WHILE command evaluates expression and displays the result (TRUE or FALSE) to
$STDLIST. If expression does not resolve to a Boolean result, an error is reported.
The DO keyword is optional. It may be used or omitted and has no affect on the results.
Operation Notes
This command begins a WHILE block, which consists of all the commands lying between
WHILE and the next ENDWHILE statement. The ENDWHILE must have the same
nesting level as the WHILE statement. The ENDWHILE statement ends the WHILE
block.
The logical expression is evaluated and, as long as expression evaluates to TRUE, the
WHILE block is executed.
Logical operators: AND, OR, XOR, NOT
Boolean functions and values: BOUND, TRUE, FALSE, ALPHA,
ALPHANUM, NUMERIC, ODD
Comparison operators: =, <>, <, >, <=, >=
Bit manipulation operators: LSL, LSR, CSR, CSL, BAND, BOR, BXOR,
BNOT
Arithmetic operators: MOD, ABS, * , / , + , -, ^ (exponentiation)
Functions returning strings: CHR, DWNS, UPS, HEX, OCTAL, INPUT,
LFT, RHT, RPT, LTRIM, RTRIM, STR
Functions returning integers: ABS, LEN, MAX, MIN, ORD, POS, TYPEOF
Other functions: FINFO, SETVAR