End Select (ENDSELECT)

The End Select (ENDSELECT) command is used with the SELECT command to select a group of commands that are to be processed. The ENDSELECT command specifies the end of the select group that is started with an associated SELECT command. The ENDSELECT command must be specified after the last WHEN or or OTHERWISE command in the select group.

When select groups are nested, each group must have its own ENDSELECT command at its end. Every ENDSELECT command must be associated with a SELECT command; if too many ENDSELECT commands occur in the CL program or ILE CL procedure source, a message is issued and the program is not created.

Restrictions:

There are no parameters for this command.

Parameters

None

Examples

DCL   VAR(&NAME)  TYPE(*CHAR)  LEN(10)
 :
SELECT
  WHEN   COND(&NAME *EQ *CMD)  THEN(DO)
    :   (group of CL commands)
  ENDDO
  :   (other WHEN or OTHERWISE commands)
ENDSELECT

The ENDSELECT command ends an active SELECT command group.

Error messages

None