You are on page 1of 8

JCL Refresher

Table of Contents.
1.
2.
3.
4.
5.
6.

Introduction--------------------------------Job,exec,DD statements
Procedures
Conditional Processing
Jcl Utilities
Abend Handling.

1. Introduction.

What is JCL?
Job Control Language (JCL) is a means of communication between an application program
and the computer's operating system. It is a set of control statements that provide the
specifications necessary to process a JOB.
A Job is nothing but the execution of one or more related programs in sequence. Each
program to be executed by a job is called a Job Step.
Sample JCL.
//First JOB (034D),'RAMESH', CLASS=S,PRTY=6

JOB Statement
Program Name

//STEP01 EXEC PGM=REPORT


//INPUT DD DSN=CUSTOMER.FILE,

Step Name

Input file name

// DISP=SHR
//OUTPUT DD DSN=REPORT.FILE,
// DISP=(NEW,CATLG,DELETE)

Output file name

// UNIT=SYSDA,DCB=(RECFM=FB,LRECL=80),
// SPACE(TRKS,(100,20),RLSE)
//SYSOUT DD SYSOUT=*

2. JOB, EXEC,DD Statemnts.

JOB Statement is the first control statement in a JCL. The


parameters in the JOB statement help the Operating Systems in allocating
the right scheduler, required CPU time and issuing notifications to the
user.
Different terms used in JOB statement

2.1 JOB Statement:

JOB Keyword used to identify job statement


Class X- These can be visualized as individual

schedulers used by the

OS to receive the jobs based on time taken , priority, resource required.

X Range - 0-9 and A-Z.


PRTY X- Specifies the priority of a job in a class. Higher the no. greater the priority.
X Range- 0-15.
NOTIFY="userid | &SYSUID": The system sends the success or failure message
(Maximum Condition Code) to the user specified in this parameter.
MSGCLASS=CLASS : To specify the output destination for the system and Job
messages when the job is complete.
Class range : 0-9 and A-Z.

Time: Specifies the time span to be used by the processor to execute the job.
When TIME coded for both JOB and STEP ,TIME coded for a step applies to that
step, and time coded in job applies for whole job such that both are satisfied.
Following is the syntax:
TIME=(mm, ss) or TIME=ss. mm is in minutes , ss is in seconds.
Region : Specifies the address space required to run a job step within the job.
Region in JOB overrides that of EXEC. Following is the syntax: REGION=nK | nM.
n = number, M = megabyte , K = kilobyte
Typerun =Scan|Hold : Scan is used to check syntax error without executing it.
Hold is used to put a job on hold and can be released by
typing A against the job in spool.
RESTART and COND: These are used in conditional job step processing. when
COND coded in both JOB and EXEC, JOB COND is ignored.
NB: CLASS,MSGCLASS,REGION,PRTY are sensitive parameters and are
project specific. They should not be altered without prior permission.

2.2 EXEC:

The statement, which holds the job step program/procedure information


is the EXEC statement. The purpose of the EXEC statement is to provide
required information for the program/procedure executed in the job step.
Parameters coded in this statement can pass data to the program in
execution, can override certain parameters of JOB statement and can
pass parameters to the procedure if the EXEC statement calls a procedure
instead of directly executing a program.
Different parameter of EXEC are:
PGM: This refers to the program name to be executed in the job step.
PROC: This refers to the procedure name to be executed in the job step.
PARM: Used to provide parametrized data to the program that is being
executed in the job step.the data provided is received in the
linkage section of cobol program
ADDRSPC: This is used to specify whether the job step require
virtual or real storage for execution. ADDRSPC given in job
overrides ADDRSPC given in exec.

Example of EXEC statement:


//STEP010 EXEC PGM=MYCOBOL,PARAM=CUST1000,
//
ACCT=(XXXX),REGION=8K,ADDRSPC=REAL,TIME=1440

2.3 DD STATEMENTS.

The definition of each dataset used in the JCL is given using the DD
statement. The input and output resources required by a job step needs
to be described within a DD statement with information such as the
dataset organisation, storage requirements and record length.

Syntax:

//DD-name DD Parameters

Different parameters of DD statements:


DD name: A DD-NAME identifies

the dataset or input/output


resource.DD name is referenced in COBOL/Assembler program.

DD : it identifies the DD statement


DSN: The DSN parameter refers

DISP:

to the physical dataset name of a


newly created or existing dataset. The DSN value can be made up
of sub-names each of 1 to 8 characters length, separated by periods
and of total length of 44 characters.
A temporary dataset can aslo be coded in a DSN. They allocated
storage only for the job duration and are deleted at job completion.
Such datasets are represented as DSN=&&name
The DISP parameter is used to describe the status of the

dataset, disposition at the end of the job step on normal and


abnormal completion. Following is the syntax:
Following is the syntax:

DISP=(status, normal-disposition, abnormal-disposition)


Status:

OLD The dataset exists and this job step has exclusive use of the dataset.
SHR The dataset exists and other users and jobs can access the dataset, this is the
default
MO
D
NE
W

