Where allowed to run:
|
Parameters Examples Error messages |
The Iterate (ITERATE) command interrupts the processing of commands in the associated DOWHILE, DOUNTIL, or DOFOR loop and passes control to the associated ENDDO. The conditional part of the DOWHILE, DOUNTIL, or DOFOR will be evaluated and processing resume accordingly.
By specifying the optional command label, processing will skip to the ENDDO of the associated Do command group.
Restrictions:
Top |
Keyword | Description | Choices | Notes |
---|---|---|---|
CMDLBL | Command label | Simple name, *CURRENT | Optional, Positional 1 |
Top |
The label must be within the same program as the ITERATE command and be a label on an active DOWHILE, DOUNTIL, or DOFOR group. A CL variable name cannot be used to specify the label name.
Top |
DCL VAR(&INT) TYPE(*INT) LEN(2) DCL VAR(&NAME) TYPE(*CHAR) LEN(10) : DOUNTIL COND(&INT *GT 100) : (group of CL commands) IF COND(&NAME *EQ *NONE) THEN(ITERATE) CHGVAR VAR(&INT) VALUE(&INT + 1) : (group of CL commands) ENDDO /* ITERATE passes control to here */
Whenever the IF command evaluates the value of &NAME to be equal to *NONE the ITERATE is processed. Control will pass to the ENDDO command, the condition specified on the associated DOUNTIL is evaluated. If the value of &INT is 100 or less, the loop will be processed again. If the value of &INT is 101 or greater, control passes to the associated ENDDO.
Top |
None
Top |