Command reference / CL
DOWHILE
Do While
Evaluates a logical expression, then processes a group of CL commands while the expression is true. When it evaluates to false, control passes to the command after the matching ENDDO.
Allowed environments: *BPGM, *IPGM.
Use within a CL program.
Positional parameters: 1.
Restrictions
- Valid only within a CL program or ILE CL procedure.
- Up to 25 levels of nested DO, DOWHILE, DOUNTIL, and DOFOR commands are allowed.
Parameters
COND
Condition
Specifies the logical expression evaluated to decide whether the loop is processed again. Variables, constants, and the %SUBSTRING, %SWITCH, and %BINARY built-in functions can be used in it.
Examples
DOWHILE COND(&LGL)
With &LGL set to false, the group is never processed and control passes to the command after ENDDO.
DOWHILE &LGL
With &LGL set to true, the group is processed until &LGL is set to false. The loop continues until a LEAVE command or a GOTO to a label outside the group is run.
Generated from os/cl/catalog/DOWHILE.json and os/cl/help/DOWHILE.json.