You are on page 1of 40

JCL JOB CONTROL LANGUAGE SIMPLE TUTORIAL

INTRODUCTION
Job control language. It is a means of communication between a program that
can be written in COBOL , ASSEMBE or !L"I an# the M$S operating s%stem. &ithout
a JCL, %ou cant able to run a 'ob on M$S operating s%stem.
Let us start with an e(ample 'cl, how it loo)s li)e, *he following 'cl is
use# to run an cobol program. I will e(plain in this chapter each an# e+er%
line of this 'cl. If %ou are alrea#% fimiliar with 'cl, please s)ip first
, chapters.
-.irst / 0 , chapters inten#e# for beginners1
JCL , used to run a cobol program
""JOB/ JOB -23451,6AMES76,CLASS86A6,!*98,
""S*E!2/ E:EC !;M8COB!O;.
""I<.ILE 55 5S<8SE5.;LOB.5ES.I<.ILE,5IS!8S7
""O=*I.LE 55 5S<8SE5.;LOB.5ES.O=*.ILE,
"" 5IS!8-<E&,CA*L;,5ELE*E1,
"" =<I*85IS>,
"" S!ACE8-C9L,-/,?1,LSE1,
"" 5CB8-EC.M8.B,LEECL8@2,BL>SIAE8@221
see the source co#e of cobol program COB!O;
I5E<*I.ICA*IO< 5I$ISIO<.
!O;AM0I5. COB!O;.
B
E<$IO<ME<* 5I$ISIO<.
CO<.I;=A*IO< SEC*IO<.
I<!=*0O=*!=* SEC*IO<.
.ILE0CO<*OL.
SELEC* I<!=*0.ILE ASSI;< *O I<.ILE.
SELEC* O=*!=*0.ILE ASSI;< *O O=*.ILE.
B
5A*A 5I$ISOI<.
.ILE SEC*IO<.
.5 I<!=*0.ILE
2/ I<!=*0EC !IC :-421.
.5 O=*!=*0.ILE
2/ O=*!=*0EC !IC :-?21.
B
&O>I<;0S*OA;E SEC*IO<.
2/ E<50O.05A*A0E. !IC :-31 $AL=E S!ACES.
CC E<50O.05A*A !IC $AL=E 69ES6.
B
!OCE5=E 5I$ISIO<.
MAI<0!AA.
!E.OM /2220I<I*ILIAA*IO<0!AA.
!E.OM D2220!OCESS0!AA *7= D2220E:I* =<*IL E<50O.05A*A.

!E.OM 32220CLOSE0!AA.
1
B
/2220I<I*ILIAA*IO<0!AA.

O!E< I<!=* I<!=*0.ILE.
O!E< O=*!=* !I<*0.ILE.
B
D2220!OCESS0!AA.

