![]() |
JCL Procedures and PROC's Using JCL Procedures |
| When technology complements business | Copyright © 1987-2012 SimoTime Enterprises All Rights Reserved |
| The SimoTime Home Page |
JCL defines how a job is executed on the mainframe. A job may perform many steps or execute many programs in order to produce the requested information or output. If a segment of JCL is used repeatedly it may be coded once as a PROC (or JCL Procedure) and then used by many different steps within the job. There are two approaches to defining and using PROC's.
The PROC may be defined within the job (this is referred to as an In-stream PROC). If the segment of JCL code being defined as a PROC is unique to a single job then this approach is a very good alternative. An instream PROC should be defined first in the JCL before the EXEC statement that will reference the PROC. An instream PROC must start with a PROC statement and be terminated with a PEND statement. The PEND is not required if the PROC is stored as a separate member in a library.
The PROC may be defined as a separate member and stored in a separate library (i.e. PDS). If the segment of JCL code being defined as a PROC will be used by different jobs then this approach should be used.
At execution time when an EXEC statement references a PROC the PROC source code will be copied into the job and executed as if it is part of the JCL.
If you store a PROC in a library (i.e. Proc Library or ProcLib) the ProcLib must be known to the system. Most systems will search a list of pre-defined ProcLibs to find a PROC. If a PROC is stored in a library that is not in the pre-defined then the PROC will not be found. To specify additional PROC libraries to be searched use the JCLLIB statement. This is explained in a later section of this document.
For additional flexibility substitution parameters may be used to pass different values to a PROC. This is explained in a later section of this document.
This example will demonstrate the use of JCL PROCs to create three Partitioned Data Sets (PDS's). The first example will use an instream PROC and the second example will use a JCL member with a separate PROC member. The use of a substitution parameter will also be explained.
The PROC will contain the source code to create (or delete) a PDS using the DSN specified in the substitution parameter ($DSNAME) provided by the JCL member. The JCL member will contain the code to set a substitution parameter with a Data Set Name (or PDS name for this example).
The following JCL member (PDSCRTJ4.JCL) has an instream PROC. Notice the instream PROC is defined before the first step.
//PDSCRTJ4 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1 //* ******************************************************************* //* This JCL Member is provided by SimoTime Enterprises * //* (C) Copyright 1987-2012 All Rights Reserved * //* Web Site URL: http://www.simotime.com * //* e-mail: helpdesk@simotime.com * //* ******************************************************************* //* //* Subject: Define a PDS using the IEFBR14 with a DD Statement //* Author: SimoTime Enterprises //* Date: January 1,1998 //* //* The JCL member executes the instream PROC called PDSCRTP3 and //* passes a fully qualified data set name (DSN) via the symbolic name //* called DSNAME and referenced in the PROC as &DSNAME. //* //********************************************************************* //* The instream PROC for creating a PDS. The Data Set Name (&DSNAME) //* is provided by the job step that EXECs the PROC. //* //PDSCRTP4 PROC //PDSCRTS1 EXEC PGM=IEFBR14 //TEMPLIB1 DD DISP=(NEW,CATLG),DSN=&DSNAME, // STORCLAS=MFI, // SPACE=(TRK,(45,15,50)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO) // PEND //* //* ******************************************************************* //* Step 1 of 3 Create a PDS using SET and EXEC //* // SET DSNAME=SIMOTIME.DEMO.TEMP01 //STEPJ41 EXEC PDSCRTP4 //* //* ******************************************************************* //* Step 2 of 3 Create a PDS using EXEC and DSNAME substitution //* //STEPJ42 EXEC PDSCRTP4,DSNAME=SIMOTIME.DEMO.TEMP02 //* //* ******************************************************************* //* Step 3 of 3 Create a PDS using EXEC and DSNAME substitution //* //STEPJ43 EXEC PDSCRTP4,DSNAME=SIMOTIME.DEMO.TEMP03 //*
In the preceding example the PROC starts with the PROC statement and ends with the PEND statement.
//PDSCRTP3 PROC . . . . . . // PEND
As stated earlier the PEND statement is required for an instream PROC but is optional for a separately defined PROC. Step 1 uses a SET statement to set a value for the DSNAME substitution parameter. Steps 2 and 3 define the DSNAME substitution parameter as part of the EXEC statement. The PROC accesses the substitution parameter by using the ampersand as a prefix or &DSNAME. In this example by using the &DSNAME substitution parameter the PROC may be used to create multiple PDS's with different names.
This example uses a single JCL member (PDSCRTJ3.JCL) and a separate PROC member (PDSCRTP3.JCL) to create three PDS's . Notice the use of the JCLLIB statement to tell the system where to find the PROC.
//PDSCRTJ3 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1 //* ******************************************************************* //* This JCL Member is provided by SimoTime Enterprises * //* (C) Copyright 1987-2012 All Rights Reserved * //* Web Site URL: http://www.simotime.com * //* e-mail: helpdesk@simotime.com * //* ******************************************************************* //* //* Subject: Define a PDS using the IEFBR14 with a DD Statement //* Author: SimoTime Enterprises //* Date: January 1,1998 //* //* The JCLLIB tells the mainframe where to look for PROCs. //* //* The JCL member executes the PROC called PDSCRTP3 and passes a //* fully qualified data set name (DSN) via the symbolic name //* called DSNAME and referenced in the PROC as &DSNAME. //* //********************************************************************* //* //PROCLIB JCLLIB ORDER=SIMOTIME.PDS.PROCLIB //* //* ******************************************************************* //* Step 1 of 3 Create a PDS using SET and EXEC //* // SET DSNAME=SIMOTIME.DEMO.TEMP01 //S1 EXEC PDSCRTP3 //* //* ******************************************************************* //* Step 2 of 3 Create a PDS using EXEC and DSNAME substitution //* //STEP2 EXEC PDSCRTP3,DSNAME=SIMOTIME.DEMO.TEMP02 //* //* ******************************************************************* //* Step 3 of 3 Create a PDS using EXEC and DSNAME substitution //* //STEPJ003 EXEC PDSCRTP3,DSNAME=SIMOTIME.DEMO.TEMP03 //*
The following (PDSCRTP3.PRC) is the PROC that will be used to create a PDS. Notice the PROC and PEND statements are not required.
//* ******************************************************************* //* This JCL Procedure is provided by SimoTime Enterprises * //* (C) Copyright 1987-2012 All Rights Reserved * //* Web Site URL: http://www.simotime.com * //* e-mail: helpdesk@simotime.com * //* ******************************************************************* //* //* Subject: Define a PDS using the IEFBR14 with a DD Statement //* Author: SimoTime Enterprises //* Date: January 1,1998 //* //* This PROC needs the &DSNAME defined by the calling JCL member... //* // SET DSNAME=AAAA.BBBB.CCCC //* // EXEC PDSCRTP3 //* //* Also, the JCLLIB statement may be required and placed after //* the JOB card. //* //PROCLIB JCLLIB ORDER=SIMOTIME.DEMO.PROCLIB1 //* //* Technically speaking, IEFBR14 is not a utility program because it //* does nothing. The name is derived from the fact that it contains //* two assembler language instruction. The first instruction clears //* register 15 (which sets the return code to zero) and the second //* instruction is a BR 14 which performs an immediate return to the //* operating system. //* //* IEFBR14's only purpose is to help meet the requirements that a //* job must have at least one EXEC statement. The real purpose is to //* allow the disposition of the DD statement to occur. //* //* For example, the following DISP=(NEW,CATLG) will cause the //* specified DSN (i.e. PDS) to be allocated. //* Note: a PDS may also be referred to as a library. //********************************************************************* //PDSCRTP3 PROC //PDSCRTS1 EXEC PGM=IEFBR14 //TEMPLIB1 DD DISP=(NEW,CATLG),DSN=&DSNAME, // STORCLAS=MFI, // SPACE=(TRK,(45,15,50)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO) // PEND //*
This section provides an example of how to use a PROC to delete a PDS. Please note, if the PDS is deleted all the members in the PDS are also deleted.
The following is the JCL member that will use a PROC to delete the PDS's created in the Create Multiple PDS's example.
//PDSDELJ3 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1 //* ******************************************************************* //* This program is provided by: SimoTime Enterprises * //* (C) Copyright 1987-2012 All Rights Reserved * //* Web Site URL: http://www.simotime.com * //* e-mail: helpdesk@simotime.com * //* ******************************************************************* //* //* Subject: Delete Temporary PDS's with IEFBR14 and a DD Statement //* Author: SimoTime Enterprises //* Date: January 1,1998 //* //* The JCLLIB tells the mainframe where to look for PROCs. //* //* The JCL member executes the PROC called PDSDELP3 and passes a //* fully qualified data set name (DSN) via the symbolic name //* called DSNAME and referenced in the PROC as &DSNAME. //* //********************************************************************* //* //PROCLIB JCLLIB ORDER=SIMOTIME.PDS.PROCLIB //* //* ******************************************************************* //* Step 1 of 3 Delete a PDS using SET and EXEC //* // SET DSNAME=SIMOTIME.DEMO.TEMP01 //STEPJ01 EXEC PDSDELP3 //* //* ******************************************************************* //* Step 2 of 3 Delete a PDS using EXEC and DSNAME substitution //* //STEPJ02 EXEC PDSDELP3,DSNAME=SIMOTIME.DEMO.TEMP02 //* //* ******************************************************************* //* Step 3 of 3 Delete a PDS using EXEC and DSNAME substitution //* //STEPJ03 EXEC PDSDELP3,DSNAME=SIMOTIME.DEMO.TEMP03 //*
The following is the PROC that will delete a PDS based on the value of the substitution parameter (&DSNAME) provided by the JCL member.
//* ******************************************************************* //* This JCL Procedure is provided by SimoTime Enterprises * //* (C) Copyright 1987-2012 All Rights Reserved * //* Web Site URL: http://www.simotime.com * //* e-mail: helpdesk@simotime.com * //* ******************************************************************* //* //* Subject: Delete Temporary PDS's with IEFBR14 and a DD Statement //* Author: SimoTime Enterprises //* Date: January 1,1998 //* //* This PROC needs the &DSNAME defined by the calling JCL member... //* // SET DSNAME=AAAA.BBBB.CCCC //* // EXEC PDSDELP3 //* //* Also, the JCLLIB statement may be required and placed after //* the JOB card. //* //PROCLIB JCLLIB ORDER=SIMOTIME.DEMO.PROCLIB1 //* //* Technically speaking, IEFBR14 is not a utility program because it //* does nothing. The name is derived from the fact that it contains //* two assembler language instruction. The first instruction clears //* register 15 (which sets the return code to zero) and the second //* instruction is a BR 14 which performs an immediate return to the //* operating system. //* //* IEFBR14's only purpose is to help meet the requirements that a //* job must have at least one EXEC statement. The real purpose is to //* allow the disposition of the DD statement to occur. //* //* For example, the following DISP=(OLD,DELETE) will cause the //* specified DSN (i.e. PDS) to be deleted. //* Note: a PDS is also referred to as a library. //********************************************************************* //PDSDELP3 PROC //PDSDELS1 EXEC PGM=IEFBR14 //TEMPLIB1 DD DISP=(OLD,DELETE),DSN=&DSNAME, // STORCLAS=MFI, // SPACE=(TRK,(45,15,50)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO) // PEND //*
This suite of JCL members and PROC's is provided as a possible approach to creating and deleting multiple, temporary PDS's. This document may be used as a tutorial for new programmers or as a quick reference for experienced programmers. In the world of programming there are many ways to solve a problem. This document and the links to other documents are intended to provide a choice of alternatives.
Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Enterprises. Once the fee is received by SimoTime the latest version of the software, documentation or training material will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Enterprises.
SimoTime Enterprises makes no warranty or representations about the suitability of the software, documentation or learning material for any purpose. It is provided "AS IS" without any expressed or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Enterprises shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software, documentation or training material.
This section includes links to documents with additional information that is beyond the scope and purpose of this document. The first sub-section requires an internet connection, the second sub-section references locally available documents.
Note: A SimoTime License is required for the items to be made available on a local server.
The following links will require an internet connect.
A good place to start is The SimoTime Home Page for access to white papers, program examples and product information.
This suite of programs and documentation is available for download. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.
Explore The JCL Connection in the SimoTime Library for more examples of JCL coding techniques and batch utility programs.
Explore The ASCII and EBCDIC translation tables. These tables are provided for individuals that need to better understand the bit structures and differences of the encoding formats.
Explore The File Status Return Codes to interpret the results of accessing VSAM data sets and QSAM files.
Explore The Micro Focus Web Site for more information about products and services available from Micro Focus.
The following links may be accessible without an internet connection.
Explore JCL Substitution and Procedural Overrides for an example of using overrides in JCL with PROC's.
Explore JCL Variable Substitution for an example of using variables in JCL.
Explore The File Status Return Codes to interpret the results of accessing VSAM data sets and QSAM files.
Check out The SimoTime Glossary for a list of terms and definitions used in the documents provided by SimoTime.
This document was created and is maintained by SimoTime Enterprises.
If you have any questions, suggestions, comments or feedback please call or send an e-mail to: helpdesk@simotime.com
We appreciate hearing from you.
Founded in 1987, SimoTime Enterprises is a privately owned company. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. This includes the smallest thin client using the Internet and the very large mainframe systems. There is more to making the Internet work for your company's business than just having a nice looking WEB site. It is about combining the latest technologies and existing technologies with practical business experience. It's about the business of doing business and looking good in the process. Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems.
Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com
| Return-to-Top |
| JCL Procedures and PROC's, using JCL Procedures |
| Copyright © 1987-2012 SimoTime Enterprises All Rights Reserved |
| When technology complements business |
| http://www.simotime.com |