You are on page 1of 25

MAT SOFTWARE SOLUTIONS SRINIVAS.

C
#408,PAVANI PRESTIGE,AMEERPET.
CONTACT NO:040-55462382

Job Controlling Language


Usage of JCL:-
1. Compiling Batch & Online programs
2. Execution of Batch programs only
3. To integrate program
4. To pass data from one program to another
5. To pass data from one system to another
6. To pass data to main server
7. To create/rename/delete files
8. To sort data
9. To take the data from the user
10. To create VSAM files
11. To create Generation Data Groups
12. To copy data from one dataset to another
13. To crate/Delete temporary files
14. To execute predefined programs
JCL program sheet
Identifier Name of job operands parameters
………………………………………………………………..
// Job name Job positional keywords
// Activity Exec
// DD name DD

Note: - 1Exec = 255 DD’s, 1Job= 255 Exec’s.


Names:-1 Job name - 1 to 8 alphanumeric with national (@,#,$) symbols
2 Activity names – 1’st character must be alphabet/national symbol
Operands:-
1. Job :- task collection of sub tasks
2. Exec :- Activities (one job can have 255 Exec)
3. DD :- DD names data sets (one Exec con have 255 DD’s)

Parameters:-
(I) Job parameters:-
1. Positional: - (1 to 20 alphanumeric)
These parameters are mandatory which must be coded after operands with minimum one
task.
All positional parameters must be coded in predefined order.
Types:-
a) Accounting info:- this parameter must be coded first immediate after the
operand. This must consists of 1 to 20 alphanumeric characters.
This is used to record JOB CPU TIME of IBM server & this is used for billing
purpose
b) Program name: - this is second positional parameter at Job level which must be
coded after accounting info. Separated by comma, which can be used for
documentation purpose, this must be coded with 1-20 alphanumeric & also it can
be user defined.
2. Keyword parameter:-
A=40 min
B=70 min
C=2 hrs
…..
Z=15 hrs
0= 40 min
1= 1hrs
2= 3 hrs
…….
9= 19hrs.
All keyword parameters are optional which are coded depending on requirement
after the positional parameters, separated by comma

Types:-
a) Class: - This is used to categorize the job based on the CPU utilization.
Class= {0-9, A-Z} or predefined in the system
If the class is ignored/ not coded the default class parameter will be assumed
depending on the installation
Note: - Default parameter can be got from the operator.
Class parameter must be coded always in the Job level.
b) Prty :- (priority parameter). This is a keyword parameter, which can be coded
anywhere after positional parameter which is used to set the priority to the Job.
PRTY= 0-15 /14
0= Low priority
14= High priority.
c) MSGCLASS: - this is a keyword parameter can be coded anywhere after positional
parameter. This is used to route system related messages to the specified destination. This
will be decided at the time of installation destinations are
DISK/TAPE/PRINTER/SPOOL.
In any mainframe system messages related to DD/Exec/JOB are routed
SPOOL/DEVICES/PRINTER default is the SPOOL
A………I –disk
J……….M-printer
Q………Z- tape
Spool: - this is system defined dataset and it is created by MVS O/S. in general the
default destination is SPOOL

d) MSGLEVEL: - MSGLEVEL = (statement, MSGS)


Statement:-
Only job related ---0
All -------------------1
Input allocation/termination –2

MSGS :-
0---Abnormal termination
1---Normal termination
Default (1, 1)
This is a keyword parameter which is used to control volume of the messages as per the
requirement. MSGLEVEL parameter has 2 sub parameters which are positional
parameters. Those are.

Statement: - this is used to specify types of msgs Consists of


