Mainframes 360
The one stop destination for System Z professionals

Thursday, July 9, 2009

Modifying Statements in a Cataloged Procedure


References and external links :
- Drona Series, JCL Study Material : Mainframe Gurukul.com
- IBM MVS JCL Reference Guide

Q. Is it possible to override/modify the contents in a Cataloged Procedure?
Somtimes, we would like to change/modify some statements inside a cataloged/stored procedure. We can change

- EXEC Statement of the PROC
- DD Statement of the PROC

Modifying a parameter of the EXEC Statement
Suppose we have written the following cataloged procedure.

//MYPROC  PROC
//STEP01  EXEC  PGM=IEFBR14,TIME=10
//INFILE  DD    DSN=HERC04.DEMO.INPUT,DISP=SHR
//OUTFILE DD    DSN=HERC04.DEMO.OUTPUT,DISP=SHR

Now, suppose, we have written a main JCL/Batch Job as follows :

//MYJOB    JOB    A123,QUASAR
//LIB1     JCLLIB ORDER=(HERC04.DEMO.PROCLIB)
//PROCSTEP EXEC   PROC=MYPROC
//

Now, if we want to change the TIME parameter of MYPROC to 20, in the main JCL/Batch Job, we should write :

//MYJOB    JOB    A123,QUASAR
//LIB1     JCLLIB ORDER=(HERC04.DEMO.PROCLIB)
//PROCSTEP EXEC   PROC=MYPROC,TIME.STEP01=20
//  

We simply need to add .proc-stepname to the keyword parameter. Since, we want to modify TIME parameter of MYPROC’s STEP01, we can refer to it as TIME.STEP01.

Note : We cannot modify PGM parameter of the EXEC statement.

Adding a parameter to the EXEC Statement
On the same lines, we can also add parameters to the EXEC statement. Let me show you another example :

//MYPROC  PROC
//STEP01  EXEC  PGM=IEFBR14,TIME=10
//INFILE  DD    DSN=HERC04.DEMO.INPUT,DISP=SHR
//OUTFILE DD    DSN=HERC04.DEMO.OUTPUT,DISP=SHR

Suppose, in the main JCL that calls this procedure, we would like to add a REGION parameter on the EXEC statement.

//MYJOB    JOB    A123,QUASAR
//LIB1     JCLLIB ORDER=(HERC04.DEMO.PROCLIB)
//PROCSTEP EXEC   PROC=MYPROC,REGION.STEP01=256K
//  

Nullifying a parameter on the EXEC Statement
Suppose we want to nullify the TIME parameter of the Cataloged Procedure MYPROC.
In that case, we would have to add the following to our main JCL/Batch JOB.

//MYJOB    JOB    A123,QUASAR
//LIB1     JCLLIB ORDER=(HERC04.DEMO.PROCLIB)
//PROCSTEP EXEC   PROC=MYPROC,TIME.STEP01=
// 

Leave the keyword.procstepname field as blank. Don’t assign any value. So, if we keep TIME.STEP01 as blank, it nullifies the the value of the TIME parameter assigned to job-step STEP01 of the procedure MYPROC.

Adding or modifying DD Statements
We can
- Add/Modify/Nullify(delete) parameters on DD statements in the PROC.
- Add new DD Statements to the PROC.

Let us see how it is done with an example.

//MYPROC  PROC
//STEP01  EXEC  PGM=IEFBR14,TIME=10
//INFILE  DD    DSN=HERC04.DEMO.INPUT,DISP=SHR
//OUTFILE DD    DSN=HERC04.DEMO.OUTPUT,DISP=SHR

Suppose we would like to modify the INFILE and OUTFILE DD statements of the PROC. This can be done in the main JCL/Batch Job as follows.

//MYJOB    JOB    A123,QUASAR
//LIB1     JCLLIB ORDER=(HERC04.DEMO.PROCLIB)
//PROCSTEP EXEC   PROC=MYPROC
//STEP01.INFILE DD DSN=HERC04.INPUT.COB,DISP=SHR
//STEP01.INFILE DD DSN=HERC04.OUTPUT.COB,DISP=SHR  

Thus, we must mention the ddname as procstepname.ddname. If such a ddname does not exist in the PROC, it is simply added to the PROC.

Questions on this topic in JCL Questions Archive >>

Example of modifying the DD Statement in PROC

Suppose we have a Cataloged Procedure called MYPROC, stored in the default
System Library SYS1.PROCLIB. The JCL Listing for MYPROC is given below -

 


In the above case, MYPROC reads the contents of the Dataset HERC03.DEMO.MYLIB(INPUT), and prints it(to the default printer). Suppose, we would like to call MYPROC from another JCL. However, while calling MYPROC, we would like to override
the DSN parameter of SYSUT1 DD Statement. We want that MYPROC should print the contents of another dataset HERC03.DEMO.MYLIB(INPUT2) instead of
HERC03.DEMO.MYLIB(INPUT). To do this, we need to override DSN parameter of job-step PSTEP01 of the PROC MYPROC. The main JCL/Calling program would look like this :




To many people who are thrown to work at a mainframe computer on their first job, they feel lost. Mainframe people seem to speak a completely different language and that doesn't make life easy. What's more, the books and manuals are incredibly hard to comprehend.

"What on earth is a Mainframe?" is an absolute beginner's guide to mainframe computers. We'll introduce you to the hardware and peripherals. We'll talk about the operating system, the software installed on a mainframe. We'll also talk about the different people who work on a mainframe. In a nutshell, we'll de-mystify the mainframe.

Readers based in India, can buy the e-book for Rs. 50 only or the print book. International readers based in the US and other countries can click here to purchase the e-book.