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
- Only valid inside a CL program or ILE CL procedure.
- Only valid inside a SELECT-ENDSELECT command group.
- A SELECT group can contain only one OTHERWISE.
- All WHEN commands in the SELECT group must come before the OTHERWISE.
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.
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.
Generated from os/cl/catalog/OTHERWISE.json and os/cl/help/OTHERWISE.json.