0: job related
1: all (job/activity/allocation/termination messages
2: allocation/termination/catalog procedure messages

MSGS: - this specifies the statues of the job which consists of


0: Abnormal termination
1: Normal termination/abnormal termination

e) Typrun:- this is another keyword parameter which is used to check the syntax errors
of JCL must be coded at job level
To check syntax errors (TYPRUN= SCAN)
To check execute JCL (TYPRUN=RUN)
Used to hold the job and release to the O/S based on priority (TYPRUN=HOLD)
JCL syntax errors can also be checked by using control list language (CLIST) command
CLIST is similar to JCL this is used to generated tools and also used for syntax errors of
JCL
When hold is specified in on line peg, MVS is going to place all jobs in queue
which is a dataset crated by o/s and depending on priority the job is going to be released

Command prompt: JCK! Or JEM or JSCAN


This is developed in control list developed by IBM. These are selected depending
installation
MACC= 00 no errors
04 warning
08 errors
12 sever error
16 permanent errors
f) Notify: - this is a keyword parameter this is used to notify messages or status if the
job to the user
NOTIFY= &SYSUID
This is used to notify the messages to the user who submits the job always must be coded
at job level
* JOB CARD:-
Consists of jobname, job operands, and positional parameters keyword
parameters. When JOBCARD is typed in CP: _ that it is going to create a JCL peg at job
level with default values. This is done only when this facility is available
(II) Activity parameters:-
a) PGM: - this is a positional parameter which must be coded after Exec with one blank.
This parameter indicates the name of the program/utility of IBM
b)PARM :-
There are two ways to pass data
Method I: using PARM: - this is a keyword parameter at activity level must be coded
with Exec operand after PGM parameter. This parameter allows max (100) characters.
They consist of predefined text/system defined commands.
The PARM parameter can be used to pass data to user/system defined programs
To receive PARM parameter data, COBOL peg, must be coded with “PROCEDURE
DIVISION USING PARAMETERS” option. These parameters must be declared in the
linkage section.
JCL:
// step001 exec PGM=cob001, PARM=”2004-10-10 date”(max 100 characters, no
separator is coded and size in Cobol is only the separator)
COBOL:
DD
Linkage section
01 x pic x(10). 01 y pic x(10)
d division using x,y.
1001-para
display x,y - date 2004-10-10
stop run
method II :-

