JCL - Job Control Language On Mainframes
JCL - Job Control Language On Mainframes
When we start talking about JCL or thinking about JCL, the first
thing that comes in everyone's mind is, what is a JCL. To alleviate
the problem, JCL is a specific language, which is used by a
programmer or any programmer so to speak, to communicate with
the IBM Mainframe. The meaning of the abbreviation is called JOB
CONTROL LANGUAGE. But its is just not like any other language,
such as English or German or French or any other language.
However, the English alphabets are used to create this typical
language to talk to the Mainframe.
The next question may come to your mind is, what is a Batch
Processing. The Batch Processing is a special kind of processing,
where a group of transactions are presented to the computer in a
batch and a formal request is made to the computer to process it.
The only difference is that, in a batch processing, certain level of
processing is done, with the online up, and in another case, certain
processing are done when the online region is down.
Apart from these three pieces of information, the job control language
contains lot more information, which will really amaze you. When
JCL was first introduced in the early sixties, it was greeted by the
programmer community, something akin to a culture shock. The
programmers, who barely tolerated few extra cards, in their card
2
deck, suddenly got overwhelmed with this full blown language, which
is written in English alphabets, is not really English Language. It was
also perceived as a language, far more difficult than the programming
language itself. Computers became so big and powerful that it was
really wasteful to have one single program, use the machine. The
concept arrived about Single Processor and also Multiprocessor.
Instead of one program running at one time. Several programs
started running in the machine and each of the programs was trying
to demand its share of attention from the machine. In today's IT
environment, specially the Mainframe Environment, life without JCL is
simply inconceivable.
A JCL Card must have something after the first two bytes,
which contains // and if nothing is there, it will carry some other
meaning
Currently, there are eight types of JCL, which are in use in the
Mainframe Industry. They are:
• JOB
• EXEC
• DD
• PROC
• PEND
• DELIMITER
• COMMENT
• NULL.
Batch Execution Job. Also please note that, every type has its
significance in running the job, you cannot say, this is more important
and this is not so important or less important. As you start coding the
JCL, you will find how they are dependent on each other. It is
Let us start with the most important statement, seen in the jobstream,
the first record or card in a JOB Stream. The JOB Card contains the
following information:
JCL IDENTIFIER
The first two bytes of a JCL must contain two slashes, //.
JOBNAME
This is a parameter, which is an identity of the job, you just submitted
to the CPU or computer, sometime ago, it is limited to eight
characters, such as KJAU1234 or ABCD5678. But it must not start
with a numeric value.
JOB
This is a job identifier to the CPU. It tells the CPU or computer that a
batch job has just been submitted now.
ACCOUNTING INFORMATION
This is normally enclosed within Right and Left Parenthesis, and it is
exclusively installation-dependent. It is used for computer usage
7
LET US TALK ABOUT JOB CARD
chargeback, goes back to the days, when IBM used to rent the
machines, instead of outright sales. Currently it is used to denote the
usage in a certain company, among various administrative group.
Example: (36455,,R,TL01,QPC)
PROGRAMMER NAME
This is space of 18 bytes, usually assigned for the Programmer's
name, but that does mean, nothing else can be placed in this area.
This eighteen bytes can be used by the programmer for any reason,
deemed necessary. For example:
Please note that, the four paramaters mentioned above, are called
POSITIONAL PARAMETERS, because of their use in certain
specific positions. They have to be used in the order of JOBNAME,
JOB ID, ACCOUNTING INFORMATION, PROGRAMMERS NAME.
MSGCLASS
This parameter tells the CPU, what to do with the output of the job,
after completion. For example:
MSGCLASS=M, or MSGCLASS=A.
The industry default is if it is M, the job is held in the spooling area,
and if it is A, the job foes to print. But it can be denoted in the range
of A - Z and 0 - 9.
MSGLEVEL
This parameter conveys to the CPU, how much of output message,
you like to see, after the job completion, both positive or negative. It
has two subparameters, and they are:
MSGLEVEL=(jcl,allocation)
The JCL has the following identifier
JOBCLASS
This is normally coded as CLASS=X. For some installations, it is the
amount of hardware, allocated to this job, for others, it is a mix of both
hardware and also the time limit assigned to it. It is entirely
installation dependent parameter.
For example:
Class Meaning
RESTART
This parameter is used only if there is a need to restart a job at a
certain step, possibly after an abend.
For example:
PRTY
This parameter determines the seriousness or the importance of the
job, the value observed between 1 to 15, one being the lowest and 15
being the highest. The determination of this parameter should be left
upto the JES2 or JES3, upon submission of the job. Of course, this
can also be assigned by the operators or the Systems Programmers.
The programmers are not advised to code this parameter to their
wish, which may land them in trouble.
NOTIFY
This parameter informs the submitter or anyone else, whoever's id is
mentioned on the right operand, about the completion status of a job.
Some installations inform the assignee only if they are logged on, but
in other cases, it is flashed on the screen, the moment, they log on.
For example: NOTIFY=GP4ABC
TYTPRUN=SCAN
This is used to check the SYSTAX ERROR for a JCL Jobstream.
Before moving to production, this parameter must be removed. If this
parameter still needs to be retained in the JOB Card, the SCAN
needs to be changed to NOSCAN. The NOSCAN operand will not
do the syntax checking and allow the job to run, but SCAN will
continue checking the SYNTAX error, and prevent the job, from being
run.
All the parameters that you have seen above, with an equal sign (=)
and a variable quantity on the right, are called KEYWORD
PARAMETERS. Please note than a POSITIONAL PARAMETER
does not carry an equal sign. However, this method does not just
apply to job cards only, but throughout the JCL.
When EXEC Statement is used with a program, there are four other
parameters which are used along with it, and they are:
If the earlier step STEP003 had a good end of step and had a
RETURN CODE of zero, then this step will be bypassed, since 0 is
equal to 0, as stated in the Condition Code.
If this step needs to be executed, then the coding will be, as follows:
where the condition code will not be satisfied. The condition code
can also be manipulated to reflect AND and OR Condition, which
must be coded as followed:
There are two other parameters, which are used with the EXEC
Statement, in an entirely different scenario. Normally, in a MVS
Environment, a job step is not run, if an earlier jobstep did not end
successfully, if none of the steps has any CONDITION CODE is not
coded.
The normal installation default is VIRT, but REAL can only be used, if
the user is authorized to use this parameter. The REAL
subparameter is used only for high priority jobs, and the priority is
decided by the Operations Management Group, or someone else with
the appropriate authority. Any application programmer is highly
advised not to use it, unless fully authorized to do so.
But please note carefully that these four parameters are used
only in the EXEC Statements, where a program is executed and
not a proc.
13
LET US TALK ABOUT DD STATEMENT
DD Stands for Data Definition, which means, this statement tells the
computer, everything about all the dataset, used in the particular
proc, both old, as well as new.
4. The dataset must not have a special character within the whole
length of the name.
GP4ABC.ANNUAL.CUM.PROFIT.DATA
//OLDDATA DD DSN=GP4ABC.CUMSALES.DATA,DISP=SHR,
where OLDDATA is the DDNAME, as coded in the program, followed
by the DD Statement.
SHR means Share and OLD means OLD, as the name says. All
programmers are advised to use SHR, instead of OLD, since id OLD
is used, the data cannot be used by any other program, until the
whole job is over, but SHR will help other programs to use that data,.
after the specific step is over.
To represent new data, we need the following parameters:
Proc Statements are nothing but job steps with an added parameters,
called SYMBOLIC PARAMETERS.
SYS1.PROCLIB SYS2.PROCLIB
GA.CENTRAL.PROCLIB REGION.SOUTH.PROCLIB.
Please also note that the cataloged procedures must not have the
following:
- A JOB Card
- Any Null Statements
- Any instream data
- Any JOBLIB Statement
- Any JES2 or JES3 Control Statements
- No PROC within a PROC
20
LET US TALK ABOUT PROC STATEMENT
As you can see, there are only three symbolics are used in this
proc, and they are:
HLQ=PP,FILE=PRD,SCN=SCN
//TI01 DD DSN=&HLQ.GBV.&FILE.SCN.TREND.INV01,DISP=SHR
//TI01 DD DSN=PP.GBV.PRD.SCN.TREND.INV01,DISP=SHR.
21
LET US TALK ABOUT PROC STATEMENT
As you can see that, this proc can be used in several places in the
company, just by changing the variables, represented by the
symbolic parameters. This is the major convenience of using a
cataloged proc, which prevents you from writing the proc all over
again, with different variables, which can easily be replaced by the
symbolic parameter.
// PEND, where you have to place at least one blank spaces, two is
better, followed by the word PEND.
INPUTTWO DD *
Proc Statements are nothing but job steps with an added parameters,
called SYMBOLIC PARAMETERS.
SYS1.PROCLIB SYS2.PROCLIB
GA.CENTRAL.PROCLIB REGION.SOUTH.PROCLIB.
Please also note that the cataloged procedures must not have the
following:
- A JOB Card
- Any Null Statements
- Any instream data
- Any JOBLIB Statement
- Any JES2 or JES3 Control Statements
- No PROC within a PROC
23
LET US TALK ABOUT PROC STATEMENT
//TI04 DD DSN=&HLQ.GBV.&FILE.SCN.TREND.INV04,DISP=SHR
//TI05 DD DSN=&HLQ.GBV.&FILE.SCN.TREND.INV05,DISP=SHR
//TI06 DD DSN=&HLQ.GBV.&FILE.SCN.TREND.INV06,DISP=SHR
//TI07 DD DSN=&HLQ.GBV.&FILE.SCN.TREND.INV07,DISP=SHR
//*
//***************** INPUT PARM CARD FILE ***********************
//*
//PARMFILE DD DUMMY
//*
//***************** MESSAGE DISPLAY FILE *************************
//SYSOUT DD SYSOUT=*
//*
//***************** DLI AND VSAM BUFFERS ************************
//DFSVSAMP DD DSN=&HLQ.GB.&FILE.DBA.BUFFERS(MABTIM3A),DISP=SHR
//***************** DATA BASE FILES *******************************
//DD1SX00H DD DSN=&HLQ.GBD.&FILE.SCN.DBDSX00H,DISP=SHR
//DD1SX00I DD DSN=&HLQ.GBD.&FILE.SCN.DBDSX00I,DISP=SHR
//DD1SX01I DD DSN=&HLQ.GBD.&FILE.SCN.DBDSX01I,DISP=SHR
//DD1IT00H DD DSN=&HLQ.GBD.&FILE.SCN.DBDIT00H,DISP=SHR
//DD1IT00I DD DSN=&HLQ.GBD.&FILE.SCN.DBDIT00I,DISP=SHR
//DD1IT01I DD DSN=&HLQ.GBD.&FILE.SCN.DBDIT01I,DISP=SHR
//DD1IT03I DD DSN=&HLQ.GBD.&FILE.SCN.DBDSX03I,DISP=SHR
//****************** ABEND ARRANGEMENTS ***********************
//PRINTER DD SYSOUT=(,),OUTPUT=*.FORM49
//PRINTER2 DD SYSOUT=(,),OUTPUT=*FORM49
//SYSABEND DD SYSOUT=*
//SYSABOUT DD SYSOUT=*
As you can see, there are only three symbolics are used in this
proc, and they are:
HLQ=PP,FILE=PRD,SCN=SCN
//TI01 DD DSN=&HLQ.GBV.&FILE.SCN.TREND.INV01,DISP=SHR
//TI01 DD DSN=PP.GBV.PRD.SCN.TREND.INV01,DISP=SHR.
As you can see that, this proc can be used in several places in the
company, just by changing the symbolic parameter. This is the major
convenience of using a cataloged proc, which prevents you from
writing the proc all over again, with different variables, which can
easily be replaced by the symbolic parameter.
// PEND, where you have to place at least one blank spaces, two is
better, followed by the word PEND.
INPUTTWO DD *
But if /* is the first two bytes of any record of the instream data, a
different delimiter needs to be used, a stated below:
//INPUTTWO DD *,DLM='ZZ'
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
cccccccccccccccccccccccccccccccccccccccc
dddddddddddddddddddddddddddddddddddd
/*eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ZZ
You can very well see the difference by looking at the two sets of
instream data representation. In the top set, there is no data, where
the first and second place is occupied by /*, so the delimiter used was
/*, but the setup had to be changed for the second set of data,
because there was one record following that condition.
Comment Statements are used in the JCL, only for one purpose, and
that is documentation. For any Mainframe Environment,
documentation is extremely important, and it is highly advised to use
comment statement in the body of the JCL. In the Comment
Statement, an asterisk needs to be added after the first two slashes.
For example:
//*****************************************************************************
//* THIS STEP PERFORMS THE PLAIN JCL COPY OF THE INPUT
//* FILE TO THE OUTPUT FILE USING THE IBM UTILITY.
//*****************************************************************************
27
LET US TALK ABOUT COMMENT STATEMENT
But please note that, a null statements must not be added in the
middle of two jobsteps, which will effectively prevent the second job
step from executing, since the MVS or JES2 will think that this is the
end of the job. If you want to add readability in the proc, please add a
comment statement after the last line of the previous step, followed
by the comment, attributed to the next step.
For example:
29
LET US TALK ABOUT NULL STATEMENT
//*****************************************************************************
//* THIS STEP PERFORMS THE PLAIN JCL COPY OF THE INPUT
//* FILE TO THE OUTPUT FILE USING THE IBM UTILITY.
//*****************************************************************************
//STEP001 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD DSN=GP4ABC.GEN.INPUT. DATA, DISP=SHR
//SYSUT2 DD DSN=………………………………………………
//
//*****************************************************************************
//* THIS STEP EXECUTES THE PROGRAM TYR996L7, AND
//* CONSOLIDATES ALL THE ACCOUNTS RECEIVABLE
//*****************************************************************************
//STEP2 EXEC PGM=TYR996L7
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
Extreme care must be taken to make sure that if you decide to add a
NULL statement, it has to be, ONLY AT THE END OF A JOB.
30
LET US TALK ABOUT JCL RECAP
DD Statement tells the computer or CPU, all the details for new, as
well as existing datasets.
PEND Statement tells the computer or CPU that, this is the end of
the procedure, needs to be executed, preceded by the EXEC
Statement. This applies only for In-stream Procs only and not
cataloged procs.
NULL Statement tells the computer or CPU that, this is the end of
the jobstream.
GOOD LUCK.