DO command (PL/I)
The DO
command allows one or more commands to
be collected into a group that can (optionally) be repeatedly executed.
The DO
and END
keywords delimit
a group of commands collectively called a DO
group.
The keywords cannot be abbreviated.
- command
- A valid z/OS® Debugger command.
WHILE
- Specifies that expression is evaluated
before each execution of the command list. If the expression evaluates
to true, the commands are executed and the
DO
group begins another cycle; if it evaluates to false, execution of theDO
group ends. - expression
- A valid z/OS Debugger PL/I Boolean expression.
UNTIL
- Specifies that expression is evaluated
after each execution of the command list. If the expression evaluates
to false, the commands are executed and the
DO
group begins another cycle; if it evaluates to true, execution of theDO
group ends. - command
- A valid z/OS Debugger command.
- reference
- A valid z/OS Debugger PL/I reference.
- expression
- A valid z/OS Debugger PL/I expression.
BY
- Specifies that expression is evaluated
at entry to the
DO
specification and saved. This saved value specifies the increment to be added to the control variable after each execution of theDO
group.If
BY
expression is omitted from aDO
specification and ifTO
expression is specified, expression defaults to the value of 1.If
BY
0
is specified, the execution of theDO
group continues indefinitely unless it is halted by aWHILE
orUNTIL
option, or control is transferred to a point outside theDO
group.The
BY
option allows you to vary the control variable in fixed positive or negative increments. TO
- Specifies that expression is evaluated
at entry of the
DO
specification and saved. This saved value specifies the terminating value of the control variable.If
TO
expression is omitted from aDO
specification and ifBY
expression is specified, repetitive execution continues until it is terminated by theWHILE
orUNTIL
option, or until some statement transfers control to a point outside theDO
group.The
TO
option allows you to vary the control variable in fixed positive or negative increments. REPEAT
- Specifies that expression is evaluated
and assigned to the control variable after each execution of the
DO
group. Repetitive execution continues until it is terminated by theWHILE
orUNTIL
option, or until some statement transfers control to a point outside theDO
group.The
REPEAT
option allows you to vary the control variable nonlinearly. This option can also be used for nonarithmetic control variables, such as pointers. WHILE
- Specifies that expression is evaluated
before each execution of the command list. If the expression evaluates
to true, the commands are executed and the
DO
group begins another cycle; if it evaluates to false, execution of theDO
group ends. UNTIL
- Specifies that expression is evaluated
after each execution of the command list. If the expression evaluates
to false, the commands are executed and the
DO
group begins another cycle; if it evaluates to true, execution of theDO
group ends. - command
- A valid z/OS Debugger command.
Usage note
You
cannot use the DO
command while you replay recorded
statements by using the PLAYBACK
commands by using
the PLAYBACK
command.
Examples
- At statement 25, initialize variable
a
and display the values of variablesx
,y
, andz
.AT 25 DO; %BLOCK:>a = 0; LIST (x, y, z); END;
- Execute the
DO
group untilctr
is greater than 4 or less than 0.DO UNTIL (ctr > 4) WHILE (ctr >= 0); END;
- Execute the
DO
group withi
having the values 1, 2, 4, 8, 16, 32, 64, 128, and 256.DO i = 1 REPEAT 2*i UNTIL (i = 256); END;
- Repeat execution of the
DO
group withj
having values 1 through 20, but only ifk
has the value 1.DO j = 1 TO 20 BY 1 WHILE (k = 1); END;