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, 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 must to specify in 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
That's it. From this post, you may come to know the basics of PGM and ENDPGM command.

In the next post, Declaring variables in CL will be explained.

If you like my work, please leave some feedback and suggestion. Or if you want anything to be discussed particularly. kindly let me know.

Thanks, everyone...

No comments:

Post a comment