To save time and prevent errors, you can prepare sets of job control statements that you can execute again and again. You can do this through the use of two types of procedures: in-stream procedures and cataloged procedures.
In-Stream Procedures
An in-stream procedure is a named set of job control statements in a job that can be re-executed within that job, simply by invoking the name of the procedure. This enables you to execute the set of control statements more than one time in the same job without having to repeat the statements.
The below table shows a job that contains an in-stream procedure. Its name is PTEST, and it ends with a PEND statement.
In-Stream Procedure
| Job Control Statement |
Explanation |
| //JOB1 JOB CT1492,'JIM MOSER' |
Starts job |
| //PTEST PROC |
Starts in-stream procedure |
| //PSTA EXEC PGM=CALC |
Identifies first step in procedure |
//DDA DD DSNAME=D.E.F,DISP=OLD //DDB DD DSNAME=DATA1,DISP=(MOD,PASS) //DDOUT DD SYSOUT=*
|
Request 3 data sets for first procedure step |
| //PSTB EXEC PGM=PRNT |
Identifies second step in procedure |
//DDC DD DSNAME=*.PSTA.DDB,DISP=OLD //DDREP DD SYSOUT=A
|
Request 2 data sets for second procedure step |
| // PEND |
Ends in-stream procedure |
| //STEP1 EXEC PROC=PTEST |
First step in JOB1, executes procedure |
//PSTA.IN DD * . (data) .
/*
|
Adds in-stream data to procedure step PSTA
|
Note:
The maximum number of in-stream procedures you can code in any job is 15. Cataloged Procedures
A cataloged procedure, like an in-stream procedure, is a named set of job control statements. However, these control statements are placed, or cataloged, in a partitioned data set (PDS) or partitioned data set extended (PDSE) known as a procedure library. This enables a cataloged procedure to be invoked by any job.
Cataloged procedures can be placed in the system procedure library SYS1.PROCLIB or in any user-specified procedure library (for example JCLLIB).
The below table shows an example of a cataloged procedure named MYPROC. and other table shows an example of a job that executes MYPROC.
Cataloged Procedure: Member MYPROC in SYS1.PROCLIB
| Job Control Statement |
Explanation |
| //MYPROC PROC |
Starts cataloged procedure |
| //MY1 EXEC PGM=WORK1 |
Identifies first step in procedure |
|
//MYDDA DD SYSOUT=A //MYDDB DD SYSOUT=*
|
Request 2 data sets for first procedure step |
| //MY2 EXEC PGM=TEXT5 |
Identifies second step in procedure |
|
//MYDDC DD DSNAME=F.G.H,DISP=OLD //MYDDE DD SYSOUT=*
|
Request 2 data sets for second procedure step |
| // PEND |
Indicate end of procedure. |
Job that Executes Cataloged Procedure MYPROC
| Job Control Statement |
Explanation |
| //JOB2 JOB ,'JACKIE DIGIAN' |
Starts job |
| //STEPA EXEC PROC=MYPROC |
First step in JOB2, executes procedure |
| //MY2.MYDDC DD DISP=(OLD,DELETE) |
Modifies DD statement MYDDC in procedure step MY2 |
Note:
Before cataloging any procedure, test it as an instream procedure first.
Source: www.ibm.com
|