EA5 I<!=*0.ILE A* E<5
MO$E 69ES6 *O E<50O.05A*A0E.
;O *O D2220E:I*.
MO$E I<!=*0EC *O O=!=*0EC.
&I*E O=*!=*0EC.
B
D2220E:I*.
E:I*.
B
32220CLOSE0.ILES.
CLOSE I<!=*0.ILE O=*!=*0.ILE.
B
32220E:I*
E:I*.
<ow let us #iscuss JCL which we ha+e seen.
Before e(plaining, I will e(plain few basics about JCL
All JCL statements can consists of up to fi+e t%pes of
fiel#s
"" *he two forwar# slashes are reEuire# at the beginning of each
JCL statement in Columns / an# D.
Name field - *his is an optional fiel#. If co#e#, shoul# start at
Column 3. It ma(imum length is C.
Operation field - &hich in#icates the operation that is to be performe#
Operand - *his fiel# must appear after Operation fiel#. Must start at /,
column
Comments - Comments begin one space after the last operan#. Our simple
e(ample has no comments.

// Name Operation OPerand

"" JOB/ JOB -23451,
6AMES76,
CLASS86A6,
!*98,
"" S*E!2/ E:EC !;M8COB!O;
"" I<.ILE 55 5S<8SE5.;LOB.5ES.I<.ILE,
5IS!8S7
"" O=*I.LE 55 5S<8SE5.;LOB.5ES.O=*.ILE,
"" 5IS!8-<E&,CA*L;,5ELE*E1,
"" =<I*85IS>,
"" S!ACE8-C9L,-/,?1,LSE1,
"" 5CB8-EC.M8.B,
"" LEECL8@2,BL>SIAE8@221
2

*he following image e(plain 7ow our JCL will e(ecute cobol program
EXPLANATION -
//JO! JO "#$%&',()A*E+,(,CLA++-(A(,P)T.-/

'ob car# is mainl% use# to i#entif% 'ob, an# tell to M$S about t%pe of 'ob
it is, priorit% it has.

JOB/ is the 'ob name
2345 is accounting information
AMES7 is name of the programmer
CLASS is categor% of 'ob
!*9 is priorit% in the class
//+TEP#! EXEC P0*-COP)O0

E:EC is use# to specif% the program to be e(ecute#.
S*E!2/ is the name of the step -%ou can gi+e an% name here1
COB!O; is the program name to be e(ecute#

//IN1ILE && &+N-+E&20LO2&E+2IN1ILE,&I+P-+,)
I<.ILE is the name of input file, which is use# in cobol program

5S<8SE5.;LOB.5ES.I<.ILE 0 It is #ataset contains actual information to be rea#.

5IS!8S7 0 means another program also can rea# this program while we
are rea#ing this file.
//O3T1ILE && &+N-+E&20LO2&E+2O3T1ILE,
// &I+P-"NE4,CATL0,&ELETE',
// 3NIT-&I+5,
// +PACE-"C.L,"!,6',)L+E',
// &C-")EC1*-1,LE)ECL-7#,L5+I8E-7##'
O=*.ILE is the name of outputfile, which is use# in cobol program

5S<8SE5.;LOB.5ES.O=*.ILE is the output file #ata will be written
3

5IS!8-<E&,CA*L;,5ELE*E1 5isp specifies the #isposition of #ataset,
<E& 0 5ataset not e(ists, nee# to create
CA*L; 0 If step e(ecute# successfull%, #ataset shoul# be cataloge#
DELETE - If any error occurred, Dataset should be deleted
JOB STATEMENT
As we #iscusse# in Chapter0/ , *hree important input operations are
/. JOB
D. E:EC
3. 55
<ow let us loo) at JOB statement


S%nta( of JOB Statement
E:!LA<A*IO< to )e%wor# parameters

CLASS !*9 MS;CLASS MS;LE$EL *9!=< <O*I.9
!2 CLA++ 0 Some 'obs can be short running, some 'obs ma% ta)e more time other
ma% use ha+% resources. CLASS )e%wor# parameter is use# to tell to
OS about the nature of 'ob we are submitting.
S%nta( 0F CLASS8'obclass
$ali# +alues 0F An% alpha betical character between A 0 A or
numbers between 2 0 G
E(ample JCL 0F ""M9JOB JOB -334?91,6>IS7<A E5596,CLASS8>
4
92 P)T. 0 It is relate# to CLASS parameter. It assigns priorit% to 'obs which
belong to the same class. 7igher number ta)es prece#ence o+er the
'ob with lower number. A 'ob with priorit% of /D will run before a
'ob with priorit% ?.
S%nta( 0F !*98priorit%
$ali# +alues 0F An% +alue between 2 to /?
E(ample JCL 0F ""M9JOB JOB -34?91,6>IS7<A E5596,CLASS8C,!*98,
$2 *+0CLA++ 0 *he MS;CLASS parameter #etermines the output #e+ice to which
s%stem messages an# JCL messages are written
S%nta( 0F MS;CLASS8output0class0name
$ali# +alues 0F An% alpha betical character between A 0 A or
number between 2 0 G
E(ample JCL 0F ""M9JOB JOB -4?,91,6>IS7<A E5596,CLASS8@,!*98?,MS;CLASS8A

%2 *+0LE:EL 0 is use# to tell JCL, which messages to be printe# in the #e+ice
specifie# in MS;CLASS parameter
S%nta( 0F MS;LE$EL8-statements,messages1
$ali# +alues 0F Statements ma% be the number 2,/,D an# messages can be 2 or /
S*A*EME<*
2 0 elate# to 'ob statements onl% printe#
/ 0 'cl will be printe#
-which inclu#es all cataloge#"s%mbolic parameters1
D 0 onl% the input 'cl statements being printe#
MESSA;ES
2 0 Allocation"termination messages will be printe#
If 'ob terminates abnormall%
/ 0 Allocation"termination messages will be printe#
regar#less of whether the 'ob terminates normall% or
abnormall%.
E(ample JCL 0F ""M9JOB JOB -34?,91,6S6,CLASS8C,MS;CLASS8S,MS;LE$EL8-/,/1
62 T.P)3N 0 *he *9!=< parameter is use# to specif% whether 'ob is to be hel#
until further notice or for s%nta( chec)ing

S%nta( 0F *9!=<87OL5 0 Job hel# until further notice
or
*9!=<8SCA< 0 Chec) Jcl for s%nta( chec)ing

E(ample JCL 0F ""M9JOB JOB -34?,91,6>IS7<A6,CLASS8C,!*98G,*9!=<87OL5
5
/2 NOTI1. 0 *he <O*I.9 parameter is use# to #irect the s%stem, where it has to
sen# the success"failure message after completing the 'ob.
S%nta( 0F <O*I.98useri#"HS9S=I5
E:AM!LE JCL 0F ""M9JOB JOB -34?,91,6>IS7<A E5596,CLASS8C,<O*I.98HS9S=I5
HS9S=I5 0 the useri# from which user it has been submite#
""M9JOB JOB -34&?1,6>IS7<A E5596,CLASS8C,<O*I.98E*?4
It send the sucess/failture messae to E!T54 userid
JOBLIB / STEPLIB
JOLI
It is a 55 -5ata #efinition1 statement, an# it specifies where
the program -which is specifie# in E:EC statement1 e(ists.
It is applicable to all 'ob steps in that 'ob. It cannot be use#
in cataloge# proce#ures.
S%nta( 0F ""JOBLIB 55 5S<8#ataset
E:AM!LE JCL 0F

""M9JOB JOB -E3431,6>IS7<A6
""JOBLIB 55 5S<8SE.*ES*.LOA5LIB,5IS!8S7 I000 Attention
""S*E!/ E:EC !;M8COB!O;

Imme#iatel% following the JOB statement is the JOBLIB 55
statement. *his is use# to specif% the location of the
program that is to be e(ecute#.

+TEPLI
It is also li)e JOBLIB. It is use# to tell in which #ataset
program resi#es, It will be co#e# in JOB S*E!. It is onl%
for that step instea# of entire JOB. It can be place# an%
where in the 'ob step. S*E!LIB can be co#e# in cataloge#
proce#ures.
S%nta( 0F ""S*E!LIB 55 5S<8#ataset
E(ample JCL 0F ""M9JOB JOB -=4?,1,6>IS7<A6
""S*E!/ E:EC !;M8COB!O;
""S*E!LIB 55 5S<8*ES*.M9!O5.LIB,5IS!8S7
""S*E!D E:EC !;M8COB!O;D
""S*E!LIB 55 5S<8*ES*.M9!O5.LIB/,5IS!8S7
In abo+e e(ample, S*E!/ is e(ecuting COB!O; which
is member of *ES*.M9!O5.LIB
S*E!D is e(ecuting COB!O;D which is
member of *ES*.M9!O5.LIB/
"

If both the #$%LI% and &TE'LI% statements are coded, then the &TE'LI% s(ecification )ill o*erride
#$%LI% s(ecification+


EXEC statement
EXEC statement
E:EC statement is use# to e(ecute a program"proce#ure
A ma(imum of D?? E:EC statement can co#e in an single 'ob
S%nta( 0 ""stepname E:EC !;M8program0name,)e%wor# parameters
!ositional parameter 0 !rogram0name
5e;<ord parameters =or EXEC

!AM ACC* A55S!C 5!*9 !E.OM 5
PA)*
!AAM parameter is use# to pass information to program
S%nta( 0F !AM8+alue

$alue is a string can be / to /22 characters long.

!ASSI<; !AAME*E =SI<; !AM !AAME*E

!AM0I<5ICA*O will contain JAMES7J
!AM0LE<;*7 contains length of string.
)emaining parameters , 4e <ont use muc>
ACCT 0 accounting information for that step
A&&)+PC 0 use# to in#icate to the s%stem that the 'ob step is use either
+irtual or real storage

&P)T. 0 use# to assign priorit% to the 'ob step
PE)1O)* 0 specifies the rate at which s%stem resources use# b% 'ob step
)& 0 restart #efinition is use# to specif% automatic restart of a 'ob
if it aben#s
,
K. If there is a situation, where we nee# to co#e more than D?? steps
in a JOBL
A. &e nee# to split 'cl into two 'cls , at the en# of the first 'cl
chec) the con#ition
co#e an# initiate the secon# 'cl.


PA)A*ETE)+ IN OT, +TATE*ENT+ "JO and EXEC'
PA)A*ETE)+ IN OT, +TATE*ENT+ "JO and EXEC'
CO<5 E;IO< *IME
*hese parameters can co#e in both JOB an# E:EC statements, &hen we co#e
these parameters on both statement,
JOB 0 E;IO< will o+erri#e E:EC 0 E;IO<

JOB 0 CO<5 will o+erri#e E:EC 0 CO<5
E:EC 0 *IME will o+errir#e JOB 0 *IME
<ow let us see #etails of these parameters
)E0ION 0 Specifies the amount of space shoul# be use# at the time of
running a 'ob"step

S%nta( 0F E;IO<8I +alue F>
or
E;IO<8I +alue FM
E(ample JCL 0F ""M9JOB JOB -AE3D1,6AMES76
""S*E!/ E:EC !;M8COB!O;,
"" E;IO<8,@>


-ll a*ailable storae is assined to the .ob or .obste(, If !E/I$0 is coded 12 or 13

CON& 0 Each step sen#s an a return co#e to the s%stem upon completion.
*his is calle# con#ition co#e. CO<5 parameter is use# to control
the e(ecution of subseEuent 'ob steps, #epen#ing on the con#ition
co#e that is returne# for prior step.
eturn co#e number between 2 an# 42G?

S%nta( 0F CO<58-comparsion0co#e,con#ition1
4
-If co#e# on 'ob1
CO<58-comparsion0co#e,con#ition M,stepnameN M,E$E< " O<L9N1
-If co#e# on step1

con#ition can be ;*,;E,L*,LE,EK,<E


E(ample JCL 0F CO<5 co#e# on JOB

""M9JOB JOB -4@?1,6>IS7<A E5596
"" CO<58-4,;*1
""S*E!/ E:EC !;M8COB!O;
""S*E!D E:EC !;M8COB!O;D

In this e(ample we are specifing that if the number
4 is grater than the return co#e of S*E!/, then S*E!D
is to be b%passe#. It is elaborate# further in the
following image



CO<5 co#e# on E:EC statement
""M9JOB JOB -=@,G1,6>IS7<A E5596
""S*E!/ E:EC !;M8!O;/
""S*E!D E:EC !;M8COB!O;,
"" CO<58-C,EK,S*E!/1
""

In this e(ample the CO<5 parameter is use# to specif% that
S*E!D shoul# be b% passe# if C is eEual to the return co#e
issue# b% S*E!/.
5
TI*E 0 *he time parameter is use# to specif% the amount of C!= time that a
'ob or 'ob step is permitte# to utiliOe.
S%nta( 0F *IME8minutes
O
*IME8-MminutesN M,secon#sN1
minutes can be between / an# /43G
secon#s can be between / an# ?G
E(ample JCL 0F If co#e# on JOB
""M9JOB JOB -ED341,6AMES7 >IS7<A6,*IME8-D2,321
""S*E!/ E:EC !;M8COB!O;/
""S*E!D E:EC !;M8COB!O;D
""S*E!3 E:EC !;M8COB!O;3
In this e(ample D2 minutes 32 secon#s time allote#
to 'ob. All steps in this 'ob S*E!/ S*E!D S*E!3 shoul#
complete its tas) within D2 min. 32 sec.
If co#e# on S*E!
""M9JOB JOB -?,@1,6>IS7<A6
""S*E!/ E:EC !;M8COB!O
"" *IME832
In this e(ample 32 min. time is allote# to S*E!/.
If S*E!/ reEuires more than 32 min. M9JOB will
terminate abnormall%.
If co#e# on both S*E! A<5 JOB

""SECO<5 JOB ,6. >IS7<A6,*IME83
""S*E!/ E:EC !;M8C,*IME8D
""S*E!D E:EC !;M85,*IME8D
In this e(ample, the 'ob is allowe# 3 minutes of e(ecution time.
Each step is allowe# D minutes of e(ecution time. Shoul# either
step tr% to e(ecute be%on# D minutes, the 'ob will terminate
beginning with that step. If S*E!/ e(ecutes in /.@4 minutes an#
if S*E!D tries to e(ecute be%on# /.D, minutes, the 'ob will be
terminate# because of the 30minute time limit specifie# on the
JOB statement.

%y codin TI3E61441 or TI3E60$LI3IT, It )ill i*e a .ob or ste( an unlimited
amount of time+

To allo) a .ob or ste( to use the ma7imum amount of time, code TI3E63-8I393+
:odin TI3E63-8I393 allo)s the .ob or ste( to run for 35,512 minutes+ ;-((ro7+
244 days<

11
DD STATEMENT
*he 55 statement -5ata 5efinition1, is use# to i#entif% the source of input
an# the placement of output information
S%nta( 0F ""##name 55 I positional " )e%wor# parameters F
##name must be uniEue in the 'ob

!ositional parameters 0 B
5A*A
5=MM9
59<AM
>e%wor# !arameters 0 5S<
5IS!
=<I*
S!ACE
5CB
$OL=ME
&+N PA)A*ETE)
5S< parameter is use# specif% the #ata set name
S%nta( 0F 5S<8#ataset name
E(ample JCL 0F ""M9JOB JOB -E31,6AMES7 6
""S*E!/ E:EC !;M8COB!O;
""I<.ILE 55 5S<8*ES*.;LOB.M9LIB

*ES*.;LOB.M9LIB will be use# in the COB!O; program.
TE*PO)A). &ATA +ET+

*emporar% #ata set is create# #uring 'ob an# #elete# at the en# of the 'ob.
*emporar% #ata set can be co#e# b% using two ampersan#s followe# b% name.
E(ample JCL 00F ""M9JOB JOB -E4?,1,6AMES76
""S*E!/ E:EC !;M8COB!O;
""I<.ILE 55 5S<8HH*EM!
7ere *EM! is an temporar% #ataset will be #elete# upon 'ob completion.
&I+P PA)A*ETE)
*he 5IS! parameter is use# specif% the #isposition of #ataset which is
co#e# on 5S< parameter.
S%nta( 0F
11


!arameter on the 5IS! statement
+tatus Normal &isposition Abnormal
&isposition
<E& 5ELE*E 5ELE*E
OL5 CA*L; CA*L;
MO5 =<CA*L; >EE!
S7 >EE! =<CA*L;
!ASS

+TAT3+
<E& 0 5ataset will be create#. -file shoul# not e(ists1
OL5 0 5ataset shoul# e(ists.
MO5 0 5ataset will be create# If not e(ists.
S7 0 5ataset can be use# b% other 'obs also
NO)*AL &I+PO+ITION
-7appene# upon sucessful e(ecution of 'ob step1
5ELE*E 0 5ataset shoul# be #elete#
CA*L; 0 5ataset will be cataloge#
=<CA*L; 0 5ataset will be remo+e# from s%stem catalogs
>EE! 0 5ataset will be retaine# -*his parameter shoul#
be use# with permanent #ata sets1
!ASS 0 5ataset is to be passe# subseEuent 'ob step in
the same 'ob
ANO)*AL &I+PO+ITION
-7appene# upon unsucessful e(ecution of 'ob step1
12
5ELE*E 0 5ataset shoul# be #elete#
CA*L; 0 5ataset will be cataloge#
=<CA*L; 0 5ataset will be remo+e# from s%stem catalogs
>EE! 0 5ataset is to be )ept
E:AM!LE JCL 00F ""M9JOB JOB -E,@41,6>IS7<A E5596
""S*E!/ E:EC !;M8COB!O;
""I<.ILE 55 5S<8*ES*.;LOB.*EM!,
"" 5IS!8-<E&,CA*L;,5ELE*E1
In this e(ample ,

5IS!8-<E&,CA*L;,5ELE*E1
<E& 0 *ES*.;LOB.*EM! is not e(ists, it will be create#
CA*L; 0 =pon successful e(ecution of 'ob step, #ata set
will be cataloge#
5ELE*E 0 If 'ob terminicate# abnormall%, #ataset will be #elete#

3NIT PA)A*ETE)
In IBM Mainframe en+ironment, All #e+ices ha+e an a##ress assigne# to
them at the time the% a##e# to the s%tem. 5e+ices can be reference#
using this a##resses. =<I* parameter is use# to specif% thise a##ress.
S%nta( 0F =<I*8#e+icePa##ress"#e+icePt%pe"#e+icePgroupPname"*A!E

E:AM!LE JCL 0F ""M9JOB JOB -34?1,6>IS7<A E5596
""S*E!/ E:EC !;M8COB!O;
""I<.ILE 55 5S<8*ES*.;LOB.*ES*.LIB,
"" =<I*8S9S5A
In abo+e e(ample, COB!O; is e(ecute#, an# a file I<.ILE which ma%
resi#e on an% of the #e+ices which are groupe# un#er the s%mbolic name
S9S5A will be accesse#
:OL PA)A*ETE)
*his parameter is use# to i#entif% the +olume serial number on which
#ataset is resi#e. *he $OL #ataset is use# with #is) an# tape #atasets.
S%nta( 0F $OL8 +olumelabel"#ata set label
Sub parameters use# with $OL parameter
13
SE 0 Specification of serial number
E. 0 eferencing $OL specification from a prior step
!I$A*E 0 Allowing access to +olume b% single user
E*AI< 0 Inhibiting #ismounting of +olume until en# of 'ob
SEK 0 Specification of seEuence in which +olumes are to be mounte#
E:AM!LE JCL 00F ""M9JOB JOB -E4?41,6>IS7<A E5596
""S*E!/ E:EC !;M8COB!O;
""I<.ILE 55 5S<8*ES*.;LOB.*EM!,
"" $OL8SE8-$OL/,$OLD,$OL31
In this e(ample the #ata set calle# 5A*A3 resi#es on 3 +olumes whose
serial numbers are $OL/,$OLD,$OL3. *he Operating s%stem will reEuest
that all +olumes be mounte# at the same time.
+PACE PA)A*ETE)
*he S!ACE parameter is use# to allocate space for #atasets.
&e can allocate space in C%lin#ers"*rac)s"Bloc)s
S%nta( 0F S!ACE8-C9L,-primar%,secon#ar%,#irector%1,LSE,CO<*I;,M:I;,O=<51
Instea# of C9L, &e can use *> or BL>
Meaning of Sub !arameter

*> 0 eEuesting space in trac)
C9L 0 eEuesting space in c%lin#ers
!IMA9 0 !rimar% storage to be allocate# at the time of
#ata set create#

SECO<5A9 0 A##itional storage to be allocate# ,
If primar% storage is not sufficient
5IEC*O9 0 Space for recor#ing of name an# location of partitione#
#ata sets
LSE 0 eEuest for release of space pre+iousl% allocate# unuse#
space after completion of 'ob
CO<*I; 0 eEuest for contiguous space

M:I; 0 eEuest for large area# of contiguous space
O=<5 0 eEuest for entire c%lin#er for storage of #ata set
E:AM!LE JCL 0F ""M9JOB JOB -&34?1,6>IS7<A E5596
""S*E!/ E:EC !;M8COB!O;
""I<.ILE 55 5S<8*ES*.;LOB.LIB
"" =<I*84?,2
"" S!ACE8-C9L,-32,411
In this e(ample, 32 c%lin#ers are reEueste# as primar% space an# 4
14
a##itional c%li#ers as secon#ar% space.

9(to 15 e7tends of secondary s(ace ; in our e7am(le it is 4 < )ill be alloted , If s(ace is
not sufficient+


&C PA)A*ETE)

ecor#s in #ataset ma% contain .I:E5 length " $AIABLE length.
*he 5CB -5ata Control Bloc)1 parameter is use# to specif% recor#
format,recor# length, bloc) siOe etc..
S%nta( 0F ""##name 55 5CB8I parameters F
Subparameters in 5CB
EC.M 0 Specification of recor# format 0 .".B"$"$B"=
LECL 0 Specification of recor# length
BL>SIAE 0 Specification of bloc) siOe
B=.<O 0 Specification of buffers
E:AM!LE JCL 0F ""M9JCL JOB -E344?1,6AMES76
""S*E!/ E:EC !O;8COB!O;
""I<.ILE 55 5S<8*ES*.;LOB.LIB
"" =<I*8D34,
"" 5S<8-LECL8C2,
"" EC.M8.B,
"" BL>SIAE8C22,
"" B=.<O8321
In this e(ample, *he 5CB parameter specifies that this file is to
ha+e a logical recor# length of C2 b%tes, it will ha+e a fi(e# bloc)
recor# format, an# the bloc) will C22 -C22 is multiple of C21. *he
B=.<O parameter is set to 32, in#icating upto 32 buffers ma% be
utiliOe# in +irtual storage for this #ata set.

5efault buffers are ?,if %ou not specifie# an% thing

=hen you s(ecified > for !E:?3 (arameter, L!E:L *alue is larest record in the file
(lus 4 bytes+ These four bytes contain the actual lenth of each *ariable lenth record in
the file


15
SPECIAL DD STATEMENT
/. 5=MM9
5S<8<=LL.ILE
D. Concatenating 5ata sets
3. !assing #ata to cobol program using 0 S9SI< 55 B
4. S9SO=*
?. S9S=5=M!
,. S9SA5=M!
!2 &3**. or &+N-N3LL1ILE
Some times we nee# to testing of program, without using actual #atasets.
*hen we can use 5=MM9 or 5S<8<=LL.ILE.
If we use 5=MM9, operating s%stem simulates the presence of a file. &hen
%ou rea#ing Operating s%stem sen#s en# of file reEuest to program.
E(ample JCL 00F ""M9JOB JOB -&34?1,6>IS7<A E5596
""S*E!/ E:EC !;M8COB!O;
""I<.ILE 55 5=MM9
92 CONCATENATIN0 &ATA +ET+
In JCL , we can concatenate #ifferent files b% gi+ing their name one after
another. All #ata sets concate# must be of the same t%pe. .or e(ample,
partitione# #ata sets can be concatenate# onl% with partitione# #ata sets.
E(ample JCL 00F ""M9JOB JOB -&34?1,6>IS7<A E5596
""S*E!/ E:EC !;M8COB!O;
""I<.ILE 55 5S<8*ES*.;LOB..ILE/
"" 5S<8*ES*.;LOB..ILED
"" 5S<8*ES*.;LOB..ILE3

In program , we will rea# it as an single file. concatination of three
files #one b% operating s%stem.

3a7imum of 255 se@uential data sets can be concatenated toether
3a7imum of 1" (artitioned data sets can be concatenated toether



$2 PA++ &ATA TO COOL P)O0)A* 3+IN0 - +.+IN && ?
*his is the one of the wa% of passing #ata to program. *here are two
s%nta(6s to pass #ata.
S%nta(/ 0F ""M9JOB JOB -&D341,6AMES76
1"
""S*E!/ E:EC !;M8COB!O;
""S9SI< 55 B

"B
S%nta(D 0F ""M9JOB JOB -E34?1,6>IS7<A E5596
""S*E!/ E:EC !;M8COB!O;
""S9SI< 55 5A*A

"B

%2 +.+O3T
*he S9SO=* parameter is use# to sen# the output which is generate# #uring
'ob e(ecution.
S%nta( 0F ""##name 55 S9SO=*8class
E:AM!LE JCL 0F ""M9JOB JOB -4?,1,6>IS7<A E5596
""S*E!/ E:EC !;M8COB!O;
""I<.ILE 55 S9SO=*8A
In this e(ample, COB!O; is e(ecute# an# all generate# outputs
are #irecte# to class - here it is letter A1

If A used )ith &B&$9T ;&B&$9T6A< (arameter, The class assined to the
3&/:L-&& (arameter )ill be used to &B&$9T+


62 +.+3&3*P
1,
S9S=5=M! is use# to #ump the content of +arious registers, +ariables an#
#atasets acccesse# at the time of abnormal termination, into a #ataset.
*he #ump is in he(a#ecimal.

S%nta( 00F ""S9S=5=M! 55 .....
E:AM!LE JCL 00F ""M9JOB JOB -&34?1,6AMES76
""S*E!/ E:EC !;M8COB!O;
""S9S=5=M! 55 5S<8*ES*.!O5.LIB

/2 +.+AEN&
S9SABE<5 is use# to #ump the contents of +arious registers +ariables ,
#atasets accesse# an# T>e nucleus at the time of abnormal termination.
*he #ump is in he(a#ecimal.
S%nta( 00F ""S9SABE<5 55 .....
E:AM!LE JCL 00F ""M9JOB JOB -&E34?1,6>IS7<A E5596
""S*E!/ E:EC !;M8COB!O;

IN+T)EA* and CATALO0E& P)OCE&3)E+
/. Intro#uction
D. Instream !roce#ure
3. Cataloge# proce#ure
4. Mo#if% statements in a proce#ure
?. S%mbolic parameters
INT)O&3CTION
In JCL, &e ha+e an important concept reusabilit% in the form of
Instream an# Cataloge# proce#ures, Often, in wor) en+ironments
users can utiliOe# same JCL. =sing instream " cataloge# proce#ures
we can reuse the 'cl co#e which was store# in another #ata set, in
our #ata set.
S%nta( for E(ecuting proce#ure
00F E:EC M!OC8Nproce#ure0name
IN+T)EA* P)OCE&3)E
14
A JCL !roce#ure is a pre0written segment of co#e, that %ou can inclu#e
in %our JOB. 9ou co#e instream #ata set within the 'ob an# use it in
that 'ob as man% times as %ou want.
An Instream !roce#ure JCL E(ample

EXPLANATION
0 Instream proce#ure shoul# be #efine# , before an% E:EC statement #efine#

0 Instream proce#ure startes with !OC an# en#s with !E<5 statements
0 Instream proce#ure is e(ecute# when we main 'cl calle#.

The ma7imum number of instream (rocedures you can in any .ob is 15


CATALO0E& P)OCE&3)E+
!re0written segment of co#e -which is store# as an member of !5S1,
which %ou can use as man% times %ou want in an% 'ob in the s%stem.
IBM supplies a utilit% program calle# IEB=!5*EQ this program places
cataloge# proce#ures into partitione# #ata sets. *hese proce#ures
are place# insi#e a s%stem librar% calle# S9S/.!OCLIB.
5e+eloping Catalog !roce#ure
+TEP!@
&rite an Cataloge# proce#ure in M9LIB.E:AM!LES.*ES*-CA*ALO;/1
15
""CA*LO;/ !OC
""S*E!/ E:EC !;M8COB!O;
""I<.ILE 55 5S<8*ES*.;LOB.LIB,
"" 5IS!8S7
""O=*.ILE 55 5S<8*ES*.;LOB.S!ACE.LIB,
"" 5IS!8S7
+TEP9 @
&rite Main JCL which will call out CA*ALO;/ JCL
""M9JOB JOB -&ED341,6AMES76,CLASS8A
"" JCLLIB O5E8-M9LIB.E:AM!LES.*ES*1 I00 Attention
""S*E!/ E:EC CA*ALO;/ I00 Attention
""

EXPLANATION
0 &hen %ou e(ecuting CA*ALO;E5 !OCE5=E, If %ou not specifie#
where it is with JCLLIB statement , it will serach for this
proce#ure in s%stem proce#ure librar% S9S/.!OCLIB
0 *here man% IBM0supplie# proce#ures that compile, lin), an# run programs

#ob )ill search the #:LLI% libraries first, in the order in )hich theyCre coded+ If the
(rocedure is not found in any of the named libraries, &B&1+'!$:LI% is searched+



The follo)in statements cannot be included )ithin the (rocedure
#$%
DD A or DD D-T-
#E&2 or #E&3 control statements


*O&I1. +TATE*ENT+ IN A P)OCE&3)E

*here are times, when we want to change proce#ure statements accor#ing
to our reEuirement, IBM pro+i#e# a wa% without changing actual proce#ure,
we can a##"mo#if% contents of proce#ure. Let us #iscuss what are the wa%s
*here are two t%pes of mo#ification we can #o ,
/. on E:EC statement
D. on 55 statement

21
on EXEC statement

&e can #o following functions on E:EC statement in a proce#ure

0 *odi=; parameter on EXEC statements

!OCE5=E S*A*EME<* 0 ""S*E!/2 E:EC !;M8COB!O;,*IME832
!AAME*E O$EI5E 0 ""M9S*E! E:EC !OC8M9!OC,*IME.S*E!/2842
<ow esultant *IME +alue for that step -in proc1 is 42
0 Adding parameter to an EXEC statement / all EXEC statement
!OCE5=E S*A*EME<* 0 ""S*E!/2 E:EC !;M8COB!O;,*IME832
!AAME*E A55I<; 0 ""M9S*E! E:EC !OC8M9!OC,E;IO<.S*E!/28?,>
-for single step1
E;IO< will be a##e# to the S*E!/2 in M9!OC proce#ure
!AAME*E A55I<; 0 ""M9S*E! E:EC !OC8M9!OC,E;IO<8?,>
-for single step1
If E;IO< is not a+ailable for an% step in that proce#ure.
E;IO< will be a##e# to all steps in proce#ure. If E;IO<
is a+ailable for an% step in proce#ure, E;IO< +alue will
be o+erri#e e(isting +alue on that step.
0 Nulli=;ing t>e parameter Aalue
!OCE5=E S*A*EME<* 0 ""S*E!/2 E:EC !;M8COB!O;,*IME832
!AAME*E A55I<; 0 ""M9S*E! E:EC !OC8M9!OC,*IME.S*E!/28


5ont gi+e an% +alue for that parameter, it will nullif%ing
that parameter +alue in proce#ure

on && statement

0 +;ntaB =or add/modi=; && statements in a procedure
""name E:EC M!OC8Nproce#ure0name
""MprocstepnameN.##name 55 parameter8+alue
""
&e can #o following functions on E:EC statement in a
proce#ure using abo+e s%nta(
21
0 Mo#if% e(isting parameter on 55 statements within a proce#ure
0 A## parameter to e(isting 55 statement within a proce#ure
0 A## 55 statement to a 'ob step
0 <ullif% the effect of parameter on 55 statement in a proce#ure
+.*OLIC PA)A*ETE)+
=sauall%, the same JCL can be use# b% #ifferent programmers to
implement common tas)s, such as the opening, rea#ing, an# writing
of #ata sets. In those cases , we can use s%mbolic parameters.
=sing s%mbolic parameters we can pass +alue to a parameter which
is use# in proce#ure. A s%mbolic parameter on a 55 statement is
co#e# the parameter prece#e# b% an ampersan#.
S%nta( for assigning +alues to s%mbolic parameters in a proce#ure
""MnameN E:EC M!OC8Nproce#ure0name,s%mbolic0parameter8+alue
EXA*PLE JCL 0F !roce#ure which is using s%mbolic parameter

""M9!OC !OC
""M9S*E! E:EC !;M8COB!O;
""I<.ILE 55 5S<8H5OC..*ES*.LIB,5IS!8S7
""O=*.ILE 55 5S<8H5OC..*ES*.O=*,
"" 5IS!8-<E&,>EE!,5ELE*E1,
"" =<I*8S9S5A,
"" S!ACE8-C9L,-HS!ACE11
*he in+o)ing E:EC statement
""S*E!A/ E:EC M9!OC,5OC8M9LIB,S!ACE86/2,?6
*he effecti+e JCL
""M9!OC !OC
""M9S*E! E:EC !;M8COB!O;
""I<.ILE 55 5S<8M9LIB.*ES*.LIB,5IS!8S7
""O=*.ILE 55 5S<8M9LIB.*ES*.O=*,
"" 5IS!8-<E&,>EE!,5ELE*E1,
"" =<I*8S9S5A,
"" S!ACE8-C9L,-6/2,?611

EXPLANATION -
In abo+e e(ample, H5OC,HS!ACE are s%mbolic parameters in M9!OC proce#ure
&e are passing +alues from in+o)ing JCL,these +alue will be o+erri#e the
H5OC an# HS!ACE where e+er the% fin# in the proce#ure
22
0eneration &ata 0roups "0&0'
/. I<*O5=C*IO<
D. CEA*IO< O. ;5;
3. =SI<; ;5;
4. AL*EI<; ;5; 5E.I<I*IO<
?. 5ELE*I<; ;5;
,. IM!O*A<* !AC*ICAL K=ES*IO<S
!2 INT)O&3CTION
;eneration 5ata ;roups or ;5;s are a group of #ata sets which
are relate# to each other chronologicall% an# functionall%.
*hese relate# 5ata Sets share a uniEue 5ata Set <ame.
E+er% ;5; #ata set has a ;eneration number an# $ersion number assigne#
to each #ata set.
EXA*PLE 00 6M9LIB.LIB.*ES*.;222/$226
6M9LIB.LIB.*ES*.;222D$226
6M9LIB.LIB.*ES*.;2223$226 I00 Current $ersion
;eneration <umber 0F ;aaaa$nn
aaaa is between 2222 to GGGG
nn is between 22 to GG
In JCL, we refer current +ersion with 2 - E(. M9LIB.LIB.*ES*-21 1
new +ersion going to create with R/ - E(. M9LIB.LIB.*ES*-R/1 1
ol#er +ersions , refer with 0/ 0D 03 etc....
- E(. M9LIB.LIB.*ES*-0/1 1 I0 OL5E $ESIO<


23
EBample =or <>ere <e can use t>is 0&0s2

=suall%, In pro#uction en+ironment, for e+er% month we nee#
to run 'obs to create reports for that month.
Let us suppose for Januar%, &e can co#e it *.LI2LI2TE+T2JAN
for .EB, &e can co#e it *.LI2LI2TE+T21E
for MA, &e can co#e it *.LI2LI2TE+T2*A)


So , E+er% month we nee# change #ataset name in JCL, before
submitting the 'ob. &hene+er we enterre# into another %ear,
&e nee# to #elete ol# %ears #ata sets.
&e nee# to #o abo+e tas) carefull%, If we use ;5;, It will ta)e
care following things
0 It will maintain all generation of #ata sets
0 It will #elete"uncatalog ol#er generation
0 $er% easil%, we can refer current an# ol#er +ersions of #ata sets
0 <o nee# of change the JCL e+er% time when we submit
92 C)EATION O1 0&0
Before using ;5; , &e nee# to create ;5; in#e( an# mo#el.
I5CAMS -the 6AMS6 stan#s for Access Metho# Ser+ices1, utilit%
is use# to create ;5; in#e(.
EBample JCL =or creating 0&0 indeB
""M9JOB JOB -&D341,6AMES76
""S*E!/ E:EC !;M8I5CAMS
""S9SI< 55 B
5E.I<E ;5;-<AME-M9LIB.LIB.*ES*1 0
LIMI*-/21 0
<OEM!*9 0
SCA*C71
"B
""
In this e(ample, I5CAMS utilit% is use# to create an in#e(
for a ;5; calle# M9LIB.LIB.*ES*. *he number of generations
that can e(ist in this ;5; is limite# to ten. <OEM!*9 parameter
is use# to specif% , Once the limit is reache#, the s%stem is
instructe# to uncatalog the ol#est generation #ata set within the
;5;. SCA*C7 parameter is use# to specif% to ph%sicall% #elete
the #ata set which was uncataloge#.
PA)A*ETE)+ 4E CAN PA++ TO I&CA*+
24
<AME 0 *his parameter is use# to specif% the name of the
#ata set that is to be create#.
LIMI* 0 *his parameter is use# to specif% the the total number
of generations that the ;5; ma% contain
EM!*9"<OEM!*9 0 *hese two parameters are mutuall% e(clusi+e. EM!*9
specifies that all e(isting generations of the ;5;
are to be uncataloge# whe+er the generations of ;5;
reache# the ma(imum limit <OEM!*9 specifies that onl%
the ol#est generation of the ;5; is to be uncataloge#
if the limit is reache#
SCA*C7"<OSCA*C7 0 *hese two parameters are mutuall% e(clusi+e. SCA*C7
parameter specifies that whene+er entr% of the ;5; is
remo+e# from the in#e(, it shoul# be #elete# ph%sicall%
an# uncataloge#. <OSCA*C7 parameter specifies that
whene+er entr% of the ;5; is remo+e# from the in#e(, it
shoul# be uncataloge#, not ph%sicall% #elete#

&:!-T:D and 0$E3'TB are default (arameters


C)EATIN0 *O&EL
Once the in#e( has been create#, a mo#el #ata set must be create#.
*his mo#el #ata set contains specifications for the 5CB subparameters
for all #ata sets that will belong to that ;5;. !rogrammer can o+erri#e
this #efault +alues if he want.
EXA*PLE JCL
""M9JOB JOB -&GC31,6>IS7<A6
""S*E!/ E:EC !;M8I5CAMS
""S9SI< 55 B
5E.I<E ;5;- 0
<AME-M9LIB.LIB.*ES*1 0
LIMI*-/21 0
<OEM!*9 0
SCA*C71
""S*E!D E:EC !;M8IE.B/4
""MO5EL/ 55 5S<8M9LIB.LIB.*ES*,
"" 5IS!8-<E&,>EE!,5ELE*E1,
"" =<I*8S9S5A,
"" S!ACE-*>,21,
"" 5CB8-LECL8C2,EC.M8.B,BL>SIAE8C221
""
=sing IE.B/4, we ha+e create# the mo#el, <ow ;5; is rea#% to use, In
ne(t section %ou will learn how we will use this create# ;5;.


25
$2 3+IN0 0&0
*o use create# ;5; in our JCL, we nee# to use name
-with R/ for new generation1 which we use# in 5E.I<E
;5; comman#. -i.e. M9LIB.LIB.*ES*1
EXA*PLE JCL

""M9JOB JOB -S534?1,6>IS7<A E5596
""S*E!/ E:EC !;M8COB!O;
""I<.ILE 55 5S<8M9LIB.LIB.*ES*-R/1,
"" 5IS!8-<E&,CA*L;,5ELE*E1,
"" =<I*8S9S5A,
"" S!ACE8-*>,-D2,/21,LSE1,
"" 5CB8-MO5EL.5CB,EC.M8.B,
"" LECL8C2,
"" BL>SIAE8C221
""
*he program COB!O; is e(ecute#. A new generation #ata set is
create# +ia the statement
""I<.ILE 55 5S<8M9LIB.LIB.*ES*-R/1
Since we use# -R/1 with ;5; name, it creates a new generation
#ata set.
*he 5IS! parameter must be set to CA*L; for all new generation
#ata sets , 5IS!8-<E&,CA*L;,5ELE*E1
&e use# MO5EL.5CB in 5CB parameter to instruct s%stem to use
subparameters specifie# in mo#el ;5;.

The D&0 and 90IT (arameters must be coded for all ne) eneration data sets


%2 ALTE)IN0 0&0 &E1INITION
Some times there are situtations where we nee# to change the
attributes of ;5;. *hese t%pes of tas)s can be performe# using
AL*E comman#. &e will use I5CAMS utitlit% to alter ;5; attributes.

In last section, I ha+e create M9LIB.LIB.*ES* ;5; with <OEM!*9 SCA*C7
subparameters, now I want to change them to EM!*9 <OSCA*C7 respecti+el%.
7ere is the JCL that will #o thisS
""M9JOB JOB -&E34?1,6>IS7<A6
""S*E!/ E:EC !;M8I5CAMS
""S9S!I<* 55 S9SO=*8A
""S9SI< 55 B
AL*E M9LIB.LIB.*ES* EM!*9 <OSCA*C7
"B
2"
""

In this e(ample, the AL*E statement is use# to mo#if% the features of
the ;5; calle# M9LIB.LIB.*ES*. An% generations that ma% e(ist for that
;5; will now contain the mo#ifie# features as well. An% new generations
that are create# for this ;5; will now be create# base# on these new
features.

62 &ELETIN0 0&0

&e can #elete an generation of ;5; with IE.B/4, 7ere is the
JCL to #o that
""M9JOB JOB -E4?,1,6AMES76
""S*E!/ E:EC !;M8IE.B/4
""5EL/ 55 5S<8M9LIB.LIB.*ES*-21 I00 Current $ersion
"" 5IS!8-OL5,5ELE*E,5ELE*E1
""
In this e(ample JCL, the program IE.B/4 is e(ecute#. *he current
generation of M9LIB.LIB.*ES* is #elete#.

*o #elete ;5; in#e("generations , &e nee# to use 5ELE*E comman# in
I5CAMS utilit%. *here are two sub parameters we can use with 5ELE*E
comman#.

*he% are !=;E an# .OCE
!=;E sub parameter is use# in con'unction with 5ELE*E statement to
#elete the ;5; in#e(, e+en if its retention perio# has not e(pire#.
.OCE parameter can be co#e# on the 5ELE*E statement to #elete the
;5; in#e(, the mo#el, an# all relate# generation #ata sets, if the%
e(ist.

E:AM!LE JCL for .OCE
""M9JOB JOB -&D341,6>IS7<A6
""S*E!/ E:EC !;M8I5CAMS
""S9SI< 55 B
5ELE*E-M9LIB.LIB.*ES*1 ;5; .OCE
"B
M9LIB.LIB.*ES* ;5; in#e(, the mo#el an# all relate# generation #ata
sets will be #elete# upon successful e(ecution of this 'ob step.

3a7imum of 255 data sets e7ist )ithin one /D/
2,


/2 I*PO)TANT P)ACTICAL C3E+TION+
K. In m% JCL, In step/ I will going to create a new generation #ata
set for that i ga+e g#gname-R/1. In stepD I want to use same #ata
set create# b% pre+ious stepL what number i shoul# gi+e to refer that
#ata set -i.e 2 or R/ or RD 1L -S*E!/ E:EC=*E5 S=CCESS.=LL91
A. R/
K. &h%L
A. E+en step/ e(ecute# successfull%, It is not become the current generation
of ;5;. At the en# of the 'ob onl% it will become the current +ersion of ;5;.
So within the 'ob we nee# to refer it as new generation onl%, e+en that step
complete# sucessfull%.
Control Job Processing "I1 T,EN EL+E' in JCL
*here are two wa%s to control 'ob processing in JCL, One wa% is b%
co#ing CO<5 parameter either on JOB or on E:EC, Secon# wa% is ,
using I. con#ition.
In pre+ious chapters, we ha+e #iscusse# about CO<5 parameter on both
JOB as well as E:EC.
<ow let us #iscuss about I. con#ition in JCL
=sing I. construct is more powerful than CO<5.
0 *he CO<5 parameter on the first step of a 'ob is ignore#
7owe+er,the I. construct is teste#
0 &e can co#e s%mbolic parameters in the I. con#itions
0 &e can co#e man% t%pes of relational0e(pressions in I. con#ition
+;ntaB o= I1
""name I. I con#ition F *7E<
.
.
""name/ ELSE
.
.
"" E<5I.
*he con#ition -ralational e(pression1 consists ofS
Comparison operators
Logical operators
<ot -T1 operators
elational e(pression )e%wor#s.
24
EBample JCL
""E:AM!LE JOB
""S/ E:EC M9!OC/
""CO<52/ I. C 8 2 *7E<
""C2/O> E:EC M9!OCD
""CO<5E ELSE
""C2/ELS E:EC M9!OC3
"" E<5I.

EXPLANATION
In abo+e e(ample, S/ is first 'ob step
In 3 r# line, we chec) the ecturn co#e of S/ step
if return co#e is Oero then C2/O> step will e(ecute
else step C2/ELS will going to e(ecute
A >e%wor# List
Keyword Purpose
-%E0D Tests for an abnormal end of a (roram
E-%E0D
Tests that an abnormal end of a (roram did not
occur
-%E0D:: E7amines an -%E0D condition code
!: E7amines a return code
!90 Tests if a .ob ste( e7ecuted
E!90 Tests if a .ob ste( did not e7ecute
All the )e%wor#s can inclu#e a stepname an# procstepname to refine
the test to a specific 'ob step.
*he format is stepname.procstepname.keyword.
)C 0 chec)s a return co#e.
EXA*PLE JCLs
I. C 8 2 *7E<
I. S*E!/.C I /D *7E<
If %ou not gi+en the stepname, then the highest return co#e from all
'ob steps is ta)en for chec)ing.
AEN&CC 0 Chec)s an ABE<5 con#ition co#e
=sing ABE<5CC we can chec) S%stem"=ser completion co#es
EXA*PLE
25
I. ABE<5CC 8 S2C@ *7E<
Suppose %ou want to chec) error co#e of particular step,
gi+e stepnname.ABE<5CC, If %ou not gi+en the stepname,
most recent ABE<5 co#e that occure# is ta)en for chec)ing
AEN& 0 chec)s for an abnormal en# of a program
EXA*PLE JCL
I. ABE<5 *7E<
I. S*E!4.!OCAS2/.ABE<5 8 *=E *7E<
If %ou not gi+en an% stepname, all steps prior to this
con#ition will be chec)e#
)3N 0 to chec) whether a 'ob step e(ecute# or not
EXA*PLE JCL
Suppose there is a 'ob which contains S*E!D, S*E!3,S*E!4
I ha+e an if con#ition for S*E!D an# S*E!3, if con#ition
is true then S*E!D will be e(ecute#, If con#ition is false
then S*E!3 will be e(ecute#
I want to e(ecute S*E!4 if S*E!D e(ecutes,
we can co#e in the following wa%
""C7E2/ I. S*E!D.=< *7E<
""S*E!4 E:EC M9!OC/
"" E<5I.

Either the TDE0 clause or EL&E clause must contain at least one E8E: statement+


Bou can nest another I? construct after the TDE0 clause or the EL&E clause+ Bou can
nest I?/TDE0/EL&E/E0DI? statement constructs u( to 15 le*els of nestin+


)estarting and c>ecDpoint in Ecl
estarts are specifie# using the 5 an# ES*A* parameters.
*he 5 parameter is use# to reEuest an automatic restart of a
'ob if the 'ob fails.
*he ES*A* parameter is use# to specif% a restart point when
a 'ob is resubmitte#.
*he 5 parameter can be use# within JOB an# E:EC statements to reEuest
an automatic restart if the 'ob fails.
31

#$% !D $*errides E8E: !D

ES*A* is use# when we want to restart a 'ob from a step , when
it aben#e# in a step
estarting &hen the S%stem .aile# in a JESD S%stem

JESD reEueues the 'ob for e(ecution if ES*A*89 is in the JESD
"BJOB!AM statement e0e(ecution is from the beginning of the 'ob.
E(ample JCLS

""J3 JOB ,6. >IS7<A6
"BJOB!AM ES*A*89
.
.
estarting &hen the S%stem .aile# in a JES3 S%stem
If the 'ob was e(ecuting when the s%stem faile#, the .AIL=E parameter
on the JES3 ""BMAI< statement tells JES3 how to han#le the 'ob. *he
'ob can be restarte#, cancelle#, hel#, or printe# an# then hel# for restart.
E(ample JCLS
""J4 JOB ,6. >IS7<A6,58<C
""BMAI< .AIL=E8ES*A*
.
.
END O! T"TO#IAL
SORT TUTORIAL
ASSUMPTIONS
Before #iscussing about SO*,let us assume following things
Input file has following #ata an# structure
INP"T !ILE
MO7A<> D34D34D3434?34344 >IA<
MO7A<> /334D34?34?34?34? AJEE$
AAMES 34?3?34?3D?3?43D4 S=ES7
S=ES7 GC34@3C?3C?G33GC@ !=LI
AMES7 ,@?@?@CG@,GC@,@C? MA57=
>IS7< ?2C32G4C?32C?G342 OIIE5
>IS7< 324G?C4G?@DG3C4G? MA57=
31
S=ES7 GC34@3C?3C?G33GC@ !=LI
+imple +O)T Ecl structue is as =ollo<s 0000
.
.
""S*E!/2 E:EC !;M8SO*,E;IO<8/2D4>,!AM8parameters
""S9SO=* 55 S9SO=*8B Output messages from SO*
""SO*I< 55 5S<8...,5IS!8S7 Input if SO* reEuest
""SO*O=* 55 5S<8... Output for SO* reEuest
""SO*O.(( 55 5S<8... O=*.ILE output #ata sets
""SO*:S=M 55 5S<8... Output eliminate# b% the S=M stm
""SO*&>nn 55 =<I*8S9S5A, &or) files if SO* reEuest
""S9SI< 55 B Control statement input #ata set
sort control statements
"B
.
.
1OLLO4IN0 A)E T,E +O)TCA)&+ 1O) &I11E)ENT T.PE+ O1 +O)T+
TASK $% SO#T A &I'EN !ILE

""S9SI< 55 B
SO* .IEL5S8-/,3,C7,A,G,3,C7,A1
"B

O"TP"T !ILE
AAMES 34?3?34?3D?3?43D4 S=ES7
>IS7< 324G?C4G?@DG3C4G? MA57=
>IS7< ?2C32G4C?32C?G342 OIIE5
MO7A<> /334D34?34?34?34? AJEE$
MO7A<> D34D34D3434?34344 >IA<
AMES7 ,@?@?@CG@,GC@,@C? MA57=
S=ES7 GC34@3C?3C?G33GC@ !=LI
S=ES7 GC34@3C?3C?G33GC@ !=LI
EXPLANATION
Abo+e s%nta( of SO* sorte# the recro#s, #epen#s
on )e%s we ha+e pro+i#e#
-we ha+e pro+i#e# two )e%s in .IEL5S parameter1
.IS* >E9
/,3,C7,A 0 first )e% starte# at col / , its length is 3
32
SECO<5 >E9
G,3,C7,A 0 secon# )e% starte# at col G, its length is 3
In the abo+e e(ample,
C70 means character we ma% use BI for binar%
A 0 Ascen#ing or#er

TASK (% ELEMINATE D"PLICATES
""S9SI< 55 B
SO* .IEL5S8-/,3,C7,A1
S=M .IEL5S8<O<E
"B

O"T!ILE
AAMES 34?3?34?3D?3?43D4 S=ES7
>IS7< ?2C32G4C?32C?G342 OIIE5
MO7A<> D34D34D3434?34344 >IA<
AMES7 ,@?@?@CG@,GC@,@C? MA57=
S=ES7 GC34@3C?3C?G33GC@ !=LI
EXPLANATION
if we gi+e S=M .IEL5S8<O<E it will eliminate #uplicates
TASK )% SPLIT !ILE INTO T*O O# T+#EE !ILES DEPENDS ON CONDITIONS
.
.
.
""SO*O.2/ 55 5S<85.CD.$E<2@.;LOB...B.S.ILE4,
"" 5IS!8-<E&,CA*L;,5ELE*E1,=<I*8S9S5A,
"" S!ACE8-C9L,-/,41,LSE1,
"" 5CB8-EC.M8.B,LECL8C2,BL>SIAE821
""SO*O.2D 55 5S<85.CD.$E<2@.;LOB...B.S.ILE?,
"" 5IS!8-<E&,CA*L;,5ELE*E1,=<I*8S9S5A,
"" S!ACE8-C9L,-/,41,LSE1,
"" 5CB8-EC.M8.B,LECL8C2,BL>SIAE821
""SO*O.23 55 5S<85.CD.$E<2@.;LOB...B.S.ILE,,
33
"" 5IS!8-<E&,CA*L;,5ELE*E1,=<I*8S9S5A,
"" S!ACE8-C9L,-/,41,LSE1,
"" 5CB8-EC.M8.B,LECL8C2,BL>SIAE821
.
.
.
""S9SI< 55 B
SO* .IEL5S8CO!9
O=*.IL .ILES82/,I<CL=5E8-/,,,C7,EK,C6MO7A<>61
O=*.IL .ILES82D,I<CL=5E8-/,,,C7,EK,C6S=ES761
O=*.IL .ILES823,I<CL=5E8-/,,,C7,EK,C6>IS7<61
"B

SO#TO!,$
MO7A<> D34D34D3434?34344 >IA<
MO7A<> /334D34?34?34?34? AJEE$

SO#TO!,(
S=ES7 GC34@3C?3C?G33GC@ !=LI
S=ES7 GC34@3C?3C?G33GC@ !=LI

SO#TO!,)
>IS7< ?2C32G4C?32C?G342 OIIE5
>IS7< 324G?C4G?@DG3C4G? MA57=
EXPLANATION
/. SO* .IEL5S8CO!9 0 in#icate , it for cop% of recor#s, not for sort
D. O=*.IL .ILES82/,I<CL=5E8-/,,,C7,EK,C6MO7A<>61
O=*.IL .ILES82D,I<CL=5E8-/,,,C7,EK,C6S=ES761
O=*.IL .ILES823,I<CL=5E8-/,,,C7,EK,C6>IS7<61

0 S9<CSO* will ta)e #ata from /st positionn to ,th position of input
file an# it will compare that #ata with MO7A<> or S=ES7 or >IS7<

0 If #ata eEuals to MO7A<> then that recor## will copies to #ataset #efine#
in SO*O.2/ step. - because we #efine# .ILES82/ in secon# con#ition 1
0 If #ata eEuals to S=ES7 then that recor## will pass to #ataset #efine#
in SO*O.2D step. - because we #efine# .ILES82D in secon# con#ition 1
0 If #ata eEuals to >IS7< then that recor## will copie# to #ataset #ifne#
in SO*O.23 step. - because we #efine# .ILES823 in thir# con#ition 1
34
TASK -% COP. ELIMINATED D"PLICATES INTO ANOT+E# !ILE
.
.
""SO*:S=M 55 5S<85.CD.$E<2@.;LOB...B.S.ILEC,
"" 5IS!8-<E&,CA*L;,5ELE*E1,=<I*8S9S5A,
"" S!ACE8-C9L,-/,41,LSE1,
"" 5CB8-EC.M8.B,LECL8C2,BL>SIAE8C221
.
.
""S9SI< 55 B
SO* .IEL5S8-/,3,C7,A1
S=M .IEL5S8<O<E,:S=M
"B

SO#TO"T
AAMES 34?3?34?3D?3?43D4 S=ES7
>IS7< ?2C32G4C?32C?G342 OIIE5
MO7A<> D34D34D3434?34344 >IA<
AMES7 ,@?@?@CG@,GC@,@C? MA57=
S=ES7 GC34@3C?3C?G33GC@ !=LI

SO#TXS"M
>IS7< 324G?C4G?@DG3C4G? MA57=
MO7A<> /334D34?34?34?34? AJEE$
S=ES7 GC34@3C?3C?G33GC@ !=LI
EXPLANATION
/. SO* .IEL5S8-/,3,C7,A1
Input file will be sorte# #epen#ing up on the )e% specifie# abo+e
/,3,C7,A 0 )e% starting position is / an# length 3, comparing t%pe
character, sorting is #on in ascen#ing or#er
D. S=M .IEL5S8<O<E,:S=M
S=M .IEL5S8<O<E means it will eliminate #uplicates
:S=M options will cop% all recor#s eliminate# in sort
process will cop% to another #ata set #efine# in
SO*:S=M step

35
TASK /% COP. #ECO#DS DEPENDIN& "PON CONDITION
""S9SI< 55 B
SO* .IEL5S8CO!9
I<CL=5E CO<58-/,,,C7,EK,C6S=ES761
"B

O"TP"T!ILE
S=ES7 GC34@3C?3C?G33GC@ !=LI
S=ES7 GC34@3C?3C?G33GC@ !=LI
EXPLANATION
abo+e car# is to cop% recor#s from input file which
contains S=ES7 at /st position
TASK 0% !O#MATIN& A !ILE 1"SIN& IN#EC2
""S9SI< 55 B
SO* .IEL5S8CO!9
I<EC .IEL5S8-@SD,?,D2S/2,31
"B

O"TP"T !ILE
O7A<> 34D
O7A<> 334
AMES 4?3
=ES7 C34
AMES7 @?@
IS7< 2C3
IS7< 24G
=ES7 C34
EXPLANATION
/. SO* .IEL5S8CO!9
It is for cop% recor#s to output file
3"
D. I<EC .IEL5S8-@SD,?,D2S/2,31 -for formatting1
7ere we ha+e two formattings,
/. @SD,? 0 #ata at Dn# position of input file with length ?
copie# to @th position of output file
D. D2S/2,3 0 #ata at /2th position of input file with length 3
copie# to D2th position of output file
In abo+e e(ample, we can use O=*EC instrea# of I<EC,
I<EC a##s, #eletes, or reformats fiel#s before the
recor#s are sorte# or merge#. so that performance will
be impro+e#
O=*EC a##s, #eletes, or reformats fiel#s after the
recor#s are sorte# or merge#.
Ot3er parameters we 4an pass w5t3 sort 4ard
+5IP)EC-n
causes sort to s)ip o+er 6n6 recor#s in the input file before
starting a sorting or cop%ing operation.

+TOPA1T-n
causes sort to stop after 6n6 recor#s in the input file ha+e
been sorte# or copie#.
Be6ow are su44ess7u66y e8e4uted SO#T 4ards
T35s 5s pro95ded 7or re7eren4e 1no e8p6anat5on 5s :59en2
/.
SO* .IEL5S8CO!9
O=*.IL .ILES8/,
I<CL=5E8-C/,D,C7,EK,C6;M61
O=*.IL .ILES8D,
I<CL=5E8-C/,D,C7,<E,C6;M61
D.
SO* .IEL5S8-/,/,,C7,A1
O=*EC .IEL5S8-/S/,/2,C6226,/3S//,D,1
3.
3,
SO* .IEL5S8CO!9
I<CL=5E CO<58-//2,C,C7,EK,C6 61
O=*EC .IEL5S8-/S4?,/@,/CS@C,C1
4.
SO* .IEL5S8CO!9
OMI* CO<58-/2,/D,C7,EK,C62D,4C2/2/?2G6,O,
/2,/D,C7,EK,C6G?G333/2//@G61
?.
SO* .IEL5S8CO!9
O=*.IL .ILES82/,
I<CL=5E8-?,D,C7,EK,C6D/6,O,
?,D,C7,EK,C6GD6,O,
?,D,C7,EK,C6,C6,O,
?,D,C7,EK,C6,,6,O,
?,D,C7,EK,C6426,O,
?,D,C7,EK,C6G/6,O,
?,D,C7,EK,C6336,O,
?,D,C7,EK,C6@@6,O,
?,D,C7,EK,C6@,6,O,
?,D,C7,EK,C6236,O,
?,D,C7,EK,C6GC6,O,
?,D,C7,EK,C62D6,O,
?,D,C7,EK,C6DD6,O,
?,D,C7,EK,C64?6,O,
?,D,C7,EK,C6?C6,O,
?,D,C7,EK,C6,/6,O,
?,D,C7,EK,C6,@6,O,
?,D,C7,EK,C6,G6,O,
?,D,C7,EK,C6@26,O,
?,D,C7,EK,C6CD6,O,
?,D,C7,EK,C6C36,O,
?,D,C7,EK,C6G,61
O=*.IL .ILES82D,
I<CL=5E8-?,D,C7,EK,C6?36,O,
?,D,C7,EK,C6?46,O,
?,D,C7,EK,C6G46,O,
?,D,C7,EK,C6436,O,
?,D,C7,EK,C64/6,O,
?,D,C7,EK,C64D6,O,
?,D,C7,EK,C6446,O,
?,D,C7,EK,C62/6,O,
?,D,C7,EK,C6246,O,
?,D,C7,EK,C6??6,O,
?,D,C7,EK,C6?@6,O,
?,D,C7,EK,C64,6,O,
?,D,C7,EK,C6?26,O,
?,D,C7,EK,C63/6,O,
?,D,C7,EK,C63D6,O,
?,D,C7,EK,C6C461
,.
SO* .IEL5S8CO!9
34
O=*.IL .ILES8/,E<5EC8/222
O=*.IL .ILES8D,S*A*EC8/22/,E<5EC8D222
O=*.IL .ILES83,S*A*EC8D22/,E<5EC83222
O=*.IL .ILES84,S*A*EC8322/,E<5EC84222
O=*.IL .ILES8?,S*A*EC8422/,E<5EC84?22
O=*.IL .ILES8,,S*A*EC84?2/,E<5EC84,22
O=*.IL .ILES8@,S*A*EC84,2/,E<5EC8?222
@.
SO* .IEL5S8-/,/2,C7,A1
I<CL=5E CO<58-43,D,C7,EK,C6AC61
I<EC .IEL5S8-/S//,/2,//S43,D1
S=M .IEL5S8<O<E
JCT JOB CONTROL LANGUAGE SIMPLE TUTORIAL
C7A!*E0/ I<*O5=C*IO< *O JCL -for #ummies1
C7A!*E0D JOB SA*A*EME<*
C7A!*E03 JOBLIB"S*E!LIB
C7A!*E04 E:EC S*A*EME<*
C7A!*E0? COMMO< !AAME*E I< BO*7 JOB A<5 E:EC S*A*EME<*S
C7A!*E0, 55 S*A*EME<*
C7A!*E0@ S!ECIAL 55 S*A*EME<*S
C7A!*E0C I<S*EAM an# CA*ALO;E5 !OCE5=ES
C7A!*E0G ;eneration 5ata ;roups -;5;1
C7A!*E0/2 Control Job !rocessing -I. *7E< ELSE1 in JCL
C7A!*E0// estarting an# chec)point in 'cl
Prepared By; C%Kumaresan % MCA
35
41

You might also like