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

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.

Type
*CHAR
Required
Yes
Length
50
Case
Uppercase

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.

IBM command documentation

Generated from os/cl/catalog/DOWHILE.json and os/cl/help/DOWHILE.json.