MAINFRAMES
JCL – Job Control Language
NAGARAJU DOMALA
JCL – JOB CONTROL LANGUAGE
Session 5
Nagaraju Domala
SESSION OBJECTIVES
At the end of this session participants would have understood
How to code JCL Procedures
Types of JCL Procedures
Usage of JCL Procedures
How to code JCL Procedures Overrides
Nagaraju Domala
Points to Cover
Categories of procedures and definitions
In stream procedures
Catalogued procedures
Syntax rules in procedures
Regular overrides of DD and EXEC statements
Symbolic overrides of DD and EXEC statements
Nagaraju Domala
Categories of procedures and definitions
PROCEDURES:
It is a prepacked JCL.
JCL needed by many different users
A JCL executed on a repetitive basis
JCL often repeated within the execution of a single job
A procedure is invoked by specifying its name in an EXEC statement.
//STEP1 EXEC INV3000 ( OR )
//STEP1 EXEC PROC=INV3000
A name is always required on a PROC statement.
The word PROC is optional.
A procedure invoking EXEC statement causes previously stored JCL
statements to be read into the job stream.
A procedure can not invoke another procedure.
Nagaraju Domala
Categories of procedures and definitions
TYPE OF PROCEDURES:
In-stream procedures
Coded in the executing job
max of 15 per JOB
Catalogued Procedure
Member of a PDS (procedure library)
max 255 steps
Nagaraju Domala
Syntax rules in procedures
RESTRICTIONS:
THE NUMBER OF STEPS IN A PROC CANNOT EXCEED 255
THE FOLLOWING ARE NOT PERMITTED TO RESIDE IN A PROC
A JOB STMT
AN EXEC STMT INVOKING A PROC
A JOBLIB DD STMT
A DD * STMT
A DD DATA STMT
A /* (DELIMITER) STMT
A // (NULL) STMT
INPUT STREAM (SYSIN) DATA
A PEND STMT (FOR CATALOGED PROCEDURES ONLY)
Nagaraju Domala
In stream procedures
One of the main purpose of In stream procedures is to use them as testing
tools
In stream procedures can also be convenient when a set of JCL must be
executed many times in only one job
It must begin with a PROC statement and end with a PEND statement
It should be coded before the first EXEC statement invoking the in-stream
procedure
000100 //UELA009A JOB (AMLAN),NOTIFY=UELA009A,CLASS=A
000210 //PROC1 PROC
000220 //STEP2 EXEC PGM=IEFBR14
000300 //DD1 DD DSN=&&TEMP,SPACE=(TRK,(1,1)),
000400 // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80),
000500 // DISP=(NEW,KEEP),UNIT=SYSDA , VOL=SER=INUSR3
000600 // PEND
000610 //STEP1 EXEC PROC1
000700 /*
Nagaraju Domala
Catalogued procedures
It must be a member of PDS
PEND statement is not permitted
It can have a maximum of 255 steps
The name of the library (PDS) should be specified if cataloged library is
not in the system defined library (SYS1.PROCLIB) using JES
JOBPARM statement or JCLLIB statement
It must begin with a PROC statement and must not contain a PEND
statement
It must be cataloged in order to access it that is it must be a member of
a PDS.
Nagaraju Domala
Catalogued procedures(Contd..)
Ex: Cataloged procedure:
000200 //MYPROC PROC
000210 //STEP2 EXEC PGM=IEFBR14
000220 //DD1 DD DSN=&&TEMP,SPACE=(TRK,(1,1)),
000230 // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80),
000240 // DISP=(NEW,KEEP),UNIT=SYSDA
000250// VOL=SER=INUSR3
Ex: Cataloged procedure called through a JCL :
000100 //UELA009A JOB (AMLAN),NOTIFY=UELA009A,CLASS=A
000110 //LIB1 JCLLIB ORDER=(UELA009A.JCL.SOURCE)
000260 //STEP1 EXEC MYPROC
Nagaraju Domala
Modifying the Procedure
The biggest benefit of procedures is that minor adjustments can be made to
the JCL they contain to meet varying processing needs.
Modify parameters coded on EXEC statements within the procedure (Add,
Replace or nullify any EXEC statement parameter except PGM)
Modify parameters coded on DD statements within the procedure (Add,
Replace or nullify DD statement parameter)
Add entirely new DD statements to the procedure
Nagaraju Domala
Modifying the Procedure ( Contd..)
EXEC:
All overriding exec parameters must be coded in the
exec statement that invokes the procedure.
"parameter.stepname=value“
Example:
//S1 EXEC PGM=SAMPLE,PARM=(U,V,W,X),REGION=900k
//IN1 DD DSN=ELTP.FILE1, DISP=OLD
OVERRIDING PARM VALUE
//A1 EXEC ELTP,PARM.s1=(U,V,W,y),REGION=900k
Nagaraju Domala
Modifying the Procedure ( Contd..)
DD:to override any parameters in the dd statement, a
independent DD statement must be coded as given below:
//stepname.ddname dd overriding parameters
NOTE: A dd statement cannot be removed by means of
overriding
Ex:
//IN1 DD DSN=ELTP.FILE1, DISP=OLD
OVERRIDING DSN NAME
//S1.IN1 DD DSN=ELTP.FILE3, DISP=OLD
Nagaraju Domala
Modifying the Procedure ( Contd..)
• PROCEDURE SSP
//S1 EXEC PGM=P1,PARM=&PEL
EXAMPLE 1
//A EXEC SSP,PEL=FLD
SUBSTITUTION RESULTS IN :
//S1 EXEC PGM=P1,PARM=FLD
EXAMPLE 2
//B EXEC SSP,PEL=‘FLD,TIME=(5,10)’
SUBSTITUTION RESULTS IN :
//S1 EXEC PGM=P1,PARM=FLD,TIME=(5,10)
Nagaraju Domala
Modifying the Procedure ( Contd..)
THE PROC STATEMENT :
• The purpose of the proc stmt is to contains symbolic override defaults
• It is an optional stmt but highly recommended if the proc contains symbolic
parameters
• If coded it must be the first stmt in a proc
• When a proc is executed, the system will substitute symbolic parameters
using the symbolic overrides coded in the exec stmt
• For those symbolic overrides not found in the exec stmt, the default symbolic
overrides in the proc stmt will be used
Nagaraju Domala
Modifying the Procedure ( Contd..)
Sample procedure:
//INV3000 PROC
//INV3010 EXEC PGM=INV3010
//SYSOUT DD SYSOUT=&CLASS
//INVMAST DD DSN=&DEPT..INVENTRY.MASTER, DISP=SHR
//INVSEL DD DSN=&&INVSEL,DISP=NEW,SPACE=(CYL,(&SPACE))
//SELCTL DD DUMMY
//INV3020 EXEC PGM=INV3020
//SYSOUT DD SYSOUT=&CLASS
//INVMAST DD DSNAME=&&INVSEL,DISP=(OLD,DELETE)
//INVSLST DD SYSOUT=&CLASS
// PEND
Invoking EXEC statement
//STEPA1 EXEC INV3000,CLASS=M,DEPT=MMA2,SPACE='5,1'
Nagaraju Domala
Modifying the Procedure ( Contd..)
EFFECTIVE JCL
//INV3010 EXEC PGM=INV3010
//SYSOUT DD SYSOUT=M
//INVMAST DD DSNAME=MMA2.INVENTRY.MASTER,DISP=SHR
//INVSEL DD DSNAME=&&INVSEL,DISP=(NEW,PASS),
// UNIT=SYSDA,SPACE=(CYL,(5,1))
//SELCTL DD DUMMY
//INV3020 EXEC PGM=INV3020
//SYSOUT DD SYSOUT=M
//INVMAST DD DSNAME=&&INVSEL,DISP=(OLD,DELETE)
//INVSLST DD SYSOUT=M
Nagaraju Domala