Job Control Language: What Is JCL ?
Job Control Language: What Is JCL ?
Job Control Language: What Is JCL ?
What is JCL ?
A JOB means
Operation Field
• Provides statement’s function ( JOB,EXEC,DD)
Parameter field
What is JOB Statement ?
Job statement identifies a JOB ( a batch unit of
work) to MVS . And supply necessary information.
Kinds of Parameters :
1 . Positional Parameter
2 . Keyword Parameter
Positional Parameter :
* Pre determines Sequence
* Separated by Comma.
* Omitted parameter indicated by successive commas.
Keyword Parameter
Eg : -
//Job-name <positional parameter>,<keyword parameter>
Positional Parameters :
* MSGLEVEL
• Determines the JCL print & Allocation message
• Format is MSGLVL=(Print,Allocations)
• Print
0 Only Jobs
1 All Input & Procedure Statement
2 Only Input statement
• Allocations
0 no allocation messages
1 all allocation messages
Keyword Parameters :
* PRTY
• Determines priority for scheduling jobs within each class
• Ranges from 0 – 15
* REGION
• Specifies amount of space a Job requires
• Can be specified in KB or MB
* NOTIFY
• Notify the user about the status of the Job
Keyword Parameters :
* TIME
• Specifies maximum CPU time for a Job
• System will automatically cancel the Job if its execution
time exceeds the specified time.
• Format is time=(mins,secs)
* TYPRUN
• Format is TYPRUN=function
• It has two options
1 . Scan 2. Hold
1. Scan cause JCL to be scanned for syntax error only.
2. Hold cause the Job to be detained in input queue until
explicitly released by the operator.
Keyword Parameters :
* COND
• Specifies whether a Job should continue to execute or
terminate in relation to the outcome of a job step.
• Format is cond=(code,operator)
code 0 to 4095
operator GT,GE,EQ,LT,LE,NE
COND=EVEN
Execute this step even if a preceding JOB step
abends.
COND=ONLY
Execute this step only if a preceding JOB step
abends.
Eg.
cond=(0,NE)
JOB will execute only if all Job Steps returns a
condition code of 0.
If True Terminate the Job
//STEP1 EXEC PGM=ONE
//STEP2 EXEC PGM=A,COND=(0,EQ,STEP1)
//STEP3 EXEC PGM=B,COND=(0,LT,STEP1)
//STEP4 EXEC PGM=C,COND=EVEN
//STEP5 EXEC PGM=D,COND=ONLY
Exec statement :
• Marks the beginning of each step in a JOB.
• Identifies the program or procedure to execute
• Maximum number of Job step in a Job is 255
Step-name:
Every step to be named.
Positional Parameter:
PGM=program (or) PROC=procedure (or) procedure name
Keyword Parameter: (Param,Cond,Time,Region)
• Param
* pass parameter to the program that is being executed
* maximum length of 100 characters
Time Parameter :
If coded on Both JOB and EXEC Statement.
//Job1 Job (A123),’ABC’,Time=12,Notify=&SYSUID
//STEP1 EXEC PGM=A,Time=4
//STEP2 EXEC PGM=B,Time=4
//STEP3 EXEC PGM=C,Time=4
//
Job1 is allowed 12 minutes of CPU time.
STEP1,STEP2,STEP3 are allowed 4 minutes each.If
any one of the steps take more than 4 minutes of CU time,the
Job will terminate normally.
If Time parameter on the Job Card is smaller than it is
on the Job step.Job will terminate.
DD statement:
* Required for each Input/Output file accessed by the
program
* Specifies the name of the Dataset, and their properties
* Up to 3273 DD statements can be allocated to a single
Job Step.
Format is :
//DD-Name DD <Parameters>
Positional Parameter : * , DATA , DUMMY
Keyword Parameter : DSN,DISP,UNIT,SPACE,
DCB,VOLUME
DISP means Disposition:
DISP=(Status,Normal-Disposition,Abnormal-Disposition)
The status field indicates the current status of the data set.
Format is :
UNIT=device_address
Or
UNIT=device_type
Or
UNIT=device_group_name
Or
UNIT=AFF=prior_ddname
VOLUME Parameter:
SER Sub_parameter:
VOL=SER=serial_number
Eg :
VOL=SER=SMS005
REF Sub_parameter:
VOL=REF=*.referback(Referback or Backward Reference)
Referback specifies the name of prior DD Statement.
eg . VOL=REF=*.STEP1.DD1
SPACE Parameter :
Format :
//SYSPRINT DD SYSOUT=*
//STEPLIB DD DISP=SHR,DSN=Program-library-name
JOBCAT :
• used to identify a VSAM catalog to search first when attempting to
locate cataloged data sets during the job’s execution
• JOBCAT must be placed after the JOB statement and before the first
EXEC statement in the JOB.
//JOBCAT DD DISP=SHR,DSN=DATALOG-NAME
STEPCAT:
• used to identify a VSAM catalog to search first when
attempting to locate cataloged data sets during the STEP
execution
• STEPCAT can be placed anywhere after EXEC.
• If a STEPCAT DD is specified in a job that has a
JOBCAT,STEPCAT take Precedence.
//STEPCAT DD DISP-SHR,DSN=CATALOG-NAME
CONCATENATING DATA SETS :
Data set names are coded one after the other, all DD
statements appear in the sequence that the data sets are to be
concatenated.
* up to 255 sequential data set can be concatenated together.
* up to 16 partitioned data set can be concatenated together.
SYSUDUMP :
It is used to obtain a dump of the contents of various
registers and variables in case of abnormal termination of
Job. This dump is in hexadecimal.Information about various
subroutines called within the Job and data sets accessed is
also provided.
SYSABEND :
Example :
//STEP1 EXEC PGM=PGM1
//DD1 DD DSN=INPUT1.DSN,DISP=OLD,
// VOL=SER=11111
//*
//STEP2 EXEC PGM=PGM2
//DD2 DD DSN=INPUT2.DSN,DISP=OLD,
// VOL=REF=*.DD1
FORWARD REFERENCE:
Reference to a following DD statement in the JOB.
Example :
//STEP1 EXEC PGM=PGM1
//DD1 DD DDNAME=DD3
//DD2 DD DSN=DD2.DSN,DISP=SHR
//DD3 DD DSN=XXX.BBB,DISP=SHR
Utilities:
Utility programs are generalized programs used in
installations to perform common data processing
functions
for example : copying files is a common
function.
* IEFBR14 Null Utility used when creating a PS
or PDS
* IEBGENER copy data from one PS to another
PS
* IEBCOPY copy data from one PDS to another
PDS
* IEBCOMPARE compare two data sets.
• the type of data stored in the data set that is being sorted.
For example, it can be character, packed , etc.
Parameters on SORT command:
The sort command is used to specify features specific to the
sort itself.
Format is :
SUM FIELDS=NONE
INREC FIELDS=(15,7,22,4)
SORT FIELDS=(1,7,CH,D,8,4,CH,A)
INCLUDE COND=(15,7,CH,EQ,C'PRG')
OMIT COND=(15,7,CH,EQ,C'PRG')
SORT FIELDS=(1,3,CH,A,15,3,CH,D)
OMIT COND=(22,4,CH,EQ,C'9000')
Merge Function
Format :
merge fields-(st_loc,Len, format,merge_seq)
Merge Program:
//
Procedures:
A procedure is a set of standard JOB step definitions
that can be used repeatedly to perform a FUNCTION
//PROC1 PROC
//EXECUTE EXEC PGM=IEFBR14
//DD1 DD DISP=(NEW,CATLG),DSN=MTRG011.CLASS.PSNE1,
// SPACE=(TRK,(2,1)),
// DCB=(DSORG=PS,LRECL=80,RECFM=FB,BLKSIZE=800),
// UNIT=SYSDA
How to Call the Catalog Procedure:
//MTRG011A JOB,'MANE',NOTIFY=MTRG011
//JL JCLLIB ORDER=MTRG011.JCL.DEMOS
//EXESTEP EXEC PROC=CATPROC
//
* While calling the procedure use the member name not the
procedure name in case of catalog procedure.
Symbolic Parameters:
//
Overriding Parameter:
To override a parameter on the EXEC statement, when
invoking the proc, follow on the proc statement with:
PARAMETER.PROC STEPNAME=VALUE
EG.
DEFINING THE PROC (MEM)
//PROC1 PROC
//STEP1 EXEC PGM=PROG01
//DD1 DD DSN=ABC,DISP=OLD