End Do Group (ENDDO)

The End Do (ENDDO) command is used with the DO command to identify a group of commands that are processed together as a group. The ENDDO command specifies the end of the Do group that is started with an associated DO command. The ENDDO command must be specified after the last command in the Do group.

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

Restrictions: This command is valid only within a CL program or ILE CL procedure.

There are no parameters for this command.

Parameters

None

Examples

Example 1: Processing a Group of Commands Unconditionally

DO
 :   (group of CL commands)
ENDDO

The commands between the DO and ENDDO commands are processed once, as a group of commands.

Example 2: Processing a Group of Commands Conditionally

IF &SWITCH DO
 :   (group of CL commands)
ENDDO

The commands between the DO and ENDDO commands are processed if the value in the logical variable &SWITCH is '1'. If &SWITCH is not '1', then control passes immediately to the next command following the ENDDO command.

Error messages

None