Introduction to JCL
Page 1 of 2
Introduction to JCL
It is a Batch operating environment. In batch mode we submit or send processing request
(JCL) to the system and then we can do some other tasks namely, one can read a book, do
some other program etc. Our processing request is put into queue along with the line of
other requests submitted by other people. The system will ultimately get around to our
request, process it, and return the results to us. Batch mode is generally cheaper than
interactive mode. Interactive mode demands a higher level of service from MVS and
requires fast response time
Any business application is divided into logical modules and these modules are
developed using programming languages. These programs should be executed in a pre-
defined sequence to achieve the business functionality.
JOB
A JOB is the execution of one or more related programs in sequence. Each
program to be executed by a JOB is called a JOB STEP.
Job Control Language
JCL is a set of control statements that provide the specifications
necessary to process a JOB. It is the interface between the requirements or
instructions in your program and the MVS operating system.
JOB Management JES2/JES3
MVS uses a JOB entry subsystem (JES) to receive jobs into the operating
system, schedule them for processing by MVS, and to control their output processing. There
are two types of JES. They are namely:
JES2,
JES3
With JES, MVS operates more efficiently
Jes2 is a decentralized environment. Every processor process the incoming jobas individually, jes3 is
centralized environment. There is a global processor, which controls all the other processors and
assigns the jobs to them.
Without JCL the program will not run on IBM MAINFRAME. So it is like heart of a mainframe.
Following should be followed while writing JCL statement:
Columns 1-2 should be always //.
Columns 3-10 are the name field. Must be alpha-numeric and should start with alphabet or
character ($, #, @). It is Optional field. It must be followed by at least one blank character.
Column 12 onwards is the operator field indicating the type of control statement (e.g. JOB, EXEC).
Must be preceded and followed by at least one blank.
The parameter field follows the operator field and must be preceded and followed by at least one
blank character. Contains parameter separated by commas.
To continue a parameter on to the next line, insert a non blank character (typically *) in column
72.
Comments in JCL begin with //*
//Name Operator Parameter
//Field Field Field
//SSB5 JOB USER=PRIYA
//MYJOB EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=A
//SYSUT1 DD ……
//SYSUT2 DD SYSOUT=A
………………..
……………….
//* End of JCL Program
JCL statements
Every JOB has three basic JCL statements which are namely:
JOB
EXEC
DD
JOB statement
Let us consider the first JCL statement namely the JOB statement. The JOB statement
identifies a JOBwhich is a batch unit of work, to MVS. The JOB statement names the JOB
and supplies the necessary information to indicate which resources the JOB will use. A
JOB is considered to consist of multiple JOB steps. Each step is made up of an EXEC
statement and one or more DD Statements. A JOB is all the JCL statements between a
JOB statement and the next JOB statement or null ('// ') statement.
JOB name
It can be 1-8 characters and the first character must be alphabetic or character ($, #, @)
Example:
//sahasra1 JOB ............
//BCD$1 JOB .............
Kinds of parameters
There are two kinds of parameters used in this statement namely
Positional
Keyword
The positional parameters
The parameters, identified by its position.
This parameter has accounting information and programmer name which are explained
below:
Accounting information
The Accounting information parameters identify the area that the computer time (resource
usage) is to be charged for this JOB. The format of this parameter is installation dependent
and it is optional parameter. Parentheses or apostrophes must be used if additional
accounting info is coded. Each is separated by commas. Maximum 142 characters can be
coded as accounting information.
Programmer name
Programmer name parameter is used for user identification
for routing printouts. This can be 1 to 20 characters long and is specified in single quotes if
name contains spaces or special characters other than periods. Hyphen cannot be used in
this parameter. If you want to include single quotes in the name it must be specified as
double quotes
The keyword parameters
A variety of keyword parameters( identified by a key word) can be specified on the JOB
statement. They are namely:
CLASS
COND
MSGCLASS
MSGLEVEL
NOTIFY
PRTY
REGION
RESTART
TIME
TYPRUN
The keyword parameters always follow positional parameters and parameter in this is
separated by commas.
Let us see how to use the parameters
CLASS
This indicates the type of JOB submitted to the system. It specifies input class for
JOB scheduler. It is a single alphanumeric character namely (a-z, 0-9). Different classes will
represent different types of jobs and will depend on installation describes the job
characteristics like cpu time usage and other resource constraints.
MSGCLASS
This determines the o/p device to which system messages and JCL messages are written.
This is a single alphanumeric character namely A-Z, 0-9. It depends on JES set-up.
MSGCLASS=T - output to terminal
MSGLEVEL
MSGLEVEL parameter is used to specify JCL and allocation messages which will be recorded
on the output device specified in MSGCLASS.
In this statements can take value 0 or 1 or 2. This represents
0 Only JOB statement
1 All input & procedure statements
2 Only input JCL statements
In this messages can take value 0 or 1 or 2. This represents
0 Allocation/termination messages being output if the job terminates abnormally.
1 Allocation/termination messages being output if the job terminates normally or abnormally.
COND
This Specifies whether a JOB should continue to execute or terminate
in relation to the outcome of any JOB step. If condition is true, the JOB is terminated.
Syntax:
COND=(code, operator, stepname)
In this code takes value 0 to 4095 and operator can be any one of GT, GE, EQ, LT, LE, NE
Eg. Cond = (1, EQ) means:
If 1 is equal to the condition code returned by any JOB step, terminate the JOB. In other
words, the JOB will execute only if all job steps return a condition code not equal to 1
It can be coded on exec statement . step level control is popular then job level control. On exec
statement, you may find only, even keywords against cond parameter.
TIME
This parameter specifies the maximum CPU time for a JOB.
System will automatically cancel the JOB if its execution time exceeds the specified time.
Syntax:
TIME=(MINS,SECS)
E.G. TIME=(2,20) maximum CPU time for this JOB is 2minute and 20 seconds
TIME=(1440/MAXIMUM/NOLIMIT) MEANS JOB CAN USE CPU FOR UNLIMITED TIME.
Typrun
It is used to request special job processing.
This has two values namely
SCAN causes JCL to be scanned for syntax errors only
HOLD causes JOB to be held in input queue until explicitly released by the operator
Restart
This enables the execution of a JOB from a particular step instead from the top of the JOB
step.
Syntax:
RESTART=STEPNAME
PRTY
This determines priority for scheduling jobs within each class and it value ranges from 0-15.
The more the number, higher will be the priority.
REGION
This specifies amount of space JOB requires and it can be specified in kb or mb
Syntax:
REGION=NK/NM
Exec statement
It defines the step and step level information to the system.
Stepname
It is an optional field but it is needed if you want to restart a job from
this step and for the same reason, it should be unique within the job.
Pgm or proc
Code the program name to be executed( 1-8 characters)
Parm
It is used to pass variable information to the processing program, executed by
this job step. If there is more than one sub parameter or if there is any
special character then enclose them in paraenthess/quotes. Maximum 100
characters can be passed in this way, quotes and brackets are not included in
this 100.