The dataset should be kept and new records will be appended to the end of the
dataset. The dataset may or may not exist. If it does not exist then a data set will
be created.
The dataset does not exist and will be created.

Normal Disposition:

DELETE Deletes the data set at the end of the step


KEEP

Keeps the data set.

CATLG

Places the entry in the system catalog or user catalog. For a NEW data set
this is the default.

UNCAT
Deletes the entry from the system catalog or user catalog.
LG
Abnormal Disposition:

DELETE Indicates that the data set is to be deleted at the end of a job step.
KEEP

Indicates that the data set is to be kept.

CATLG

Indicates that the system should place an entry in the system or


user catalog.

UNCAT Indicates that the system is to delete the entry in the system or user
LG
catalog.

DCB: The Data Control Block (DCB) parameter details the physical
characteristics of a dataset. This parameter is required for datasets
that are newly created in the job step.
LRECL: It is the length of each record held within the dataset.
RECFM: It is the record format of the dataset. RECFM can hold
values FB, V or VB.
BLKSIZE: It is the size of the physical block.
DSORG: is the type of dataset organisation. DSORG can hold values
PS (Physical Sequential), PO (Partitioned Organisation) and DA
(Direct Organisation).
Example:

DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DIRBLKS=1)

SPACE: The SPACE parameter specifies the space required for


the dataset in the DASD (Direct Access Storage Disk). Following
is the syntax:
SPACE=(spcunits, (pri, sec, dir), RLSE)
spcunits: This can be one of the CYL(Cylinder), TRK(Tracks) or
BLKSIZE(Block Size).
pri: This is the primary space required for the dataset.

sec: This is the additional space required, when the primary space is not
being sufficient.
ir: This is the directory blocks required, if the dataset is a PDS (Partitioned
Dataset) with members within it.
RLSE: This is used to release the unused space at job completion.

VOL: The VOL parameter specifies the volume number on the


device identified by the UNIT parameter. Following is the syntax:
VOL=SER=(v1,v2)

SYSOUT parameter directs the data to output device based on


the class specified. Following is the syntax
SYSOUT=class
if class is * then it directs output to same destination as that of the
MSGCLASS parameter in the JOB statement.
N.B: SYSOUT=* mostly directs output to spool. So SYSOUT should
be handled with care while running a job as it might eat up spool
area resulting in slow execution of job or even job abends.

3. PROCEDURES:

The JCL Procedures are set of statements inside a JCL grouped together to
perform a particular function. Usually, the fixed part of the JCL is coded in a
procedure. The varying part of the Job is coded within the JCL.
Syntax:

//Step-name EXEC procedure name

Types of procedure:
3.1 Instream Procedure.

When the procedure is coded within the same JCL member, it is called an
Instream Procedure. It should start with a PROC statement and end with a
PEND statement.
3.2 Catalogued Procedure:

When the procedure is separated out from the JCL and coded in a different
data store, it is called a Cataloged Procedure. A PROC statement is not
mandatory to be coded in a cataloged procedure.
3.3
Nested Procedure.
Calling a procedure from within a procedure is called a nested
procedure. Procedures can be nested up to 15 levels. The nesting can be
completely in-stream or cataloged. We cannot code an instream
procedure within a cataloged procedure.
Example:
//SAMPINST JOB 1,CLASS=6,MSGCLASS=Y,NOTIFY=&SYSUID
//*
//SETNM
SET DSNM1=INPUT1,DSNM2=OUTPUT1
//INSTPRC1 PROC
//* START OF PROCEDURE 1
//STEP1
EXEC PGM=SORT,DISP=SHR
//SORTIN
DD DSN=&DSNM1,DISP=SHR
//SORTOUT
DD DSN=&DSNM2,DISP=(,PASS)
//SYSOUT
DD SYSOUT=*
//SYSIN
DD DSN=&DATAC
//*
//STEP2
EXEC PROC=INSTPRC2,DSNM2=MYDATA.URMI.OUTPUT2
//
PEND
//* END OF PROCEDURE 1
//*
//INSTPRC2 PROC
//* START OF PROCEDURE 2
//STEP1
EXEC PGM=SORT
//SORTIN
DD DSN=*.INSTPRC1.STEP1.SORTOUT
//SORTOUT
DD DSN=&DSNM2,DISP=OLD
//SYSOUT
DD SYSOUT=*
//SYSIN
DD DSN=&DATAC
//
PEND
//* END OF PROCEDURE 2
//*
//JSTEP1 EXEC INSTPRC1,DSNM1=MYDATA.URMI.INPUT1,
//
DATAC=MYDATA.BASE.LIB1(DATA1)
//*

In the above example, the JCL calls the procedure INSTPRC1 in JSTEP1 and
procedure INSTPRC2 is being called within the procedure INSTPRC1. Here,
the output of INSTPRC1 (SORTOUT) is passed as input (SORTIN) to INSTPRC2.
A SET statement is used to define commonly used symbolic across job steps or
procedures. It initializes the previous values in the symbolic names. It has to be defined
before the first use of the symbolic names in the JCL.

4. Conditional Processing.
5. JCL Utilities
6. Abend Handling

You might also like