*---------*---------------*-----------------*----------------*---------------* | CODE | FACTOR 1 | FACTOR 2 | RESULT | INDICATORS | | | | | FIELD | | *---------*---------------*-----------------*----------------*---------------* | ITER | | | | | *---------*---------------*-----------------*----------------*---------------*
The ITER operation transfers control from within a do group to the ENDDO statement of the do group. It can be used in DO, DOUxx, and DOWxx loops to transfer control immediately to a loop ENDDO statement. It causes the next iteration of the loop to be executed immediately. ITER affects the innermost loop.
If conditioning indicators are present on the ENDDO statement to which control is passed, and the condition is not satisfied, processing continues with the statement following the ENDDO operation.
The LEAVE (Leave a Do Group) operation is similar to the ITER operation; however, LEAVE transfers control to the statement following the ENDDO operation.
*...1....+....2....+....3....+....4....+....5....+....6....+....7... CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments++++++ C* C* The following example uses a DOU loop containing a DOW loop. C* The IF statement checks indicator 01. If indicator 01 is ON, C* the LEAVE operation is executed, transferring control out of C* the innermost DOW loop to the Z-ADD instruction. If indicator C* 01 is not ON, subroutine PROC1 is processed. Then indicator C* 12 is checked. If it is OFF, ITER transfers control to the C* innermost ENDDO and the condition on the DOW is evaluated C* again. If indicator 12 is ON, subroutine PROC2 is processed. C : C FLDA DOUEQFLDB Outer loop C : C NUM DOWLT10 Inner loop C *IN01 IFEQ *ON C LEAVE C ENDIF C EXSR PROC1 C *IN12 IFEQ *OFF C ITER ITER C ENDIF C EXSR PROC2 C ENDDO Inner ENDDO C Z-ADD20 RSLT 20 Z-ADD C : C ENDDO Outer ENDDO C : C*
*...1....+....2....+....3....+....4....+....5....+....6....+....7... CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments++++++ C* C* The following example uses a DOU loop containing a DOW loop. C* The IF statement checks indicator 1. If indicator 1 is ON, the C* MOVE operation is executed, followed by the LEAVE operation, C* transferring control from the innermost DOW loop to the Z-ADD C* instruction. If indicator 1 is not ON, ITER transfers control C* control to the innermost ENDDO and the condition on the DOW is C* evaluated again. C : C FLDA DOUEQFLDB C : C NUM DOWLT10 C *IN01 IFEQ *ON C MOVE 'UPDATE' FIELD 20 C LEAVE C ELSE C ITER C ENDIF C ENDDO Inner ENDDO C Z-ADD20 RSLT 20 C : C ENDDO C :
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.