Command reference / CL

OTHERWISE

Otherwise

Names the command, or the IF or DO group of commands, to run when none of the WHEN conditions in the enclosing SELECT group are true. After it finishes, control passes to the command after the matching ENDSELECT. A DO-type command in this position makes its whole group count as the one command.

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

Restrictions

Parameters

CMD Command

Names the command, or the IF or DO group, to run when no WHEN condition is true. A DO, DOWHILE, DOUNTIL, or DOFOR command here makes its whole group count as the command. If left empty, control passes to the command after the ENDSELECT.

Type
*CMDSTR
Required
No
Case
Uppercase

Examples

OTHERWISE CMD(CHGVAR &NAME *PGM)

In a SELECT group whose WHEN conditions test &NAME for *CMD and *PGM, CHGVAR runs only when &NAME matches neither value.

IBM command documentation

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