IBM SC34-5764-01 Server User Manual


 
DO
Purpose
DO groups instructions together and optionally processes them repetitively. During repetitive execution, a
control variable (name) can be stepped through some range of values.
Syntax Notes:
v The exprr, expri, exprb, exprt, and exprf options (if present) are any expressions that evaluate to a
number. The exprr and exprf options are further restricted to result in a positive whole number or zero. If
necessary, the numbers are rounded according to the setting of NUMERIC DIGITS.
v The exprw or expru options (if present) can be any expression that evaluates to 1 or 0.
v The TO, BY, and FOR phrases can be in any order, if used, and are evaluated in the order in which
they are written.
v The instruction can be any instruction, including assignments, commands, and keyword instructions
(including any of the more complex constructs such as IF, SELECT, and the DO instruction itself).
v The subkeywords WHILE and UNTIL are reserved within a DO instruction, in that they cannot be used
as symbols in any of the expressions. Similarly, TO, BY, and FOR cannot be used in expri, exprt, exprb,
or exprf. FOREVER is also reserved, but only if it immediately follows the keyword DO and an equal
sign does not follow it.
v The exprb option defaults to 1, if relevant.
Simple DO Group
If you specify neither repetitor nor conditional, the construct merely groups a number of instructions
together. These are processed one time.
In the following example, the instructions are processed one time.
Example:
/* The two instructions between DO and END are both */
/* processed if A has the value "3". */
If a=3 then Do
a=a+2
Say 'Smile!'
End

DO
repetitor conditional
;
instruction
END
name
;
repetitor: name=expri
TO exprt BY exprb FOR exprf
FOREVER
exprr

conditional:
WHILE exprw
UNTIL expru
DO
138
CICS TS for VSE/ESA: REXX Guide