JCL & Utilities.pdf
Short Description
Download JCL & Utilities.pdf...
Description
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
J OB CONTR CONTROL OL LA L A NG NGUAGE UAGE
Presented Pre sented by: by :
Kunal Sharma
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
INTRODUCTION Job control language(JCL). It is a means of communication between a program that can be written in COBOL , ASSEMBER or PL/I and the MVS operating system. Without a JCL, you cant able to run a job on MVS operating system.
All JCL statements can consists of up to five types types of fields
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
forward slashes slashes are required required at the beginnin beginning g of each // - The two forward JCL statement in Columns 1 and 2.
Name Na me field fi eld - This is an optional field. If coded, should start at
Column 3. It maximum length is 8.
Operation Ope ration field - Which indicates the operation that is to be
performed
Operand - This field must appear after Operation field. Must start at
16 column
Comments - Comments begin one space after the last operand.
Our simple example has no comments.
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
// Na Name me
Operatio n
// JOB1
JOB
Operand (034D), 'RAMESH', CLASS='A', PRTY=6
// STEP01 EXEC
PGM=COBPROG
// INFILE
DSN=SED.GLOB.DES.INFILE,DISP=SHR DSN=SED.GLOB.DES .INFILE,DISP=SHR
DD
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
Three important input operations are 1. JOB 2. EXEC
3. DD
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
EXPLANATION EXPLA NATION TO KEYWORD KEYWORD PARAMET PARA METER ER
CLASS
PRTY
MSGCLASS
MSGLEVEL
TYPRUN
NOTIFY
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
short running, running, some jobs jobs may take more more CLASS: Some jobs can be short CLASS: time other may use heavy resources. CLASS keyword parameter is used to tell to OS about the nature of job we are submitting. Syntax -> CLASS = job class
alphabetical ical characte characterr between between A - Z or Vali Va lid d values -> Any alphabet number num bers s betwe between en 0 - 9 JCL -> //MYJOB JOB (3345Y),‘KUNAL SHARMA',CLASS=K
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
parameter. It assigns priority to jobs PRTY: It is related to CLASS parameter. which belong to the same class. Higher number takes precedence over the job with lower number. A job with priority of 12 will run before a job with priority 5.
Syntax -> PRTY=priority
Valid Va lid values -> Any value between 0 to 15 JCL -> //MYJOB //MYJOB JOB J OB (34 (345Y) 5Y),'K ,'KUNAL' UNAL',CLASS=8, ,CLASS=8,PRT PRTY=6 Y=6
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
MSGCLASS : The MSGCLASS parameter determines the output device to which system messages and JCL messages are written .
MSGCLASS=output-class-name ss-name Syntax -> MSGCLASS=output-cla alpha betical characte characterr between between A - Z or Valid Va lid values -> Any alpha number num ber bet betwee ween n 0 - 9. JCL -> //M //MYJOB YJOB JOB J OB (456Y) (456Y),'K ,'KUNAL UNAL REDDY',CLASS=7,PRTY=5,MSGCLASS=A
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
tell JCL, which which messages messages to be printed printed in MSGLEVEL:: is used to tell MSGLEVEL the device specified in MSGCLASS parameter . MSGLEVEL=(statements,messages ments,messages)) Syntax -> MSGLEVEL=(state Valid Va lid values -> Statements may be the number 0,1,2 and messages can be 0 or 1 JCL -> //M //MYJOB YJOB JOB J OB (3456Y),'SR',CLASS=8,MSGCLASS=S,MSGLEVEL=(1,1)
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
TYPRUN parameter parameter is used to specify specify whether whether job is TYPRUN: The TYPRUN TYPRUN: to be held until further notice or for syntax checking . TYPRUN=HOLD OLD - Job held until until further further notice or or Syntax -> TYPRUN=H TYPRUN=SC TYPR UN=SCAN AN - Check Jcl for for syntax checking checking.. JCL -> //M //MYJOB YJOB JOB J OB (3456Y),'KUNAL',CLASS=8,PRTY=9,TYPRUN=HOLD
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
NOTIFY parameter parameter is used to direct direct the system, system, NOTIFY: The NOTIFY NOTIFY: where it has to send the success/failure message after completing the job. Syntax -> NOTIFY=userid/&SY NOTIFY=userid/&SYSUID SUID JCL -> //MY //MYJOB JOB JOB (34 (3456Y 56Y),'KUNAL ),'KUNAL SHARMA',CLASS= SHAR MA',CLASS=8, 8,NO NOTIF TIFY= Y=&SYSU &SYSUID ID &SYSUI &SYSUID D - th the e userid us erid fr from om whi ch user it has been been subm itted
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
JOBLIB/STEPLIB
definition) stateme statement, nt, and it specifies specifies JOBLIB : It is a DD (Data definition) where the program (which is specified in EXEC statement) exists. It is applicable to all job steps in that job. It cannot be used in cataloged procedures. Syntax -> //JOBLIB
DD
DSN=dataset
JCL -> -> //MYJOB JOB (E343),'KUNAL‘ //JOBL // JOBLIB IB DD DSN=SE DSN=SE.T .TES EST. T.LOADLIB,DIS LOADLIB,DISP= P=SH SHR R //STEPLIB DD DSN=dataset. JCL -> -> //MYJOB JOB (U456),'KUNAL‘ //STEP1 EXEC PGM=COBPROG
//STEPLIB DD DSN=TEST.MYPROD.LIB,DISP=SHR //STEP2 EXEC PGM=COBPROG2 //STEPLIB DD DSN=TEST.MYPROD.LIB1,DISP=SHR
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
IMPORTANT NOTE: If both the JOBLIB and STEPLIB statements are coded, then the STEPLIB specification will override JOBLIB specification
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
statement nt is used used to execute execute a EXEC STATEMENT STATEMENT:: EXEC stateme program/procedure A maximum of 255 EXEC statement can code in an single job. Syntax - // //st stepname epname
EXEC EX EC
PGM= PG M=pr progr ogr amam-name, name,keywor keywor d
paramete para meters rs Posit ional parame parameter ter - Prog rogramram-name name .
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
K EYWO EYWORD RD PARAMETER PA RAMETER FOR EXEC
PARM
ACCT A CCT
ADDRSPC A DDRSPC
DPRTY PERFORM
RD
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
PARM: PARAM parameter is used to pass information to program Syntax -> PARM=value
Value is a string can be 1 to 100 characters long.
accounting nting inform information ation for for that step step ACCT A CCT - accou
ADDRSPC A DDRSPC - used to indicate indicate to to the system system that the the job step is use
either virtual or real storage
DPRTY - used to assign prior priority ity to the the job step step
specifies ies the rate at which which system resourc resources es used by PERFORM - specif job step
definition is used to specify specify automatic restart of a job if it RD - restart definition abends
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
PARAMETE PARA METERS RS IN BOTH STATEMENTS STATEMENTS (JOB and an d EXEC EXEC))
COND
REGION
TIME
These parameters can code in both JOB and EXEC statements, When we code these parameters on both statement,
JOB - REGIO REGION N will will override override EXEC EXEC – – REGION JOB - CON COND D will will ove overri rride de EXE EXEC C - CON COND D EXEC EXE C - TIM TIME E will will ove overri rride de JOB - TIM TIME E
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
:- Speci Specifies fies the amount amount of space should should be used at the time time REGION:REGION of running a job/step Syntax -> REGION=< value >K or
REGION=< value >M JCL -> -> //MYJOB JOB (AE32),‘KUNAL' //STEP1 EXEC PGM=COBPROG,REGION=67K
IMP: All available storage is assigned to the job or jobstep, If REGION is coded 0K or 0M
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
COND:: - Each step COND step sends an a return return code code to the system system upon upon
completion. This is called condition code. COND parameter is used to control the execution of subsequent job steps, depending on the condition code that is returned for prior step. Return code number between 0 and 4095 .
//MYJOB JOB (R475),'KUNAL‘COND=(4,GT (R475),'KUNAL‘COND=(4,GT))
//STEP1 EXEC PGM=COBPROG
//STEP2 EXEC PGM=COBPROG2 In this example we are specifying that if the number 4 is greater than the return code of STEP1, then STEP2 is to be bypassed.
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
:The time parameter is used to specify the amount of CPU time TIME:The TIME that a job or job step is permitted to utilize. Syntax -> TIME=minutes OR TIME=([minutes] [,seconds]) minutes
can be between 1 and 1439 seconds can be between 1 and 59
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
JCL -> If coded on o n JOB //MYJOB JOB (E234),‘KUNAL',TIME=(20,3 (E234),‘KUNAL',TIME=(20,30) 0)
//STEP1 EXEC PGM=COBPROG1 //STEP2 EXEC PGM=COBPROG2 //STEP3 EXEC PGM=COBPROG3 In this example 20 minutes 30 seconds time allotted to job. All steps in this job STEP1 STEP2 STEP3 should complete its task within 20 min. 30 sec.
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
If coded co ded on o n STEP STEP //MYJOB JOB (R567),'KUNAL' //STEP1 EXEC PGM=COBPRO // TIME=30 In this example 30 min. Time is allotted to STEP1. If STEP1 requires more than 30 min. MYJOB will terminate abnormally.
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE If coded cod ed on bot b oth h STEP STEP AND JOB //SECOND JOB ,‘KUNAL',TIME=3
//STEP1 EXEC PGM=C,TIME=2 / //STEP2 EXEC PGM=D,TIME=2 In this example, the job is allowed 3 minutes of execution time. Each step is allowed 2 minutes of execution time. Should either step try to execute beyond 2 minutes, the job will terminate beginning with that step. If STEP1 executes in 1.74 minutes and if STEP2 tries to execute beyond 1.26 minutes, the job will be terminated because of the 3-minute time limit specified on the JOB statement.
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
By coding TIME=1440 or TIME=NOLIMIT, It will give a job or step an unlimited amount of time.
To allow a job or step to use the maximum amount of time, code TIME=MAXIMUM. Coding TIME=MAXIMUM allows the job or step to run for 357912 minutes. (Approx. 248 days)
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
DD STATEMENT The DD statement (Data Definition), is used to identify the source of input and the placement of output information Syntax -> //ddname
DD < positional / keyword parameters > dd name must be unique in the job
Positional Posit ional parameter parameters s - * DATA DUMMY DYNAM DYNAM
Keyword Keywo rd Parameters Parameters - DSN DISP UNIT UNIT SPACE DCB VOLUME VOLUME
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
DSN PARAMETER PARAMETER::
DSN parameter is used specify the data set name Syntax -> DSN=dataset name
JCL -> //MYJOB JOB (ER3),‘KUNAL' //STEP1 EXEC PGM=COBPROG PGM=C OBPROG //INFILE //INFILE DD DSN=TEST.GLOB.MYL DSN=TEST.GLOB.MYLIB IB
TEST.GLOB.MYLIB will be used in the COBPROG program.
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
TEMPORARY TEMP ORARY DATA DA TA SETS SETS::
Temporary data set is created during job and deleted at the end of the job. Temporary data set can be coded by using two ampersands followed by name. JCL --> --> //MYJOB JOB (E456),‘KUNAL' //STEP1 EXEC PGM=COBPROG PGM=C OBPROG //INFILE //INFILE DD DSN=&&TEMP DSN=&& TEMP
Here TEMP is an temporary dataset will be deleted upon job completion.
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
DISP PARAMETE PARA METER: R:
The DISP parameter is used specify the disposition of dataset which is coded on DSN parameter.
DISP=(STATUS,NORMAL-DISPOSITION,AB DISP=(STATUS,NORM AL-DISPOSITION,ABNORMALDIPOSITION NORMALDIPOSITION))
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
Parameter Pa rameter on th the e DIS DISP P statement St at u s
No r m al Di s p o s i t i o n
NEW
DELETE
DELETE
OLD
CATLG
CATLG
MOD
UNCATLG
KEEP
SHR
KEEP
UNCATLG
PASS
A b n o r m al Di s p o s i t i o n
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
STATUS: STATUS: NEW - Datas Dataset et will be created. created. (file (file should not exists) exists) OLD - Datas Dataset et should exist exists. s. MOD - Datas Dataset et will be be created created If not exist exists s SHR - Datas Dataset et can be be used by other other jobs jobs also also
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
UNIT PARAMETE PARA METER: R: In IBM Mainframe environment, All devices have an address assigned to them at the time they added to the system. Devices can be referenced using this addresses. UNIT parameter is used to specify these address.
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
UNIT PARAMETE PARA METER: R: JCL //MYJOB JOB
(R345),‘KUNAL'
//STEP1
EXEC PGM=COBPROG
//INFILE
DD
DSN=TEST.GLOB.TEST.LIB, DSN=TEST.GLOB.TE ST.LIB, UNIT=SYSDA
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
VOL PARAMETE PA RAMETER R: This parameter is used to identify the volume serial number on which dataset is reside. The VOL dataset is used with disk and tape datasets.
JCL ---> >
//MYJOB JOB (E454),'KUNAL' //STEP1 EXEC PGM=COBPROG //INFILE DD DSN=TEST.GLOB.T DSN=TEST.GLOB.TEMP, EMP, // VOL=SER=(VOL1,V VOL=SER=(VOL1,VOL2,VOL3) OL2,VOL3)
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
SPACE PARAMETER PARAMETER::
The SPACE parameter is used to allocate space for datasets. We can allocate space in Cylinders/Tracks/Blocks . Syntax -> SPACE=(CYL,(primary,secondary,director SPACE=(CYL,(primary,se condary,directory),RLSE,CONTIG y),RLSE,CONTIG,MXIG, ,MXIG, ROUND) Instead of CYL, We can use TRK or BLK
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
Meaning Me aning of Sub Parameter Parameter
TRK - Reque Requesting sting space in track track
CYL - Reque Requesting sting space in cylinders cylinders
PRIMARY - Prima Primary ry storage storage to be allocated allocated at the time of data set set created
SECONDARY - Addit Additional ional storage storage to be allocat allocated ed , If primary primary storage is not sufficient
DIRECTORY - Space for for recording recording of name name and location location of of partitioned data sets
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
RLSE - Reque Request st for release of of space previously previously allocated allocated unused unused space after completion of job
CONTIG - Reque Request st for for contiguo contiguous us space space MXIG - Reque Request st for large large area of of contiguous contiguous space space ROUND - Reque Request st for entire entire cylinder cylinder for storage storage of data set
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
JCL //MYJOB
JOB (W345),‘KUNAL'
//STEP1
EXEC
//INFILE
DD
PGM=COBPROG DSN=TEST.GLOB.LIB
//
UNIT=4560
//
SPACE=(CYL,(30,4))
In this example, 30 cylinders are requested as primary space and 4 additional cylinders as secondary space.
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
IMPORTANT Up to 15 extends of secondary space ( in our example it is 4 ) will be allotted , If space is not sufficient.
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
DCB PARAMETE PA RAMETER R: Records in dataset may contain FIXED length / VARIABLE length. The DCB (Data Control Block) parameter is used to specify record format, record length, block size etc.
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
Sub parameters parameters in DC DCB B
Specificati fication on of record format format - F/FB F/FB/V/V /V/VB/U B/U LRECL RECFM - Speci Specification of record length
Specificati fication on of of block block size size BLKSIZE - Speci Specificat fication ion of buffer buffers s BUFNO - Speci
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
J CL //MYJCL
JOB
(E3445),‘KUNAL‘
//STEP1
EXEC
PROG=COBPROG
//INFILE
DD
DSN=TEST.GLOB.LIB
//
UNIT=234,
//
DSN=(LRECL=80,
//
RECFM=FB,
//
BLKSIZE=800,
//
BUFNO=30)
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
IMPORTANT When you specified V for RECFM parameter, LRECL value is largest record in the file plus 4 bytes. These four bytes contain the actual length of each variable length record in the file.
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
SPECIAL SPEC IAL DD STATEMENTS STATEMENTS : 1. DUMMY DSN=NULLFILE 2. Concatenating Data sets 3. Passing Passing data to cobol cobol program program using using - SYSI SYSIN N DD * 4. SYSOUT 5. SYSUDUMP 6. SYSADUMP
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
DUMMY DUMM Y OR DSN=NUL DSN=NUL L FILE
Some times we need to testing of program, without using actual datasets. Then we can use DUMMY or DSN=NULLFILE.
If we use DUMMY, operating system simulates the presence of a file. When you reading Operating system sends end of file request to program. J CL //MYJOB
JOB (W345), ‘KUNAL'
//STEP1
EXEC
PGM=COBPROG
//INFILE
DD
DUMMY
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
CONCATENATING DA DA TA SETS
In JCL , we can concatenate different files by giving their name one after another. All data sets concatenated must be of the same type. For example, partitioned data sets can be concatenated only with partitioned data sets.
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
CONCATENATING DATA SETS SETS:: J CL -->
//MYJOB
JOB (W345),'KUNAL'
//STEP1
EXEC
PGM=COBPROG
//INFILE
DD
DSN=TEST.GLOB.FILE1 DSN=TEST.GLOB.FI LE1
//
DSN=TEST.GLOB.FILE2
//
DSN=TEST.GLOB.FILE3
In program , we will read it as an single file. concatenation of three files done by operating system.
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
IMPORTANT Maximum of 255 sequential data sets can be concatenated together Maximum of 16 partitioned data sets can be concatenated together
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
INSTREAM INSTR EAM and an d CATA CATAL L OGE OGED D PROCEDU PROCEDURES RES 1. Introduction 2. Instream Procedure 3. Cataloged procedure
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
In JCL, We have an important concept reusability in the form of Instream and Cataloged procedures, Often, in work environments users can utilized same JCL. Using instream / cataloged procedures we can reuse the jcl code which was stored in another data set, in our data set.
Syntax Synta x f or Executing proc edure --> -->
EXEC
[PROC=]procedure-name
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
INSTREAM PROCEDURE A JCL Procedure is a pre-written segment of code, that you can include in your JOB. You code instream data set within the job and use it in that job as many times as you want. An Instream Procedure Procedure JCL Example Example
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
- Instr Instream eam procedure procedure should should be defined , before any any EXEC statement defined
- Instr Instream eam procedure procedure startes startes with with PROC and ends with PEND statements
- Instr Instream eam procedure procedure is executed executed when we main jcl called. called.
-The maximum number of instream procedures you can in any job is 15
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
CATALOGED CATA LOGED PROCEDURE: PROCEDURE:
Pre-written segment of code (which is stored as an member of PDS), which you can use as many times you want in any job in the system. IBM supplies a utility program called IEBUPDTE; this program places cataloged procedures into partitioned data sets. These procedures are placed inside a system library called SYS1.PROCLIB. Developing Cataloge Procedure
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
SYMBOLIC PARAMETER Usually, the same JCL can be used by different programmers to implement common tasks, such as the opening, reading, and writing of data sets. In those cases , we can use symbolic parameters. Using symbolic parameters we can pass value to a parameter which is used in procedure. A symbolic parameter on a DD statement is coded the parameter preceded by an ampersand.
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE SYMBOLIC PARAMETER
Procedure which is using symbolic parameter //MYPROC PROC //MYSTEP
EXEC
//INFILE
DD
//OUTFILE //
DD
PGM=COBPROG DSN=&DOC..TEST.LIB,DISP=SHR DSN=&DOC..TEST.OUT, DISP=(NEW,KEEP,DELETE),
//
UNIT=SYSDA,
//
SPACE=(CYL,(&SPACE))
The invoking EXEC statement
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
GDG GD G (Generatio (Generation n Da Data ta Group Gro up))
INTRODUCTION CREATION OF GDG USING GDG ALTERING GDG DEFINITION
DELETING GDG
IMPORTANT PRACTICAL QUESTIONS
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
INTRODUCTION Generation Data Groups or GDGs are a group of data sets which are ar e re rela late ted d to ea each ch ot othe herr ch chro rono nolo logi gica call lly y an and d fu func ncti tion onal ally ly.. These related Data Sets share a unique Data Set Name. Every GDG data set has a Generation number and Version number assigned to each data set et..
J OB CO CONT NTRO ROL L L A NG NGUAGE UAGE
'MYLIB.LIB.TEST.G0001V00' 'MYLIB.LIB.TEST.G0002V00' 'MYLIB.LIB 'MYLI B.LIB.TES .TEST.G00 T.G0003V00' 03V00' GaaaaVnn aaaa is between 0000 to 9999 nn is between 00 to 99 In JCL, we refer current version with 0 ( Ex. MYLIB.LIB.TEST(0) ) new version going to create with +1 ( Ex. MYLIB.LIB.TEST(+1) ) older versions , refer with -1 - 1 -2 -3 etc.... ( Ex. MYLIB.LIB.TEST(-1) )
View more...
Comments