Command reference / CL

LEAVE

Leave

Ends processing of the commands in the associated DOWHILE, DOUNTIL, or DOFOR loop and passes control to the first command following the associated ENDDO.

Allowed environments: *BPGM, *IPGM. Use within a CL program. Positional parameters: 1.

Restrictions

Parameters

CMDLBL Command label

The label must be within the same program as the LEAVE command and must label an active DOWHILE, DOUNTIL, or DOFOR group. A CL variable name cannot be used for the label.

Type
*SNAME
Required
No
Default
*CURRENT
Length
10
Case
Uppercase

Suggested / special values: *CURRENT

*CURRENT
Leaves the innermost loop surrounding this LEAVE command.

Examples

IF COND(&NAME *EQ *NONE) THEN(LEAVE)

Interrupts the active DOFOR group; processing continues with the command following the ENDDO.

IF COND(&NAME *EQ *NONE) THEN(LEAVE CMDLBL(LOOP1))

Interrupts both the active DOUNTIL and DOFOR groups; processing continues after the ENDDO matching the DOFOR.

IBM command documentation

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