Pages

JCL PROC


A procedure is a reusable set of JCL statements defined once and called multiple times within a job or across various jobs.

 

Calling PROC

/[step-name] EXEC PROC=proc-name[,parameters [comments]]

PROC Definition

//proc-name  PROC

 

Instream procedure

Defined inside a JCL program

executed within JCL program

no PROCLIB is required to locate the procedure

PEND statement required to terminate the PROC

max.15 instream proc can be defined

The instream procedure won't validate syntax errors until an EXEC statement calls it.


Cataloged procedure

It is coded in a common area where multiple JOBS can access it

defined outside of the JCL

A maximum of 255 procedures can be coded in a single JCL.

Defined outside of JCL program in a PDS member with PROC operand and no PEND statement

can be executed in any JCL program across application

unlimited proc can be defined

eg: compiling process, sorting data

any number of catalog procs can be defined

IMPORTANT POINTS:

similar to JOBLIB and STEPLIB, PROCLIB must be coded within a JCL program immediate after the JOB. Only one PROCLIB is coded for one job



JCL statements not allowed in PROC

JOB, delimiter (/*), null statements

JOBLIB, JOBCAT DD statements

DD* or data statements

any JES2 or JES3 controls

 

CREATE A PS FILE WITH INSTREAM PROC

CREATE A PS FILE WITH CATELOGED PROC

//MTHUSERC JOB (MTH1234),'PAWAN Y',

//             CLASS=B,NOTIFY=&SYSUID

//* Instream PROC definition

//CREATEPS PROC

//STEPA    EXEC PGM=IEFBR14

//SYSPRINT DD SYSOUT=*

//SYSOUT   DD SYSOUT=*

//SYSDUMP  DD SYSOUT=*

//DD1      DD DSN=&PSNAME,

//            DISP=(NEW,CATLG,DELETE),

//            SPACE=(TRK,(3,2),RLSE),

//            UNIT=SYSDA,VOLUME=SER=DEVHD4,

//            DCB=(DSORG=PS,RECFM=FB, 

                   LRECL=80,BLKSIZE=800)

//PEND

 

//* Instream PROC calling

//STEP10   EXEC CREATEPS,

               PSNAME=MATEPK.IEFBR14.PSFILE1

//STEP20   EXEC CREATEPS,

               PSNAME=MATEPK.IEFBR14.PSFILE2

//CREATEPS PROC

//STEPA    EXEC PGM=IEFBR14

//SYSPRINT DD SYSOUT=*

//SYSOUT   DD SYSOUT=*

//SYSDUMP  DD SYSOUT=*

//DD1      DD DSN=&PSNAME,

//            DISP=(NEW,CATLG,DELETE),

//            SPACE=(TRK,(3,2),RLSE),

//            UNIT=SYSDA,VOLUME=SER=DEVHD4,

//            DCB=(DSORG=PS,RECFM=FB, 

                   LRECL=80,BLKSIZE=800)

 

JCL calling cataloged procedure

//MATEPKPS JOB (MTH1234),'PAWAN Y',

//             CLASS=A,MSGCLASS=A,

               MSGLEVEL=(1,1),

//             NOTIFY=&SYSUID

//PLIB    JCLLIB ORDER=(MATEPK.JCL.LIB)

//*

//STEP10   EXEC CREATEPS,   

                PSNAME=MATEPK.TEST.PSFILE1

//STEP20   EXEC CREATEPS,

                PSNAME=MATEPK.TEST.PSFILE2

No comments:

Post a Comment