SYSIN DD * :-
SYSIN is a system defined DD name and * is the positional parameter off DD. This is
used to pass data to COBOL peg/ to pass system defied commands to system defied pegs.
SYSIN DD * INSTREAM data must always be terminated with /*
Any number of records/data/character must be declared in W S S
One row in SYSIN DD * is equivoque to one accept statement
JCL:
//step001 Exec PGM=cob001
//sysin DD *
[2004-10-10
………….
………….]
/*
//(terminator/end if JCL)
cobol:-
W.S.S
01 ws=data1 pic x(10)
01 ws=data2 pic x(10)
PD
1000-para
accept ws-data1
accept ws=data2

(* if accept coded in cobol then SYSIN DD * must be coded in JCL


* if SYSIN DD * coded it is not mandatory to coded accept ).

CA 7:- (computer associates)


This tool/package can be used to schedule jobs or can be used to submitting/organizing
the jobs or can be used to cancel the jobs.
This is again a setup consists of panels which in thus provides difficult options for
submitting the jobs, for organizing the jobs and for cancellation of jobs also.

(III) DD parameters:-
a) * :- positional parameter at DD level used only with SYSIN. To pass data to the
COBOL programs this is known as instream data any number of records can be
passed to the peg.

b) DSN :- keyword parameter at DD level.


Ex:-
JCL:-
//job001
//step001 Exec PGM=cob001
// X DD DSN= userid.source.psname1, unit =disk/tape
// AB DD DSN=userid.source.psname2, unit =disk/tape
COBOL:-
select cust-file assign to X
select cust-file assign to AB

c) DISP: - used to identify the mode of the file


DISP :- ( Status, normal, abnormal)

Status:
NEW:- creating the dataset first time
OLD:- already created. Accessing the dataset all resources are allocated exclusively. No
other user can access until ti is released by the current user. If dataset does not exist this
creates.
SHR:- the dataset can be accessed by multiple users at a time
MOD:- appending the records to the existing records
Adv:- if dataset is not existing, then MOD is assumed as NEW and writes records to the
dataset.

Normal:- all the parameters of normal are active when the job executes successfully
Delete:- dataset is deleted when job executes successfully
Keep:- it keeps dataset in system. But it doesn’t create any reference in catlg
Catlg:- when job terminates successfully it is going to create an index by a referencing
name specified in volume label. This keeps dataset
Eg: catlg: volume 4
Uncatlg:- it resides in system, but it deletes volume label name form catlg like KEEP.
Pass:- to pass dataset to subsequent steps

Abnormal:-
Delete:- deletes
Keep:- keeps in system
Catlg:- creates index in catlg
Uncatlg:- delete index from catlg

Default: DISP = (new, Del, Del)

Reusable components in JCL: instream procedure


//job001 job(xyz), ‘abc’ class= L MSGclass=D, MSGLEVEL=(1,1),
notify=&sysid
//proc001 PROC  procedure reusable component.
//step001 Exec PGM=cob001
//I1 DD DSN=use.input, disp=SHR
//I2 DD “ “ “ “= OLD
// PEND
//step002
//
//step100 Exec PROC001

How to change parameters in procedure (instream)

//job001 job(xyz), ‘abc’ class= L MSGclass=D, MSGLEVEL=(1,1), notify=&sysid


//proc001 PROC  procedure reusable component.
//step001 Exec PGM=cob001
//I1 DD DSN=use.input, disp=SHR
//I2 DD “ “ “ “= OLD
// PEND
//step002
//
//step100 Exec PROC001
//step001 DD DSN=op2 disp=NEW
** instream procedure is available only for the job in which it is declared. For using in
other jobs: Global declaration

what is the difference between symbolic & overriding parameters

Symbolic :-
1. these parameters are used in catlg procedures
2. these parameters always must be coded prefix with single &
Overiding:-
1. overriding parameter is used in instream procedures
2. stepname must be used as DD name

Restart:-
Restarting a program which is abounded at some step-step0020 (step0019 are executed
already )
RESTART= stepname
When job is submitted first it is going to check for restart.
If temp dataset is created in step0018 after abounding, the temp dataset is refreshed if
restart is coded as step0020, it gives error: Temp dataset not available so code RESTART
= step0018.
Note: - restart must be always coded in the spool only not in the jcl peg.

c) Space:- this is a keyword parameter in DD operand can be coded any where after
DD operand. This is used to request the storage space for the dataset as per the
requirement. The storage space is divided in to primary and secondary for effective
storage space utilization. RLSE parameter is used to release the unused storage space
upon the successful / unsuccessful termination of the job
1) CYLINDERS, BLOCKS, TRACKS AND RECORDS:-different types of storage
2) PRIMARY:- this is the primary which is allocated to the data set while creating
3) SECONDARY: this is additional memory allocated in addition to the primary memory
4) RLSE:- releases the unused space when peg terminates successfully/unsuccessfully.

SPACE=(TRK,(10,10), RLSE)

c) Data Control Block: -


This contains the following keyword parameters used to specify file attributes.
LRECL: - logical record length =100 fixed length/ variable length.
BLKSIZE:- block size (LRECL * 10)
RECFM: - f & fb= fixed length
V & vb= variable length
f/fb LRECL=100.
v/vbLRECL=maxlength + 4

DSORG:- ps/po(pds) (dataset organization)


Po: partition organization
Pds: partitioned dataset
Ps: physical sequent ional file

FBA- fixed block attribute


VBA- variable block attribute

Printer: - 1 byte attributes character (system defined)


0 – line
1 – Page
The record length for a printer it should 1+132=133
To print the data, record length must be 132 +| 1. Printer control character
DCB= (LRECL=133, blksize= 133 * 10, RECFM=fba, DSORG=ps)

Ps/pds created
// job001
//
//step001 Exec pgm=cob001
//C1 DD DSN=user.souce.data, disp=old
//SYSIN DD *
record 1
……….
…….
………
/*
//

cob001
select cust-file assign to C1
FD cust-file
……………..
……………..
Note: - if file attribute of logical record are not matched with JCL- DD- DCB
parameters then it will be generated errors. Always there must a match in the FD
block of logical record with the DCB parameter of physical record.

IEFBR14:-
Used to create NILL dataset if creates a new pds/ps
This is a null peg can be used to create/delete physical sequential ddataset
dynamically this is the IBM supplied utility
For creating : disp=(new, catlg, delete)
For deleting : disp=(mod, delete, delete)

Copying from ps to ps
1. ispf 3.3
2. using cobol & jcl
cobol : cob001
i-o section
file control
select input assign i1
select out assign o1

D.D
Fd in1
01 in-rec
fd out1
01 out-rec

P.D
Open input in1
Open output out1

Perform until EOF


Read in1
Write out1
End-perform

Close in1
Close out1

JCL:- job001
//job001 job
//step001 exec pgm=cob001
//i1 DD dsn=user.source.in1.disp=shr
//o1 DD “ “ .out1 “ “
//sysout DD sysout =*
//sysprint DD ””””
//

Using IBM utility for copying ps

//job001 job(xyz), ‘abc’ class= L MSGclass=x, MSGLEVEL=(1,1),


time=(1,1) reglon=look,type run= run, notify=&sysid
// act001 exec pgm=IEBGENER
//sysout DD DSN=user.sour.data.ps1, disp=shr
//sysout DD DSN=user.sour.data.ps2 disp=old
//sysout DD sysout=*
//sysprint DD sysput=*

IEBGENER:- this is a IBM supplied utility. This is used to copy the data from one
sequential file to another. The DD name must b e SYSut1 and SUSut2.
This can also be used to send reports to one or more users mail ids
Can also be used to send reports to printers

Data Set Concatenation: - copy multiple files


The multiple dataset can be concatenated by specifying single DD name and multiple DD
operands
Rules:- all datasets file attributes must be same
All data files must be stored in one device
Note : maximum 255 ps,s can be concatenated
Maximum 15 pds’s cam be concatenated

//job001 job(xyz), ‘abc’ class= L MSGclass=x, MSGLEVEL=(1,1),


time=(1,1) reglon=look,type run= run, notify=&sysid
// act001 exec pgm=IEBGENER
//sysut1 DD DSN=user.sour.data.i1, disp=shr
// DD DSN=user.sour.data.i2 disp=old
// DD DSN=user.sour.data.i3 disp=old
//sysut2 DD DSN=user.sour.data.o1, disp=shr
// DD DSN=user.sour.data.o2 disp=old

//sysout DD sysout=*
//sysprint DD sysput=*
//

Note: many ps can be copied to one ps only multiple out ps’s cannot be copied

Copying members of one pds to another

// job001 job(xyz), ‘abc’ class=A


//step001 exec pgm=IEBGCOPY
//sysut1 DD DSN=user.sour.data.prod.cobol, disp=shr
//sysut2 DD DSN=user.sour.data.dev.cobol, disp=old
//sysin DD *
copy indd=userid.source.prod.cobol/sysut1
outdd=userid.source.dev.cobol/sysut2

IEBCOPY:
This is a utility supplied by IBM which can be used to copy data from pds to another pds
and ps to ps and tape ot ps and COMPRESS
The copy command must be used in sysin dd * to copy members
Select command can be used to copy selected members
Executed command is used to copy all excepted members specified

Sorting ps:-
1. internal sorting
2. external sorting : utilities: /SORT/ICETOOL/SYNCSORT/DFSSORT/ICEMEN.

//job001 job(xyz), ‘abc’ class= L MSGclass=x, MSGLEVEL=(1,1),


time=(1,1) reglon=look,typrun= run, notify=&sysid
//step001 exec pgm=IEBGCOPY
//sysin DD DSN=user.sour.data.prod.cobol, disp=shr
//sysout DD DSN=user.sour.data.dev.cobol, disp=old
//sortwk01 DD space =(cyl,(1,1), rlse), unit =(disk)
//sortwko2 DD spaced(b2 (1,1),rlse), unit = disk.
//sysin DD *
sort fields=(starting position, length, datatype,{ASC,DES}, HX,a/d)
work files: while sorting on JCL
identify inputfile, output file &work files

MERGE: is to be used then changes : if 3 files to be merged then


// sortin1 DD dsn
//sotrin2 DD dsn
//sortin3 DD dsn
//sortout DD
//sysin DD *
merge fields=(startingpos, length, datatype, a/d)
/*
//

Dummy parameter:-
The files of COBOL which are not needed to compiled, because those files are not
changed only some files are changed then we have to make them logically unavailable to
the compilation. This can be done by Dummy parameter
This is system defied parameter which can be used to create/ delete datasets dynamically
by the o/s i.e. this data set is available only during the program execution. Dummy must
be specified in the DD operand or dsn=nullfile can be used
use |: to test the cobol program/ to improve program performance at the time of testing .
to simplify the testing process.
Any number of dummy parameters can be used as per the requirement.

Spool commands:
c- job cancellation
p – pvs page //p
a- to release the hold job from the queue
?- to open the states of job
highest job no- latest job no allocated by the o/s automatically depending on the
requirement.

Write the differences between dummy and temp.

Dummy:-
1. this is a null file /do nothing file
2. this data set cannot be passed to subsequent steps
3. this can be used to test the application program
4. no dcb,space parameters can be coded
5. any no of dummy ds can be coded in one job
6. dummy must be coded with dummy parameter
Dsn=nullfile
Temp file:-
1. This file is created by o/s dynamically and deleted after completion of job
2. This can be passed to subsequent steps
3. Can be used to test application programs
4. Dcb and space parameter can be coded
5. Any no of temp ds can be coded in one job
6. This must be coded with prefix && and any user defined name.

Joblib and Steplib

Joblib:-
This is system defined library/ds which can be used to locate the all the object programs
which are specified.
Must be coded immediately after the job
Only one joblib must be coded in one job

Step lib:-
This is system defined dataset which can be used to locate the object peg at activity level
Can be coded any where in the step
Multiple steplibs can be coded in one job

When both are coded steplib overrides joblib

Sending data to mail server:-


One pds subjects: userid.source.subject(sub001)
One pds mailids : userid.source.mailids(mailid001)

Ip address: 3.14.256.33 or ravi@yahoo.com


Printer id = rmt001
Destination is used to route output to a specific destination may/may not be in a
remote location
To pc: destination/filename
Usreid& password
Dest=rmt/ uhhh/nzzz/local/name

To server:
// mailid01 job
//act001 exec pgm=IEBGENER
//sysut1 DD dsn=userid.source.cust.data, disp=shr,
//sysut2 DD dsn=” “ mailed(mailid01),disp=old.
//” “ “ subject(subj01), disp=old
//
//sysin DD *
3.45.256.36
/*
//

To printer:
//printer1 job job output prid=rmt004
//act001 DD dsn=userid.source.cust.data, disp=shr,
//systu1 DD dest=(a, prid)
//

To pc:-
//pssystem job
//act001 exec pgm=FTP
//sysut1 DD dsn=user……………….
//output DD *3.23.2365
userid
password
put sysut1+ c:/pc/cust-file
out1
/*
//

How to submit jcl from cobol

// job001 job
//step001 exec pgm=cob002
//i1 DD dsn=…….data.input,disp=shr
//o1 DD “ “ “ .output,disp=shr.

//job002 job
//step001 exec pgm=cob001
//o1 DD dsn=user.source.jcl, disp=shr
//step002 exec pgm=IEBGENER
//sysut1 DD dsn=user.sour.jcl, disp=shr
//sysut2 DD dest=(x,intrdr)
COND:- this is a keyword parameter this can be coded at job level and activity
levels. This will be applicable to all the activities which are coded in the job. Previous
step rc will be checked to execute subsequent steps when cond is and coded.
Cond=(return code, relational operator)

Cond=(RC, RO, Stepname).

Return codes are system defined from 0-4095.


Some are 00:successful
04:warning
08:error
12:seviour error
16:permanent error.

IF statements:-
//jbo001
//step001 exec pgm=cob001
//step002 exec pgm=cob002
//chekr1 if step002.rc=00 then
//step004 exec pgm=cob003
//end-rc1 end-if

query: printing a report/ sending a mail to same id the report should send only when
the ps from which is going to be is non empty.

IEBPTPCH:-IBM supplied utility which can be used to check th empty file the print
command should be used in sysin DD *.

Restart parameter:- this is job level keyword parameter this must be coded at
joblevel only
Restart=stepname
This is used to restart the job from the required step. The following points must be
considered before restating a job

Precautions: -
If statements:- all if statements must be commented out which are started before
abend step and ended after abend step.

Temp ds:- all the temp ds must be considered which are begin before abend step
the restart step name must the stepname where temp ds being is created

Steps to write a cobol program


1. create a PDS
2. create member.
3. edit member code cobol pegsour.cobol.pg
Note:- a) use 88 level no of multiple conditions
b)use evaluate to avoid nested if
c) use 77 for independent datanames
d) decide the pge into manageable paragraphs
e) use the para nos in asc order
f) define user defined variables with more meaningful names
g) user arrays for effective peg process.
h)avoid goto
i)use separate exit statement for all performs.
4. prepare compilation jcl use existing jcls.
5. submit a peg for compilation.
6. enter into spool check for the compilation job statements
7. if there are any errors rc will be non zero
8. open a compiled peg and find for errors
9. when compilation and link step /activities/ 00 prepare run jcl with data file and object
jcl.
10. submit jcl to execute cobol.
11. identify output
12. if the data is stored in the file open the file by using ispf panel
13. if o/p is matching with the requirements that peg
14. then inform to project leader by mail or phone.

Difference between Static call and dynamic call

Static call:-
Both main and sub programs and object program will be stored in loadlib.
Can be identified by call peg-id in cobol.

Dynamic call:-
Stored in different loadlib storage spaces
Can be identified by cal ws-peg-id in cobol where ws –peg-id is a dn in wss

Default is static call

In stream procedures :-
These are predefined jcl statements within job
This must be coded immediate after the job with proc openrand must be terminated with
pend
Max 15 procedures can be defined within the job. And these procedures will be available
only for the job when procedures are defined
Parameters can be overridden by stepname .ddname as dd name
Ex:- sort logic data from one ps to another

Catolg procedures:-
These are the predefined jcl statements outside of the job
This procedures must be coded in members which must be sorted in pds
Can be executed by any job but location of the procedure must specified with poclib
ddname immediately after the job
Max 255 procedures can be defined in one job
Symbolic parameters (&) must be used to override the parameres that should be coded
prefix with &

Refer back :-
It is used to use the same activity level parameter at one level at another level
This can be used to refer the dataset which are created in the previous steps from
subsequent steps
It must be coded with *.stepname.ddname

Generation data groups:-


This concept is used to keep track of the records in chronological order to create gdg base
name must be created by using IBM utility IDCAMS
The basename must be coded in the DEFINE command of sysin dd *

Parameters specified for base:-


LIMIT: this is used to generate no of versions/generations to the base . max no of
generations is 255

SCRATCH: used to delete all the generations when limit is reached


NO SCRATCH: used to delete oldest generation when limit is reached

EMPTY: used to uncatilog all the generation when limit is reached

DATEEXPRIED: used to keep the dataset for specified time.

You might also like