ENDPGM (End Program)

ENDPGM Command syntax diagram

 

Purpose

The End Program (ENDPGM) command specifies the end of a CL program. 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 program. If the last statement in a CL program source file is reached and no ENDPGM command is found, an ENDPGM command is assumed by the compiler.

Restriction: This command is valid only within a CL program.

There are no parameters for this command.

Example for ENDPGM

PGM
  *
  *
  *
ENDPGM

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

Error messages for ENDPGM

None