JCL Quick Reference Descriptions and Examples |
The SimoTime Home Page |
Job Control Language (or JCL) specifies how programs are executed on the mainframe. JCL functions are the interface between the programs and the operating system. Since JCL has the ability to define data set names, parameters and system output devices the individual programs can be flexible in their use because these items are not hard coded in the programs. Without the need for re-compiling, the same program may be used to access different data sets and behave differently based on parameters specified in the JCL.
We have made a significant effort to ensure the documents and software technologies are correct and accurate. We reserve the right to make changes without notice at any time. The function delivered in this version is based upon the enhancement requests from a specific group of users. The intent is to provide changes as the need arises and in a timeframe that is dependent upon the availability of resources.
Copyright © 1987-2025
SimoTime Technologies and Services
All Rights Reserved
A JCL source member consists of a file of 80-byte, fixed-length records. The records (or JCL statements) are written using positions 1-71. Position 72 is reserved for continuation, a space character indicates no continuation and a non-space character indicates the next statement will be a continuation of the current statement.. A JCL statement starts with two slashes in positions 1 to 2. The JCL specifies a jobname and can contain one or more steps. Each step will execute a program or procedure (PROC). Comments statements may be added to the JCL using //* in positions 1 to 3. Every JCL member must begin with a '"Job Card" that specifies the job name and other information about how the job will execute. The JCL is completed by using '//' in positions 1 and 2 or when the last statement is processed.
Every JCL member (or JOB) you write will require a JOB statement (or JOB card) to identify the job. This must be the first statement in each job. Since the JOB card is a JCL statement it must start with a '//' (two slashes) in positions 1-2. The following is a sample JOB statement.
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7. //SIMOJOB1 JOB (ACCTINFO),'comment',CLASS=A,MSGCLASS=0, // MSGLEVEL=(1,1),NOTIFY=USERID
Note: The preceding JOB statement is continued across two statements. The length of the text is 72 bytes. Remember, a non-space in position 72 indicates a continuation.
The job name should be in positions 3-n (for a maximum of eight characters) followed by a space.
The job name is specified first, in this example the job name will be SIMOJOB1. The key-word JOB is specified to indicate this is the JOB statement or Job Card.
The (ACCTINFO) is accounting information and is a required. This may be an accounting cost center. The cost center information varies from site to site and may be used to do charge-backs to individual departments for usage of the system.
The 'comment' is an identifying or explanatory field. It is optional but can very useful. It ha a 20 characters maximum length.
The job class is specified by using "CLASS=" key word. This information is used to tell the system how the job is to be run. Jobs will be scheduled and will run under control of a predefined class as determined by the job initiator. The job class may determine the priority of the job and how long it will be allowed to run. If the job initiator is already running a job then the current job request may be placed in a job queue and have to wait until the initiator is free.
The MSGCLASS=x is used to specify where the job output will be directed. The output classes are predefined and vary from site to site. Two of the normal defaults are as follows.
| ||||
Two of the normal Message Class defaults |
The MSGLEVEL=(x,y) is used as follows.
| ||||||
Entries for the "X" Value of Message Level |
| ||||
Entries for the "Y" Value of Message Level |
If you want to be notified when the job has finished then use the "NOTIFY=" key word. The NOTIFY parameter must specify a valid userid.
A comment statement is defined by a "//*" in positions 1-3. The following is an example of a JCL comment statement.
//* THIS IS A JCL COMMENT STATEMENT…
Note: The text for the comment should not go past position 71. Remember, a non-space in position 72 indicates a continuation.
A job step defines the program to run and is created by using the EXEC statement. There may be one step or many steps within a job. The step name should be in positions 3-n (for a maximum of eight characters) followed by a space. The following is an example of a JCL statement that defines a step within a job and executes a program.
//STEPID01 EXEC PGM=IEFBR14
The preceding example defines the step name as STEPID01. The "EXEC" keyword identifies the statement as a job step definition. The "PGM=" keyword and parameter specifies the program to be executed. (i.e. EXECute ProGraM). The program to be executed is IEFBR14.
//STEPID02 EXEC procname
or
//STEPID02 EXEC PROC=procname
The preceding example defines the step name as STEPID02. The "EXEC" keyword identifies the statement as a job step definition. The next parameter specifies the PROC (or procedure) to be executed.
Defining the Data Sets used by a job step requires a Data Definition (or DD) statement. A simple DD statement requires a DDNAME, a Data Set Name (or DSN) and a Disposition (or DISP) keyword.
//* A Sample format for a DD statement … //ddname DD DSN=data.set.name,DISP=(status,normal-termination,abnormal-termination)
In the preceding example the ddname in the JCL DD statement corresponds to the name used in the COBOL SELECT statement. The DSN= keyword and parameter specifies the fully-qualified MVS Data Set Name. The DISP= keyword and parameter specifies the disposition as follows.
| ||||||||
Entries for the "status" value of the DISPosition |
| ||||||||
Entries for the "normal-termination" value of the DISPosition |
| ||||||||
Entries for the "abnormal-termination" value of the DISPosition |
The DD name should be in positions 3-n (for a maximum of eight characters) followed by a space. The DDNAME should correspond to the name defined in the program. For example, with COBOL the name defined by the ASSIGN clause of the SELECT statement. The following is an example of a DD statement followed by a COBOL SELECT statement with an ASSIGN clause.
//* A sample JCL DD statement for an existing data set… //QSAM0080 DD DSN=SIMOTIME.DATA.QSAM0080,DISP=SHR
The following is an example of a COBOL SELECT statement with an ASSIGN clause.
* A COBOL Select Statement… SELECT QSAM0080-FILE ASSIGN to QSAM0080
In the preceding example the COBOL program will read QSAM0080 (based on the name in the SELECT statement) and the DD statement will map QSAM0080 to the data set name specified in the DSN parameter (SIMOTIME.DATA.QSAM0080).
The following is an example and will vary at each mainframe location depending on the system hardware and software configuration. The important items on the following is the DISP and DCB information.
//SQADB512 DD DSN=SIMOTIME.DATA.SQADB512,DISP=(NEW,CATLG,DELETE), // STORCLAS=MFI, // SPACE=(TRK,5), // DCB=(RECFM=FB,LRECL=512,BLKSIZE=5120,DSORG=PS)
The following describes the DISP options.
| ||||||||
Parameters for the " DISP=" Keyword |
The following describes the DCB options.
| ||||||||||
Parameters for the " DISP=" Keyword |
It is possible to process more than one data set as a single data set by concatenating the DD statements.
//QSAM0080 DD DSN=SIMOTIME.DATA.FILE0001,DISP=SHR // DD DSN=SIMOTIME.DATA.FILE0002,DISP=SHR // DD DSN=SIMOTIME.DATA.FILE0003,DISP=SHR
The following is an example of a COBOL SELECT statement.
SELECT QSAM0080-FILE ASSIGN to QSAM0080 ORGANIZATION is SEQUENTIAL ACCESS MODE is SEQUENTIAL FILE STATUS is QSAM0080-STATUS.
In the preceding example the COBOL program will read QSAM0080 and the DD statements will map the three files (FILE0001, FILE0002 and FILE0003) as one file. The program's initial read will get the first record from FILE0001 and will not get an End-of-File condition until the last record of FILE0003 is processed.
Explore a detailed example of using data set concatenation that includes sample COBOL, JCL and Test Data.
The DD statement with a SYSOUT parameter is used to assign an output class to an output data set. The form of this parameter is:
//REPORT1 DD SYSOUT=A //REPORT2 DD SYSOUT=*
In the preceding example the REPORT1 output will be directed to SYSOUT=A which is usually the system printer. The REPORT2 output will be directed to the location specified in the MSGCLASS of the JOB statement. If MSGCLASS=0 then REPORT2 output will be directed to SYSOUT=0 which is usually placed in the JES Output Queue for a specified period of time (such as 3 days) before being purged.
if the ddname is SYSOUT (i.e. //SYSOUT ...) and SYSOUT=* then the job class will be the same as that specified in the MSGCLASS in the job statement. Since the ddname is SYSOUT the DISPLAY in a COBOL program will be directed to the location specified in the MSGCLASS of the JOB statement. If MSGCLASS=0 then REPORT2 output will be directed to SYSOUT=0 which is usually placed in the JES Output Queue for a specified period of time (such as 3 days) before being purged. The following is a sample JCL statement with SYSOUT as the DD name.
//SYSOUT DD SYSOUT=*
The following is a sample COBOL statement that uses DISPLAY.
DISPLAY 'This is a test...'
In the preceding example the text string "This is a test..." will be routed to the JES output queue.
The use a DD statement with a DUMMY parameter will allow a program to run if a data set does not exist. The following example show a DD DUMMY statement.
//QSAM0080 DD DUMMY
The following is the COBOL SELECT statement.
SELECT QSAM0080-FILE ASSIGN to QSAM0080 ORGANIZATION is SEQUENTIAL ACCESS MODE is SEQUENTIAL FILE STATUS is QSAM0080-STATUS.
The following shows the COBOL statements for the open, read and close of the QSAM0080 data set (i.e. sequential file).
open input QSAM0080-FILE . . . read QSAM0080-FILE. . . . close QSAM0080-FILE
In the preceding example the OPEN will be successful, the first READ will return an End-of-File return code and the close will be successful.
The two techniques use to pass information (a Parameter) from JCL to a program are as follows.
Technique | Description |
via PARM= | This technique uses a PARM=parameter keyword on the EXEC statement in JCL. The COBOL program requires a LINKAGE SECTION. |
via SYSIN | This technique requires a SYSIN statement followed by the parameter statement(s) to be placed in the JCL. The COBOL program requires an "ACCEPT parameter from SYSIN" to be coded in the COBOL program. If the SYSIN statement is missing in the JCL the ACCEPT will ABEND with a "File not found" message. To avoid this it will be necessary to use a "//SYSIN DD DUMMY" statement in the JCL when a parameter is not being passed. |
A separate suite of documents and programs that describe and demonstrate parameter passing from JCL to a program is available for downloading. Review the Documentation for this suite of program members. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.
Note: The following two sub-sections are extracts from the preceding document and are included for convenience.
To pass a parameter from JCL to a program requires the use of the "PARM=" keyword with the EXEC statement. The following JCL statement shows an EXEC statement without a parameter defined.
//* ******************************************************************* //* Step 1 of 2, Execute the COBOL program without a parameter. //* //CBLPARS2 EXEC PGM=CBLPARC1
The following JCL statement shows an EXEC statement with a parameter defined by using the "PARM=" keyword. Notice the comma immediately after the program name. The parameter following the "PARM=" keyword requires the apostrophes if the text string contains space characters.
//* ******************************************************************* //* Step 2 of 2, Execute the COBOL program with a parameter. //* //CBLPARS2 EXEC PGM=CBLPARC1, // PARM='SimoTime, When technology complements business'
To pass a parameter from SYSIN to a program requires the use of DD statement for SYSIN. The following JCL statement is required if no parameter is passed.
//* ******************************************************************* //* Step 1 of 2, Execute the COBOL program without a parameter. //* //SYSIN DD DUMMY
The following JCL statements show what is required to pass information via SYSIN.
//* ******************************************************************* //* Step 2 of 2, Execute the COBOL program with a parameter. //* //SYSIN DD * Parameter from SYSIN… /*
The following shows the COBOL statement required to access the parameters.
ACCEPT variable-name FROM SYSIN
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 following JCL member (PDSCRTJ4.jcl) is an example of how an instream PROC is used three times when the JOB is executed. The job steps that call the instream PROC will provide the name of the PDS to be created via the &DSNAME substitution value.
//PDSCRTJ4 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1 //* ******************************************************************* //* This JCL Member is provided by SimoTime Technologies * //* (C) Copyright 1987-2019 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 Technologies //* 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 //*
A separate suite of documents and programs that describe and demonstrate the use of JCL and PROC's is available for downloading. Review the Documentation for this suite of program members. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.
JCL substitution is mainly used when a repeatable process is used many times but needs the ability to behave differently based on variable information passed from the job that is executing the process. Review the Documentation for this suite of program members. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.
The SET statement lets you set the values of symbolic parameters within a JCL or PROC member. Review the Documentation for this suite of program members. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.
This section provides examples of how to use INCLUDE and JCLLIB statements in JCL. The following from the JES output shows the statements and the substituted values.
20 //* 21 //* ******************************************************************* 22 //* 23 // JCLLIB ORDER=SIMOTIME.PDS.JCLINC 24 // INCLUDE MEMBER=JCLINCI1 ##* ##* ******************************************************************* ##* SET Values from the JCLINCI1.INC Member. ## SET HLQ01=SIMOTEST ## SET HLQ02=TEMP 25 //* ******************************************************************* 26 //* Step 1 of 2 This job step will delete a previously created 27 //* hex-dump file. 28 //* 29 //TAKEAWAY EXEC PGM=IEFBR14 30 //TESTFILE DD DSN=&HLQ01..&HLQ02..TESTFILE,DISP=(MOD,DELETE,DELETE), SUBSTITUTION - DSN=SIMOTEST.TEMP.TESTFILE,DISP=(MOD,DELETE,DELETE), 31 // STORCLAS=MFI, 32 // SPACE=(TRK,5), 33 // DCB=(RECFM=V,LRECL=80,DSORG=PS) 34 //*
A sample suite of programs that describe and demonstrate the use of the INCLUDE statement with the SET and Substitution of variable values is available for downloading. Review the Documentation for this suite of program members. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.
If programs are not stored in the libraries predefined for the operating systems then it will be necessary to specify the location of the programs. For example, if program are located in a private library or a test library then use STEPLIB and/or JOBLIB to tell the system the location of the programs.
STEPLIB and JOBLIB require a DD statement that defines the names of the Load Libraries that are searched to find and load the program. As the names imply the STEPLIB statement applies only to an individual job step, the JOBLIB statement applies to the whole job. If you specify both then the STEPLIB statement will override what is specified by the JOBLIB statement but only for the individual step.
A JOBLIB statement must be specified after the Job statement and before any job steps (or EXEC statements). The STEPLIB must be specified after the EXEC PGM statement of the job step.
//SIMOJOB1 JOB (ACCTINFO),CLASS=A,MSGCLASS=C,NOTIFY=USERID //JOBLIB DD DSN=SIMOTIME.DEVL.LOADLIB1,DISP=SHR //* //STEP0100 EXEC PGM=PROGRAM1 //* //STEP0200 EXEC PGM=PROGRAM2 //* //STEP0300 EXEC PGM=PROGRAM3 //STEPLIB DD DSN=SIMOTIME.DEVL.TEMPLIB1,DISP=SHR //* //STEP0400 EXEC PGM=PROGRAM4
In the preceding example PROGRAM1 of STEP0100, PROGRAM2 of STEP0200 and PROGRAM4 of STEP0400 will run from the library SIMOTIME.DEVL.LOADLIB1 that is specified in the JOBLIB statement. PROGRAM3 of STEP0300 will run from the library SIMOTIME.DEVL.TEMPLIB1 that is specified in the STEPLIB statement that overrides the JOBLIB statement.
This suite of programs provides an example of how mainframe JCL can do conditional processing. The first JCL example will focus on the approaches used by JES/2 using the "COND=" parameter on the JOB or EXEC statement. With JES/3 the conditional processing was improved to use "IF" statements. The second JCL example will focus on the IF, THEN, ELSE and ENDIF statement construct. Both JCL examples accomplish the same task. However, the second JCL example has additional information displayed when there is a difference between the actual and expected return code. The use of the COND parameter can be very difficult to code and understand. I would recommend the use of the IF, THEN, ELSE and ENDIF statement construct if you have a choice.
A sample suite of programs that describe and demonstrate conditional processing is available for downloading. Review the Documentation for this suite of program members. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.
his suite of programs is provided as a possible quick reference for IBM Mainframe Job Control Language (or JCL). 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 documentation and software were developed and tested on systems that are configured for a SIMOTIME environment based on the hardware, operating systems, user requirements and security requirements. Therefore, adjustments may be needed to execute the jobs and programs when transferred to a system of a different architecture or configuration.
SIMOTIME Services has experience in moving or sharing data or application processing across a variety of systems. For additional information about SIMOTIME Services or Technologies please contact us using the information in the Contact or Feedback section of this document.
Software Agreement and Disclaimer
Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Technologies. 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 Technologies.
SimoTime Technologies 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 Technologies 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 are beyond the scope and purpose of this document. The first group of documents may be available from a local system or via an internet connection, the second group of documents will require an internet connection.
Note: A SimoTime License is required for the items to be made available on a local system or server.
The following links may be to the current server or to the Internet.
Explore the JCL Connection for more examples of JCL functionality with programming techniques and sample code.
Explore the COBOL Connection for more examples of COBOL programming techniques and sample code.
Explore An Enterprise System Model that describes and demonstrates how Applications that were running on a Mainframe System and non-relational data that was located on the Mainframe System were copied and deployed in a Microsoft Windows environment with Micro Focus Enterprise Server.
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 that are used to interpret the results of accessing VSAM data sets and/or QSAM files.
The following links will require an internet connect.
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.
A good place to start is The SimoTime Home Page for access to white papers, program examples and product information. This link requires an Internet Connection
Explore The Micro Focus Web Site for more information about products (including Micro Focus COBOL) and services available from Micro Focus. This link requires an Internet Connection.
Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.
This document was created and is maintained by SimoTime Technologies. If you have any questions, suggestions, comments or feedback please use the following contact information.
1. | Send an e-mail to our helpdesk. |
1.1. | helpdesk@simotime.com. |
2. | Our telephone numbers are as follows. |
2.1. | 1 415 763-9430 office-helpdesk |
2.2. | 1 415 827-7045 mobile |
We appreciate hearing from you.
SimoTime Technologies was founded in 1987 and 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. Our customers include small businesses using Internet technologies to corporations using very large mainframe systems.
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. We specialize in preparing applications and the associated data that are currently residing on a single platform to be distributed across a variety of platforms.
Preparing the application programs will require the transfer of source members that will be compiled and deployed on the target platform. The data will need to be transferred between the systems and may need to be converted and validated at various stages within the process. SimoTime has the technology, services and experience to assist in the application and data management tasks involved with doing business in a multi-system environment.
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 |
A JCL Reference with Descriptions and Examples |
Copyright © 1987-2025 SimoTime Technologies and Services All Rights Reserved |
When technology complements business |
http://www.simotime.com |