CL Command Reference - ENDPGM

CL Command List > ENDPGM Reference

Description:

The End Program (ENDPGM) command specifies the end of a CL procedure. When the command is processed, it performs the same function as a RETURN command. That is, control is returned to the command immediately following the CALL command in the calling program.

The ENDPGM command is not required at the end of a CL procedure. If the last statement in a CL procedure source file is reached and no ENDPGM command is found, an ENDPGM command is assumed by the compiler.

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


Examples:

PGM
:
ENDPGM

This CL procedure is identified by a PGM command that contains no parameters and is ended by the ENDPGM command.