IBM SC34-5764-01 Server User Manual


 
ITERATE
Purpose
 ITERATE
name
; 
ITERATE alters the flow within a repetitive DO loop (that is, any DO construct other than that with a simple
DO).
Execution of the group of instructions stops, and control is passed to the DO instruction just as though the
END clause had been encountered. The control variable (if any) is incremented and tested, as usual, and
the group of instructions is processed again, unless the DO instruction ends the loop.
The name is a symbol, taken as a constant. If name is not specified, ITERATE steps the innermost active
repetitive loop. If name is specified, it must be the name of the control variable of a currently active loop
(which may be the innermost), and this is the loop that is stepped. Any active loops inside the one
selected for iteration are ended (as though by a LEAVE instruction).
Example:
do i=1 to 4
if i=2 then iterate
say i
end
/* Displays the numbers: "1" "3" "4" */
Notes:
1. If specified, name must match the symbol naming the control variable in the DO clause in all respects
except case. No substitution for compound variables is carried out when the comparison is made.
2. A loop is active if it is currently being processed. If a subroutine is called (or an INTERPRET
instruction is processed) during execution of a loop, the loop becomes inactive until the subroutine has
returned or the INTERPRET instruction has completed. ITERATE cannot be used to step an inactive
loop.
3. If more than one active loop uses the same control variable, ITERATE selects the innermost loop.
ITERATE
Chapter 13. Keyword Instructions 147