Navbar menu

What is the use of PGM and ENDPGM in CL program

PGM and ENDPGM in CL program:
 
In this blog post, we will see what is the use of PGM and ENDPGM commands in a CL program. First, we will start with the PGM command.
 
PGM Command:
  • In general, the PGM command is written to identify the beginning of a CL program.
  • Example:
PGM Command
  • It is an optional command but becomes mandatory only when we are receiving parameters from external programs.
  • It is mandatory to specify the parameter in the PGM command if the program accepts input parameters.
  • Example:
    •  In the below program, we are accepting 2 parameters from the calling program. So it is a must to specify in the PGM command.
Parameters in PGM command
    • Here &name and &age are parameters from the calling program.
ENDPGM Command
  • ENDPGM is written to identify the end of a CL program.
  • This is also an optional command. 
  • Example:
ENDPGM command

No comments:

Post a Comment