EXEC PGM Parameter


Note! PGM parameter can be coded only at the step level.

The PGM parameter is used to specify the program which needs to be run by the system. EXEC PGM is only used to provide the application program name.

The program name specified with PGM should be a clean compiled program ready to execute. The program can be from a member of a system library, private library (PDS or PDSE), or temporary dataset. private library (PDS or PDSE) or temporary dataset.

Syntax -

PGM={program-name}
    {*.stepname.dd-name}
    {*.stepname.proc-stepname.dd-name}
program-name Specifies the application program name.
*.stepname.dd-name Refers to a DD name that defines the program.
It refers to the program from the library created by the previous step (*.stepname.ddname).
*.stepname.proc-stepname.dd-name Refers to a DD name that defines the program.
It refers to the program from the library created by the PROC executed in the previous step (*.stepname.procstepname.ddname).

Examples -


Scenario1 - Executing a program.

//MTHEXMP1 JOB (META007),'PAWAN Y', MSGLEVEL=(1,1)
//STEP1   EXEC PGM=SAMPLE
//STEPLIB  DD  DSN=MTH.MY.LOADLIB,DISP=SHR

The system searches the private library MTH.MY.LOADLIB for the member named PROG1. The system reads the member into storage and executes it.

Scenario2 -

//MTHEXMP2 JOB (META007),'PAWAN Y',CLASS=A
//...
//...
//LINKEDIT EXEC PGM=IEWL
//SYSLMOD  DD   DSN=&&MTHDS(PROG1),
//	            UNIT=3390,DISP=(MOD,PASS),
//              SPACE=(100,(50,20))
//EXECPROG EXEC PGM=*.LINKEDIT.SYSLMOD

The EXECPROG EXEC statement contains a backward reference to DD statement SYSLMOD in the LINKEDIT step. Program PROG1 is a member of the temporary PDS &&MTHDS. Step EXECPROG executes program PROG1.