Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 27

Mainframe Refresher Part-1 JCL-Page:1

JCL (Job Control Language)


JCL

Any business application is divided into logical modules and these modules are
developed using programming languages. These programs should be executed in a
pre-defined sequence to achieve the business functionality.

JCL (Job Control Language) is used to DEFINE and CONTROL the JOB to the
operating system.

Definition involves definition of the programs need to be executed, the data for the
programs and the sequence of programs. CONTROL involves controlling the
execution or bypassing of a program in the sequence based on the result of the prior
program execution.

JCL Coding Sheet

123 11 16 73 80
NAME OPERATION OPERANDS

JCL statements should have // in column 1 and 2. STAR (‘*‘) in the third column,
indicates that the line is a comment line.

NAME is optional field. If coded, it should start at column3 and can have maximum 8
characters. The first character should be an alphabet or national character (@, # or
$). Remaining characters can be any alphanumeric or national characters.

OPERATION follows NAME field. There should be at least one space between NAME
and OPERATION. If NAME is not coded then OPERATION can start at fourth column
itself. Typical OPERATION keywords are JOB, EXEC and DD.

OPERANDS are the parameters for the operation. OPERANDS follow OPERATION and
there should be at least one space between them. A comma separates parameters
and there should not any space between parameters. If the OPERANDS are more,
then they can be continued in the next line. To continue the current line, end the
current line before column 72 with ‘,’ and start the next line anywhere between
columns 4-16. Columns 1-3 should be ‘// ‘.

COMMENT FIELD – Comment field optionally follows OPERAND FIELD, preceded by at


least one blank.

End of Job is identified by NULL statement. NULL statement has // in column 1 and 2
with no NAME, OPERATION or OPERAND fields. The statements coded after NULL
statement will not be processed.

DELIMITER – Some times we pass the data in the JCL itself. This is called in-stream
data. The starting of data is identified by ‘*’ in the operand field of DD operation.
DELIMITER indicates the end of data. /* in column 1 and 2 is the default delimiter.
Mainframe Refresher Part-1 JCL-Page:2

Job Entry Subsystem (JES)

Job Entry Subsystem (JES) is the job processor of MVS operating system.
MVS installation can have either JES2 or JES3. The submitted jobs are taken by JES
for processing.

JCL Statements

JOB. It should be the first statement in the JCL. It indicates accounting information
and JOB related information to the system. If the member being submitted contains
multiple job cards, then multiple jobs will be submitted. These jobs will run
concurrently or one after other based on job name, class and initiator availability.

EXEC. The name of the program or procedure to be executed is coded here. Every
EXEC statement in a JOB identifies one step. Maximum of 255 EXEC statements can
be coded in a JOB.

DD. Data Descriptor. The dataset details are coded here. Dataset contains the
data that need to be processed by the program or data that is produced by the
program. Maximum 3273 DD statements can be coded in a step.

Abnormal End (ABEND) & ERROR


Once the work to be done is defined in JCL, it can be submitted to the
operating system using SUBMIT command. Usually programmer is expected to issue
JEM or JSCAN to check out any possible JCL Errors before submission.

JCL ERROR:
1. Errors before job starts execution: If there are syntax errors, then the whole
job is rejected with error message in JES MESSAGES. Typically this needs
correction and resubmission of the whole JOB.
2. Errors before step starts execution: If there is any allocation issues in a
particular (like dataset not found, duplicate dataset), then also the job will be
error out but in this case there might be already n steps got executed.
Typically this needs correction and restart in the JOB.

ABEND:
Unlike JCL Errors, ABEND happens during the execution of a program in a
step. ABENDS are classified into 2 categories.

System ABEND(Snnn): System abend occurs when the system is not able to
execute a statement that is instructed in the program. Divide by ZERO results SOCB
system abend. The OS throws it.
Mainframe Refresher Part-1 JCL-Page:3

User ABEND(Unnnn): When some unexpected condition occurs in the data passed,
the program will call an abend routine and abend the step with proper displays. This
is thrown by application based on the requirement.

JOB Statement
Sample Syntax:
//JOBNAME JOB
(ACCOUNTING
INFO),
(PROGRAMMER
NAME),
//
TIME=(MINUTE
S,SECONDS),
CLASS=A,MSGC
LASS=A,PRTY=
14,ADDR=VIRT,
//
REGION=nK,MS
GLEVEL=(A,B),
COND=(N,OPER
ATOR),
TYPRUN=SCAN

JOBNAME
It identifies name of the job. The job is identified in the JES SPOOL using this
name. Naming rules are already mentioned in the coding sheet section.

ACCOUNTING INFO (Mandatory. Installation Dependant.)


1. Resource usage charges are charged to the account mentioned here.
2. If you don’t know your installation account, you cannot submit the job. It is like
when you don’t have account, you cannot withdraw cash in bank.
3. Maximum 142 characters can be coded as accounting information.

PROGRAMMER NAME
Programmer name or program functionality or group can be mentioned. It is
used for documentation (Max 20 chars)

CLASS (Installation Defined)


4. CLASS is coded with single alphanumeric character (A-Z, 0-9).
5. During installation, every CLASS and its properties are defined.
6. Definition describes the job characteristics like CPU time usage, number of
tape/cart usage and other resource constraints.
7. Every class is assigned to one or more initiators. The jobs run in initiator address
space. One initiator can process one job at one time.

PRTY
Syntax: PRTY=N (N can be 0 –15).
8. While selecting the jobs with same class for execution, JES schedules the high
priority jobs first. The job coded with PRTY=15 has the highest priority and
PRTY=0 has the lowest priority.
2. PRTY works within the JOBCLASS. If there are 2 jobs with CLASS A is submitted
and one with PRTY 3 and other with PRTY 4 then PRTY 4 will get into execution
queue first.
3. PRTY function is disabled in most of the installations.

MSGLEVEL
Syntax: MSGLEVEL=(X,Y) (X can be 0-2 & Y can be 0-1)
4. It is used to control the lists of information appear in the Job log. To get
Mainframe Refresher Part-1 JCL-Page:4

MSGCLASS (Installation Defined)


Syntax: MSGCLASS=X (X can be A-Z, 0-9).
1. MSGCLASS is coded with single alphanumeric character (A-Z, 0-9).
2. Each MSGCLASS is mapped to a device or location, where the messages are
routed.

ADDRSPC
It is used to specify whether the job will run in the Real storage or Virtual
storage.
Syntax: ADDRSPC={REAL|VIRT}
REAL – Allocation is done in REAL storage and the program is not
page-able. VIRT – Allocation is done in VIRTUAL storage and the program is
page-able.

REGION
Syntax: REGION={xK | yM} (x can be 1-2096128 & y can be 1-
2047).
3. It is used to specify the amount of central /virtual storage the job
requires.
It can be requested in the units of kilobytes (xK) or megabytes (yM). If
requested
in terms of kilobytes, then x should be multiple of 4 or the system will round it to
nearest 4K allocates for your job.
2. REGION can be coded in EXEC statement also. REGION parameter coded on JOB
card overrides the parameter coded on EXEC card.
3. Maximum virtual memory available is 2GB.
4. Region=0M allocate all the available memory in the address space to this job.
5. Region related ABENDS: When the requested region is not available, the JOB will
ABEND with S822. When the requested region is not enough for the program to
run, you will get ABEND S80A or S804.

RESTART
RESTART parameter allows restarting from any particular step in the job.
Syntax: RESTART = Step-name in the job
RESTART = * means restart from the beginning.
To restart from any procedure steps, code RESTART=PROCSTEP.STEPNAME
Whereas PROCSTEP=name of the JCL step that invoked the PROC &
STEPNAME=name of the proc step where you want execution to start.
RESTART ignores any condition in the step being restarted and it can also be step
that is in the ELSE part of the IF..ELSE..ENDIF.

TYPRUN
It is used to request special job processing.
6. TYPRUN=SCAN checks the syntax errors without actual execution.
7. TYPRUN=HOLD checks the syntax error and if there is any error, it is notified and
if there are no errors, the job is kept in awaiting execution queue and it should
be released by user for execution. Release can be done by typing ‘A’ against the
job name in SDSF.
3. TYPRUN=JCLHOLD Function is same as HOLD but the syntax check starts only
after the release of the job.
Mainframe Refresher Part-1 JCL-Page:5

TIME
It defines the maximum allowable CPU time for the JOB. The parameter can be
coded at EXEC card also. On EXEC, it defines CPU limit of step.

Syntax: TIME = (MINUTES, SECONDS), MINUTES <= 1440 and SECONDS < 60
TIME=NOLIMIT/1440/MAXIMUM means the job can use CPU for unlimited time
TIME=0 will produce unpredictable results.
If TIME is coded on both JOB as well as EXEC, then EXEC Time limit or the
time left out in the job Time limit – whichever is smaller will be the time permitted
for the step to complete.
If a JOB runs more than allowed time, then it will ABEND with system ABEND
code S322. If there is no TIME parameter, then the CPU time limit pre-defined with
CLASS Parameter will be effective.

NOTIFY
TSO User-id to whom the job END / ABEND / ERROR status should be
notified. NOTIFY=&SYSUID will send the notification to the user who submitted the
job.

COND
1. It is used for conditional execution of JOB based on return code of JOB steps.
2. The return code of every step is checked against the condition coded on JOB
card. If the condition is found TRUE, then all the steps following it are bypassed.
3. Maximum eight conditions can be coded in the COND parameter. In case of
multiple conditions, if ANY of the condition is found TRUE then the JOB stops
proceeding further.
Syntax: COND=(CODE,OPERATOR,STEPNAME)
STEPNAME is optional. If you code it, then that particular step-name
return
code is checked against the CODE with the OPERATOR. If omitted, then the
return codes of all the steps are checked. On comparison, if the condition found to
be true, then all the following steps are bypassed.
CODE can be 0-4095
OPERATOR can be GT, LT, GE, LE, EQ
It can be coded on EXEC statement. STEP level control is popular then JOB
level control. On EXEC statement, you may find ONLY, EVEN keywords against COND
parameter.
COND=ONLY allows the step execution only if any prior step is
ABENDED. COND=EVEN allows the step execution independent of any
prior ABENDS.

Consider the COND parameter coded on EXEC statement,


Ex: //STEP2 EXEC PGM=PGM3,COND=((16,GE),(90,LE,STEP1),ONLY)
Step gets executed only if
A preceding step abnormally terminated OR
The return codes from all preceding steps are 17 or
greater OR The return code from STEP1 is 89 or less.

EXEC Statement
It defines the Step and Step level information to the
system. Syntax: //STEPNAME EXEC {PGM=program-name |
PROC=proc-
name

| proc-name}
Mainframe Refresher Part-1 JCL-Page:6

STEPNAME
It is an OPTIONAL field but it is needed if you want to restart a job from this
step and for the same reason, it should be unique within the job.

PGM or PROC
Code the Program name or PROC name to be executed. (1-8
characters)

DPRTY
PRTY assigns priority to a job and DPRTY assigns dispatching priority to job
step. Syntax: DPRTY=(value1, value2). Value1 and value2 can be 0-15. D-Priority is
calculated using the formula (value1*16 + value)

IF /THEN/ELSE/END-IF
It is used for conditionally executing one or more steps. Nesting is possible up
to 15 levels. The meaning is same as programming IF. If the coded condition is true,
the following steps till ELSE will be executed. If the condition is false, then
the steps coded on ELSE part will be executed.
Syntax:
//name IF (relational operation) THEN
//…Steps..
// ELSE
//…Steps..
// ENDIF.

PROC PEND INCLUDE ‘/*’ ‘// ‘ ‘//*’ are executed irrespective of their place.
Don’t specify JOBLIB, JCLLIB, JOBCAT, STEPCAT, JOB, SYSCHK within
the
THEN or ELSE Scope of IF statement.
Relational condition can be also coded as follows:
STEPNAME.ABEND=TRUE, STEPNAME.RUN=TRUE, STEPNAME NOT
RUN
STEPNAME.ABENDCC = any-abend-code or

DD Statement
It defines the data requirements of the program. It is coded for every file
used in the program. If the employee details are stored in a file and catalogued with
the name ‘SMSXL86.EMPLOYEE.DETAILS’, one of the programs (EMPPGM) in the
application reads this file, then JCL card for the DD looks like.
Mainframe Refresher Part-1 JCL-Page:7

//STEP EXEC PGM=EMPPGM,REGION=1M


//EMPFILE DD DSN=SMSXL86.EMPLOYEE.DETAILS,DISP=SHR

When the program opens EMPFILE, it would open SMSXL86.EMPLOYEE.DETAILS.


The mapping is done as follows in the program. So in future, if you process the same
program with another file SMSXL86.EMPLOYEE.DETAILS2, then change of dataset
name in the JCL is enough. Because of logical mapping, program need not be
changed.

SELECT file1 ASSIGN TO EMPFILE. (COBOL Program)


DECLARE (EMPFILE) FILE; (PL/I Program)
DCB DDNAME=EMPFILE (ASSEMBLER)
FOPEN(EMPFILE,mode) (C )

DSNAME(DSN)
The name of the dataset is coded in the DSN parameter. Dataset name can
contain 44 characters including the periods in between qualifier. Each
qualifier can have 8 characters and there can be 22 qualifiers. But usually we don’t
code more than 4 qualifiers.
DSN=XXXX.YYYY.ZZZZ,DISP=SHR
Temporary datasets are indicated by && in the DSN (DSN=&&temp).
If DSN is not specified, then the system assigns the specific name to dataset.
If DSN=NULLFILE or DUMMY is coded, then all the I/O s against this file are
bypassed.

DISP
It is used to describe the status of a dataset to the system and
instructs the
system what to do with that dataset after successful/unsuccessful termination
of the step or job.
DISP=(current-status, normal-termination-status, abnormal-termination-
status)

NEW Current-status
Dataset does notcanexist.
be: It will be created in this step
SHR Dataset already exist and this step need it without any exclusive access
OLD Dataset already exist and this step need it with exclusive access
MOD If the dataset does not exist, it is to be created. If it already exists, records
are to be added to the end of the dataset. In both the cases, exclusive is
needed.
Normal-termination-status:

CATLG System is to place an entry, pointing to the dataset in the system/user


catalog
DELETE Dataset is no longer required. Space available for use by another dataset
but existing dataset not physically erased until overwritten by another
dataset.
PASS Dataset is passed to subsequent steps in the same job and each step can
use the dataset only once.
KEEP Dataset is to be kept on the volume
UNCATLG System is to delete the catalog entry corresponding to this dataset and
keep this dataset.
Mainframe Refresher Part-1 JCL-Page:8

Abnormal-termination-status:
PASS is not allowed. Meaning of CATLG, UNCATLG, KEEP, DELETE are same as
normal-termination status.

Absence of any parameter should be mentioned with ‘,’ as they are positional
parameters. Ex: DISP=(,,CATLG). If the dataset is a new dataset and DISP is not
coded, then the default in effect would be DISP=(NEW,DELETE,DELETE).

DCB (Data Control Block)


DCB specifies attributes of the records in the dataset.
Syntax DCB=(LRECL=NN,BLKSIZE=YY,RECFM=Z,DSORG=MM,BUFNO=nn)

RECFM
It specifies format of the dataset. It can be Fixed, Variable, Undefined,
Fixed
Blocked, variable Blocked. (F, V, U, FB, VB). Other special record formats are VBS,
FBS, VT, FT, FBA.

LRECL
It specifies logical record length. The length of the record is as in the
program
for fixed length records, length of the longest record with four more bytes for
variable length records.

BLKSIZE
It contains physical record length. That is the length of the record in the
storage medium. One block contains one or more logical records. It is suggested to
code BLKSIZE as 0 so that the best size is chosen by the system, based on device.
If you explicitly code it, then it should multiple of LRECL for FB
datasets and
should not be less than length of the longest records with eight more bytes
for VB dataset. In the extra eight bytes, four bytes are used for length of the
record and four bytes are used for length of the block.

DSORG.
PS (Physical sequential) PO (Partitioned organization)

.
Mainframe Refresher Part-1 JCL-Page:9

Dataset Sequence number - identifies the relative position of a dataset on a


tape/cart volume. Should be 1 through 4 decimal digits. Omit this parameter if
access is being made to the first dataset on the tape volume.
Mainframe Refresher Part-1 JCL-Page:10

SPACE
It is used to request space for the new dataset. It is mandatory for all the
NEW datasets.

SPACE = ({TRK | CYL | blklgth} (,Primary-qty , Second-qty, Directory)


[,RLSE] [,CONTIG] [,MXIG] [,ROUND])

TRK/CYL - Requests that space be allocated in tracks or cylinders.


Blklgth - Specifies the average block length, in bytes, of data. Specify a decimal
number from 1 through 65535. This takes precedence, when specified, together with
the BLKSIZE field of DCB parameter.

Primary-qty - Specifies the amount of primary space required in terms of the space
unit (tracks/cylinders/number of data blocks). One volume must have enough space
for the primary quantity. If a particular volume is requested and it does not have
enough space available for the request, the job step is terminated.
Second-qty - Specifies the number of additional tracks, cylinders, blocks to be
allocated, if additional space is required.
Directory - Specifies the number of 256-byte records needed in the directory of a
PDS. (In every block we can store 5-6 members)

RLSE - requests that space allocated to an output dataset, but not used, is to be
released when the dataset is closed. Release occurs only if dataset is open for output
and the last operation was a write.

CONTIG - requests that space allocated to the dataset must be contiguous. It affects
only primary space allocation.

MIXIG – It is used to specify that space requested should be allocated to the largest
contiguous area of space available on the volume. It affects only primary allocation.

ROUND - When the first parameter specifies the average block length, this
parameter requests that allocated space must be equal to an integral number of
cylinders. Else ignored.
Mainframe Refresher Part-1 JCL-Page:12

UNIT
It is used to request the system to place the dataset on a specific device/a
certain type or group of devices or the same device as another dataset.
UNIT=((device-number | device-type | group-name)
(,unit-count | P)
(,DEFER))
OR
UNIT=AFF=ddname

device-number - identifies a particular device by a 3-character hexadecimal number.


It should not be used unless absolutely necessary.

device-type - Requests a device by its IBM supplied generic name. (Eg. 3380)

group-name - Requests a group of devices by its symbolic name. Installation must


have assigned the name to the device(s) during system initialization.
The group-name is 1 through 8 alphanumeric characters (Eg. TEMPDA)

unit-count - Specifies the number of devices for the dataset. (1-59)

P - asks the system to mount all volumes for a dataset in parallel.

DEFER - Asks the system to assign the dataset to the device but requests that
the volume(s) not be mounted until the dataset is opened. DEFER is ignored for a
new dataset on direct access.

AFF=ddname - Requests that system to allocate different datasets residing on


different removable volumes to the same device during step execution. The ddname
is that of an earlier DD statement in the same step. It reduces number of devices
used in a job step.

Ex: UNIT=(TAPE,,DEFER) UNIT=AFF=DD1

VOLUME
A reel of TAPE or a disk pack is called as one volume. VOLUME parameter is
used to identify the volume(s) on which a dataset resides or will reside.
VOLUME = ((PRIVATE)
(,RETAIN)
(,volume-sequence-
number) (,volume-count))
(SER=serial-number1,
serial
number2......)

PRIVATE - Requests a private volume, that is exclusive use of volume for the
dataset specified. Only one job can access it at a time. TAPES are PRIVATE by
default.

RETAIN - Requests that volume is not to be demounted or rewound after the


dataset is closed or at the end of this step. It is used when a following step is to use
the same volume.

volume-sequence-number - identifies the volume of an existing multi volume


dataset to be used to begin processing the dataset. (1-255)
Mainframe Refresher Part-1 JCL-Page:13

volume-count - Specifies the maximum number of volumes that an output dataset


requires. (1-255)

SER=serial-number - Identifies by serial number the volume(s) on which the dataset


resides or will reside. 1 through 6 alphanumeric or national(@,#,$) characters.
You can code a maximum of 255 volume serials.
Ex : VOLUME=SER=DEV001 VOL=(,,,3,SER=(PAGE01,PAGE02,PAGE03))

SYSOUT=class | *
It is used to identify this dataset as a system output dataset. The SYSOUT
dataset is assigned to an output class. The attributes for each class are defined
during JES initialization, including device or devices for the output class. ’*’
refer- backs to MSGCLASS character of JOB CARD.

Positional and Keyword Parameters


All the parameters of JOB, DD and EXEC statements can be broadly classified
into two types. They are POSITIONAL and KEYWORD parameters.
Parameter that has its meaning defined by its position is positional
parameter. Bypassing of any positional parameter has to be informed to system by
‘,’. Ex: accounting information and programmer name of Job card.
Keyword parameters follow positional parameter and they can be coded in any
order. Ex: All the parameters suffixed by ‘=’ are keyword parameters. PGM= and
PROC= are exceptions for this rule. They are positional parameters.

In-stream data
The data passed in the JCL stream along with JCL statements is called in-
stream data.

Syntax: //SYSIN DD &&&&

&&&& Meaning
* The data follows from the next line and ends when any // or /* appears
at column 1& 2. So ‘//’ and ‘/*’ cannot be passed to the program.
//EMPFILE DD *
2052MUTHU
1099DEV
/*
DATA The data follows from the next line and ends when any /* appears at
column 1 & 2. So ‘/*’ cannot be passed to the program.
//SYSUT1 DD DATA
//STEP1 EXEC PGM=INV1040
//INVLSTA DD SYSOUT=A
//INVLSTB DD SYSOUT=A
/*
DATA, The data follows from the next line and ends when the characters coded
DLM=@@ in DLM appears at column 1 & 2.
//SYSIN DD DATA,DLM=##
//EMPFILE DD
* 2052MUTHU
1099DEV
/*
##
Mainframe Refresher Part-1 JCL-Page:15

// INCLUDE MEMBER1

MEMBER1 should exist in the procedure library. Procedure libraries are coded using
JCLLIB statement. Include must not be used to execute a PROC. It is possible to nest
up to 15 levels of INCLUDE statements.

Concatenation Rules
Concatenation allows naming of more than one dataset in a single input file
without physically combining them:

//STEPLIB DD DSN=PROD.LIBRARY,DISP=SHR
// DD DSN=TEST.LIBRARY,DISP=SHR
// DD DSN=USR.LIBRARY,DISP=SHR

In this case Prod, Test & User libraries are concatenated.


1.16 PDS or 255 Sequential datasets can be concatenated.
2.LRECL and Record format should be same.
3.If the Block size is different, then largest block size dataset should be first.
4.Datasets may reside on different devices and device types.
Mainframe Refresher Part-1 JCL-Page:16

REFERBACK
The backward reference or refer back permits you to obtain information from
a previous JCL statement in the job stream. STAR (*) is the refer-back operator.
It improves consistency and makes the coding
easier. DCB, DSN, VOL=SER, OUTPUT, PGM can be
referred-back.

Refer back can be done using the following


ways: 1.Another DD of the same step will be
referred.
*.DDNAME
2. DD of another step can be referred
*.STEPNAME.DDNAME (DDNAME of the
STEPNAME)
3. DD of another proc step can be referred.
*.STEP-INVOKING-PROC.PROC-STEP-
NAME.DDNAME

STAR in the SYSOUT parameter refers back to MSGCLASS of JOB card.


// UNIT=SYSDA,VOL=SER=MPS800,
Refer-back SPACE=(CYL,(5,1)),
// example:
//STEP1 DCB=(DSORG=PS,RECFM=FB,LRECL=80)
// EXEC PGM=TRANS
//TRANFILE DD
//TRANERR DD DSNAME=AR.TRANS.FILE,DISP=(NEW,KEEP),
DSNAME=AR.TRANS.ERR,DISP=(NEW,KEEP),
// UNIT=SYSDA,VOL=SER=MPS801,
// SPACE=(CYL,(2,1)),
// DCB=*.TRANFILE
//STEP2 EXEC PGM=TRANSEP
//TRANIN DD DSNAME=*.STEP1.TRANFILE,DISP=SHR
//TRANOUT DD DSNAME=AR.TRANS.A.FILE,DISP=(NEW,KEEP),
// UNIT=SYSDA,VOL=REF=*.STEP1.TRANFILE,
// SPACE=(CYL,(5,1)),
// DCB=*.STEP1.TRANFILE
.
//STEP5 EXEC PGM=*.STEP3.LOADMOD
Mainframe Refresher Part-1 JCL-Page:17

Special DD names

STEPLIB
It follows EXEC statement. Load modules will be checked first in this library
and then in the system libraries. If it is not found in both places, then the JOB would
ABEND with S806 code.

JOBLIB
It follows the job statement. Load modules of any steps (EXEC) that
don’t
have respective STEPLIB will be looked into this PDS. If not found, it will be
checked against system libraries. If it is not found there also, then the JOB would
ABEND with S806.

JCLLIB
It follows JOB statement. Catalogued procedures in the JOB are searched in
this PDS. If they are not found, they will be checked in system procedure libraries.
If they are not there, then there will be JCLERROR with ‘Proc not found’
message.
Syntax: //PROCLIB JCLLIB ORDER(PDS1,PDS2)
INCLUDE members are also kept in procedure libraries. (JCLLIB)

ABEND DATASETS
In case of ABEND, one of the following three datasets will be useful. If more
than one of the three datasets is coded, then the last coded DD will be effective.
SYSUDUMP
Prints the program area, contents of registers, and gives a trace back of
subroutines called. It will be in hexadecimal format.
SYSABEND
Same as SYSUDUMP, but also prints the system nucleus. Don't use unless you
need the nucleus. It will be in hexadecimal format.
SYSMDUMP
Same information as SYSABEND, but dump will be in machine language.
Used to store dumps in a data set to be processed by an application program.

JOBCAT and STEPCAT


The datasets used in step are first checked in the STEPCAT (ICF or VSAM
Catalog) before checking in system catalog. If no STEPCAT in the step and there is a
JOBCAT, then the datasets are first searched in JOBCAT before checking in system
catalog.

SYSIN
In-stream data can be coded in SYSIN DD *. Using ACCEPT statement,
these
records are read into the program. Every accept will read one line into
working storage (80 column).
Mainframe Refresher Part-1 JCL-Page:18

Procedures
Set of Job control statements that are frequently used are defined separately
as a procedure and it can be invoked as many times as we need from the job.
The use of procedures helps in minimizing duplication of code and
probability of error.

If a procedure is defined in the same job stream, then it is called In-stream


procedure. They are coded before the first EXEC statement in the job. The definition
starts with PROC statement and ends with PEND. Instead procedures can be saved in
a PDS and invoked from job and they are called as catalogued procedures. One
procedure can call other. This is called nesting and nesting is possible up to 15 levels.

In-stream Procedure Catalogued Procedure


//JOB1 JOB //JOB1 JOB
//PROC1 EXEC PROC
//STEP1 EXEC PGM=IKJEFT01 // JCLLIB ORDER=(‘MT0012.PROC.PDS’)
//SYSTSPRT DD SYSOUT=* //STEP01 EXEC PROC1
//SYSTSIN DD
DISP=SHR,DSN=MT0012.MSG(TEST) MT0012.PROC.PDS(PROC1)
// PEND //STEP1 EXEC PGM=IKJEFT01
//STEP01 EXEC PROC1 //SYSTSPRT DD SYSOUT=*
//SYSTSIN DD
DISP=SHR,DSN=MT0012.MSG(TEST)
/*

Procedure Modification
Procedure should be generic so that it can easily be used by the multiple
JOBS by simple overrides. During the invoking of procedures in the JOB, one can do
the following.

1. Override: Change the dataset names or parameters that are already coded in
the procedure
2. Addition: Add new datasets or parameters in the already existing steps of the
procedure.
3. Nullify: Omit the datasets or parameters that are already coded in procedure.

When you override a cataloged procedure, the override applies just to that execution
of the job. The cataloged procedure itself isn't changed.

Procedure Modification- EXEC statements


COND, TIME and PARM values of an EXEC statement in the procedure can be
added/modified/nullified in the invoking JCL in the following way.
//STEP1 EXEC PROC-NAME, PARAMETER-NAME.STEPNAME-IN-PROC=NEW-
VALUE

Ex: PROC COBCLG has a statement


//COB EXEC PGM=IGYCRCTL,REGION=400K

// EXEC COBCLG, REGION.COB=1M => Overrides the value of 400K.


// EXEC//COBCLG,
EXEC COBCLG, TIME.COB=(0,10)
REGION.COB= => Nullifies=>
400KAdds 10 seconds
region request.time limit for
Default
COB step. region will be allocated now.
Mainframe Refresher Part-1 JCL-Page:19

Procedure Modification- DD Statements


DD statement in the procedure can be modified by
//STEPNAME-IN-PROC.DDNAME-OF-STEP DD parameters of dataset...

1.DD statement overrides should be done in the same order they appear in
procedure. Within a DD statement, the order of parameters does not matter.

2.Any additions should follow modifications. In a step, if you want to override the
dataset attribute of one existing dataset and add another dataset, you should
override the old one before adding the new one.

3. To omit a parameter from a DD statement in a procedure, just name it but


don’t
pass any value for it.

Procedure Modification Using Symbolic Parameter


A symbolic is a PROC placeholder. The value for the symbolic is supplied
when
the PROC is invoked. (&symbol=value). If the value is not provided during invoke,
then the default value coded in the PROC definition would be used for substitution.

Ex: If you want to override UNIT Parameter value of all the DD statements, define
this as symbolic parameter in proc.

Catalog Procedure: PROC1

//PROC1 PROC,UNIT=SYSDA => SETS Default value of UNIT as SYSDA.


//S1 EXEC PGM=TEST1
//DD1 DD UNIT=&UNIT
//DD2 DD UNIT=&UNIT

//STEP1 EXEC PROC1,UNIT=TEMPDA will set &UNIT as TEMPDA for this run of
procedure.

Statements Not Allowed in a Procedure


You can place most statements in a procedure, but there are a few
exceptions. Some of these exceptions are:
1. The JOB statement and JES2/JES3 Control statements.
2. The JOBCAT and JOBLIB statement.
3. An instream procedure (an internal PROC/PEND pair)
4. SYSIN DD *, DATA statements

Nested Procedures-Add/Override/Nullification is applicable at only one level. In other


words, if PROCA calls PROCB and PROCB calls PROCC, then no statement in PROCC
can be overridden from PROCA invocation. Only PROCB can do that.
Mainframe Refresher Part-1 JCL-Page:21

IEBCOPY
It is used to copy one or more members from an existing dataset to a new or
existing PDS data set. It can be also used for compressing PDS, Loading PDS to TAPE
and unloading from TAPE to disk. This utility needs two work files SYSUT3 and
SYSUT4 in addition to SYSIN and SYSPRINT.

FIELD Meaning
COPY Function is COPY
SELECT Specifies the members to be copied/replaced
Syntax: (NAME-IN-OUTPUT,NAME-IN-OUTPUT,REPLACE-IF-EXISTS)
EXCLUDE Specifies the members to be excluded from copy
LIST=YES Displays the copied members in the SYSPRINT.
INDD Points to input dataset
OUTDD Points to output dataset. Should exist on the same line of COPY.

IEBCOPY- CONTROL CARD FOR MERGING TWO LIBRARIES


//SYSIN DD *
COPY OUTDD=OUTPUT INDD=(INPUT01,(INPUT02,R),LIST=NO)
/*
It says DD statements INPUT01 and INPUT02 are input files. OUTPUT is the
output file. Note the 'R' in (INPUT02,R). It instructs to IEBCOPY that like named
members are to be replaced. LIST=NO indicates that the names of the members
copied need not be listed in the SYSPRINT dataset.

IEBCOPY-CONTROL CARD FOR SELECTIVE


COPY/REPLACE COPY OUTDD=OUTPUT,INDD=INPUT01
SELECT MEMBER=((MEM1,NEWNAME,R),
(MEM2,,R))
MEM1 is copied as NEWMEM in OUTPUT. If already
NEWMEM exist, it will be replaced.

IEBCOPY-CONTROL CARD FOR OMITTING SELECTED


MEMBERS COPY OUTDD=OUTPUT,INDD=INPUT01
EXCLUDE MEMBER=(MEM1,MEM2)
All the members except MEM1 and MEM2 are copied into
OUTPUT from INPUT01.
//SYSPRINT DD SYSOUT=*
IEBCOPY-Complete
//COMPFILE step for Compressing PDS
DD DSN=MM01.COPYLIB.COB,DISP=OLD
//COMPRESS EXEC PGM=IEBCOPY
//SYSUT3 DD UNIT=SYSDA,SPACE=(TRK,(1,1))
//SYSUT4 DD UNIT=SYSDA,SPACE=(TRK,(1,1))
//SYSIN DD *
COPY OUTDD=COMPFILE,INDD=COMPFILE
/*
Mainframe Refresher Part-1 JCL-Page:22

IEBGENER
In addition to SYSIN and SYSPRINT datasets, it needs SYSUT1 and SYSUT2
datasets. SYSUT1 is coded with input dataset and SYSUT2 is coded with output
dataset. If attributes were not given for SYSUT2, then the program would assume
SYSUT1 attributes for SYSUT2.
It is primarily used as COPY utility. If you want to copy any TAPE file to DISK
or DISK to TAPE, then no SYSIN is needed.
If you want to reformat your input file or if you want to create members out
of your PS file, then you need control card (SYSIN) and the first statement should be
GENERATE.

FIELD Meaning
GENERATE First Statement which sets the values for MAXNAME,MAXGPS,
MAXLITS, MAXFLDS
MAXNAME Maximum MEMBER statements that can follow.(During member
generation)
Syntax: MAXNAME=3
MAXGPS Maximum IDENT statement that can follow. (During member
generation)
MAXFLD Maximum FILED statements that can follow. (During reformatting)
Syntax: MAXFLDS=10
MAXLITS Maximum size of literal during reformatting.
MEMBER It identifies the name of the member to be created.
Syntax: MEMBER NAME=MEM1
RECORD It usually follows MEMBER statement to identify the last record to be
IDENT copied from the input dataset.
RECORD IDENT= (Length,’Literal’,Start-Column)

Example: RECORD IDENT=(3,’MVS’,1), then the last record to be


copied into the member from the input dataset, has MVS in column
1-3.
RECORD It is used for reformatting the records in the input file.
FIELD RECORD FIELD=(Length, ’literal’ or input column, conversion, output
column)
Output column says where the field should be placed in the output
file. Conversion can be ZP or PZ. PZ means the input packed decimal
field is being converted into zoned format and ZP is the reverse.

IEBGENER- SYSIN CARD FOR CREATING THREE MEMBERS FROM INPUT PS FILE
//SYSIN DD *
GENERATE MAXNAME=3,MAXGPS=2
MEMBER NAME= MEMB1
RECORD IDENT=(8,'11111111'.1)
MEMBER NAME=MEMB2
RECORD IDENT=(8,'22222222',1)
MEMBER NAME=MEMB3
//

IEBGENER creates three members. It reads input file writes into memb1 until it finds
11111111 in column 1. In the same way it reads and writes the records into memb2
until it finds 22222222 in column 1. The remaining records in the input dataset are
copied into MEMB3.
Mainframe Refresher Part-1 JCL-Page:23

IEBGENER- SYSIN CARD FOR REFORMATTING DURING COPY


//SYSIN DD *
GENERATE MAXFLDS=5,MAXLITS=4
RECORD FIELD=(5,1,,1),FIELD=(20,21,,6),FIELD=(9,61,ZP,26), X
FIELD=(9,70,ZP,31),FIELD=(4,'TEST',,36)
/*

Input Column Any Conversion Output column


Values in column 1-5 Copied into column 1-5
Values in column 21-40 Copied into column 6-25
Values in column 61-9 Convert the zoned into Packed value is written in
packed before copying. 26-30
Values in 70-9 Convert the zoned into Packed value is written in
packed before copying. 31-35
TEST literal is written in
column 36-39

IEHLIST
It is used to list
1. The entries in the catalog. (SYSIN KEYWORD- LISTCTLG)
2. Directory(s) of 1-10 PDS (SYSIN KEYWORD- LISTPDS)
3. The entries in VTOC. (SYSIN KEYWORD-LISTVTOC)
Code SYSIN, SYSPRINT and one more DD that will mount the volume queried in
SYSIN.

The following JOB lists the VTOC of INTB01 in a formatted way.


//MYJOB JOB CLASS=A,MSGCLASS=A,REGION=256K,MSGLEVEL=(1,1)
//LISTVTOC EXEC PGM=IEHLIST
//SYSPRINT DD SYSOUT=*
//VOLDD DD UNIT=SYSDA,VOL=SER=INTB01,DISP=OLD
//SYSIN DD *
LISTVTOC FORMAT,VOL=3330=INTB01
/*
To list the contents of any PDS:
LISTPDS DSNAME=(SYS1.LINKLIB), VOL=SER=INTB01.

To list the catalog for a specific DASD volume:


LISTCTLG VOL=3350=PUB000

IEHMOVE
It is used to move one dataset from one volume to another volume.

//STEP01 EXEC PGM=IEHMOVE


//FROMVOL DD VOL=SER=TST001,DISP=OLD,UNIT=SYSDA /*ALLOCAT FROM
VOLUME*/
//TOVOL DD VOL=SER=PRD001,DISP=OLD,UNIT=SYSDA /*ALLOCATE TO
VOLUME*/ DD UNIT=SYSDA,VOL=REF=SYS1.SVCLIB,DISP=OLD
//DD01
//SYSPRINT DD
//SYSIN DD *SYSOUT=*
MOVE PDS=MUTHU.TEST.PDS,TO=3380=PRD001,FROM=3380=TST001
/*
FROM clause in the SYSIN is not needed for catalogued datasets. It is suggested to
allocate the Supervisor Call Library.
Mainframe Refresher Part-1 JCL-Page:24

IEBCOMPR
It is used to compare two PS or PDS datasets. Two PS are same, if the
number of records is same and all the records are identical. SYSIN is not needed for
PS comparison. If they are not identical, then the following will be listed in the
SYSPRINT.
DD statements that define the dataset, Record and Block numbers, the
unequal records and maximum of 10 unequal records found.
Two PDS are same, if the corresponding members contain same number of
records and all the records are identical. SYSIN should have COMPARE TYPE=PO for
PDS.
//SYSUT1 INPUT DATASET 1
//SYSUT2 INPUT DATASET 2
//SYSPRINT
//SYSIN DD *

DFSORT
If you do a global search of your JCL inventory, you will find the program that
is used very frequently is SORT. There are two famous SORT products are available
in the market. One is DFSORT and the other is SYNCSORT. The basic commands in
both the products are same.
ICETOOL provides a lot more than what SORT can offer and it comes with
DFSORT product. SYNCTOOL comes with SYNCSORT product. PGM=SORT can point
to DFSORT or SYNCSORT. It is actually an alias to SORT product in your installation.
DFSORT is IBM product and it needs the following datasets for its
operation.
SORTIN (Input dataset), SORTOUT (Output dataset), SYSIN (Control
Card) and SYSOUT (Message dataset).
Mainframe Refresher Part-1 JCL-Page:28

IEHPROGM
It is used to
1.Catalog a dataset (CATLG DSNAME=A.B.C, VOL=SER=nnnn)
2.Uncatalog a dataset (UNCATLG DSNAME=A.B.C)
3. Rename a dataset (RENAME
DSNAME=A.B.C,VOL=SER=nnnn,NEWNAME=D.E.F)
4.Create an index for GDG (BLDG INDEX=gdg-name, LIMIT=n, [,EMPTY][,DELETE])
5.Deleting the index for GDG (DLTX INDEX=index-name)
The SYSIN cards are given in bracket. The utility needs two work datasets and
SYSPRINT for messages. Continuation of control card needs to be indicated by ‘X’ in
72nd column.
If your shop installed SMS, then uncatalog wont work it out because SMS
handles the catalog.
Mainframe Refresher Part-1 JCL-Page:29

IEHINITT
It is used to initialize a tape. It will write the volume serial number to the tape.

//STEP01 EXEC PGM=IEHINITT


//SYSPRINT DD SYSOUT=*
//LABEL DD DCB=DEN=3,UNIT=(TAPE,,DEFER),DISP=(,KEEP),LABEL=(,SL)
//SYSIN DD*
LABEL INITT SER=DEVSMS,DISP=REWIND
/*

Generation Data Group (GDG)


GDG is group of datasets that are related to each other chronologically or
functionally. Each of these dataset is called a generation. The generation number
distinguishes each generation from others.

If the GDG Base is MM01.PAYROLL.MASTER, then their generations are


identified using the generic name “MM01.PAYROLL.MASTER.GnnnnVxx.” nnnn
is generation number (01-9999) and xx is version number (00-99).

Referring Generations in JCL


The current generation is referred by GDGBASE(0), the previous generation
by GDGBASE(-1) and the next generation by GDGBASE(+1).

GENERATIONS ARE UPDATED ONLY AT THE END OF THE JOB. It


means, if the
first step creates one generation, code it as GDGBASE(+1) and if the second
step
creates another generation, then it SHOULD be coded as GDGBASE(+2) as
the (+1) version is not yet promoted to current version. Similarly to refer the GDG
created in the second step, refer it by GDGBASE(+2).

GDG datasets can be also referenced with their generation number


like
‘MM01.PAYROLL.MASTER.G001V00’

Advantage of GDG
1. GDG datasets are referred in the JCL using GDG base and relative number. So
the same JCL can be used again and again without changing the dataset name and
this is the biggest advantage of GDG.

2. GDG Base has pointers to all its generations. When you want to read all the
transactions done till today, you can easily do it by reading the GDG base if it is
available. Otherwise you have to concatenate all the transaction files before reading.

Creation of GDG

1.GDG Base Purpose


Parameter is created using IDCAMS. The parameters given while creating
the
NAMEGDG are: Base of the GDG is given here.
LIMIT The maximum number of GDG version that can exist at any point
of time. It is a number and should be less than 256.
EMPTY/NOEMPTY When the LIMIT is exceeded,
EMPTY keeps ONLY the most recent generation.
NOEMPTY keeps the LIMIT number of newest generation.
Mainframe Refresher Part-1 JCL-Page:30

SCRATCH/ SCRATCH un-catalogue and deletes the versions that are not
NOSCRATCH kept.
NOSCRATCH just does un-cataloguing and it is not physically
deleted from the volume.
OWNER Owner of the GDG.
FOR DAYS (n) / Expiry date. Can be coded either in the unit of days or till
TO (DATE) particular date.

2. Model dataset is defined after or along with the creation of base. Once model DCB
is defined, then during the allocation of new versions, we no need to code DCB
parameter. Model DCB parameter can be overridden by coding new parameter while
creating the GDG version. It is worth to note that two GDG version can exist in two
different formats.

A step that defines a GDG and allocates a model DSCB

//GDG EXEC PGM=IDCAMS


//SYSPRINT DD SYSOUT=*
//MODEL DD DSNAME=MM01.PAYROLL.MASTER,DISP=(,KEEP),
// UNIT=SYSDA,VOL=SER=MPS800,SPACE=(TRK,(0)),
// DCB=(DSORG=PS,RECFM=FB,LRECL=400)
//SYSIN DD *
DEFINE GDG ( NAME(MM01.PAYROLL.MASTER) -
LIMIT(5) -
NOEMPTY -
SCRATCH )
/*

ABENDS

SB37, Space AENDS. Refer Space parameter for solution.

SD37,
SE37
S80A, Region Problem. Refer REGION parameter for solution.

S804,
S822
S122, Job is cancelled. S122 – Operator cancelled your job as it requests some
S222 unavailable resource. S222-You cancelled your job.
S322 TIME OUT. Refer TIME parameter for solution.
S522 JOB exceeded maximum wait time.
S722 Output lines exceeded the limit set by OUTLIM OR LINES parameter.
S706 Load module found but it is not executable
S806 Load module not found.
S0C1 Operation exception. Misspelled DD names
S0C4 Protection exception – Trying to access a memory location for which you
don’t have access.
Ex: Accessing 11th element of an array of size 10 in the program compiled
with SSRANGE, Trying to read/write an unopened file.
S0C5 Addressing exception – Trying to access a memory location that is not
available in memory.
Mainframe Refresher Part-1 JCL-Page:31

S0C7 Data Exception: Non-numeric operation on numeric field. It is usually due to


un-initialized numeric item
S0C8- Fixed Point- Overflow and Divide exceptions respectively.
S0C9
S0CA, Decimal Point- Overflow and Divide exception respectively.
S0CB
S0CC, Floating Point- Exponent Underflow and overflow exceptions respectively.
S0CD
S013 Open Problem. Usually this ABEND occurs, when the program tries to read a
member of PDS and the member is not found.
Ex: During compilation, if you code a non-existing member as source
(SYSIN).
S878 Memory issue. Usually this ABEND occurs in TSO, while executing your job
using XPEDITOR. Close any other screens that are open and then try to re-
execute the JOB.
Mainframe Refresher Part-1 JCL-Page:40

What is PSW?
PSW is program status word. It is double word control register that is
managed by both MVS and the hardware. Second word contains the next sequential
instruction to be executed.

Can I write a dataset, which has a disposition of SHR?


Yes. But it is not advisable. Write should take exclusive access over the
dataset before writing for maintaining integrity.

What are the ways, records can be appended to a file?


1. DISP as MOD and OPEN OUTPUT
2. DISP as OLD/SHR and OPEN EXTEND

How to do you check an empty file in batch stream?


3.IDCAMS – PRINT command with COUNT(1) will result return code 4, if the
file is empty.
4.IEBCOMPR comparison of two empty files would give non-zero return
code. So check your file with a known empty file.

How do you check whether file is exist or not, in batch stream?


1. Do a LISTCAT on the file. If it is not found, you will get return code
16.

If the space parameter is SPACE=(TRKS,(20,20,10)) ,What you can say about this
dataset?
This dataset needs 20 tracks for primary allocation and 20 * 15 = 300 tracks
secondary allocation (step-by-step). So it can get 320 tracks in the best case. In the
worst case, it can get as low as 80 tracks. (Refer the extents section of the JCL). The
dataset is a PDS and 10 directory blocks are allocated for this PDS. We can
store 50- 60 members in this dataset. (10 *(5-6) = 50-60).

Do I need to mention SPACE for tape dataset?


No.

What the PERFORM parameter of EXEC does?


It is used to specify the performance group for the job step. The performance
group determines, the rate at which the job steps in a program have access to
system resources and it is helpful in optimizing system performance.

Can I recover a rolled out GDG version?


If it is not scratched, you can recover it using HRECOVER command.

When I am trying to edit a dataset, I get ‘dataset-in-use’ error message. My


job is
waiting for a dataset for a long time. How do I know who is using this
dataset?
Way 1: TSO WHOHAS ‘dataset-name’ , lists you the users/jobs using the
dataset.
Way 2: ISPF 3.4, try to edit the dataset. You will get dataset-in-use message.
As you
can ask more detail in ISPF for any error message by pressing F1, press F1
again, ISPF lists you the users/jobs using the dataset.

What is the difference between PDS and PDSE?


No compression is needed for PDSE datasets. When you delete a member, the
system makes it space available for use -No directory space needs to be set aside for
Mainframe Refresher Part-1 JCL-Page:41

member names. Any PDSE can contain as many as 524286 members, assuming
there is enough space to store them- PDSE is faster compared with PDS.

When PDS compressing gives me more space, why the same is not happening with
PS?
In PS, data is overwritten every time. In PDS, every change creates a new
version on SAVE command. The compression of PDS releases the space occupied by
all prior versions and so you are getting more space. That is the reason why
frequent save commands are avoided in PDS.

Does it mean that I can retrieve the previous version of a member in PDS?
If you didn’t compress your PDS, you can retrieve all the prior versions before
the previous compression. But ISPF didn’t provide option for this. You have to go for
some third part product like STARTOOL (Serena).

I want to schedule my job tonight at 12:00 PM for some specific requirement (in test
region). I don’t want to stay late, just to submit a long running job. Can I schedule
this job so that it can automatically submitted at 12:00 PM?
If you are using JES3, then you can try with DEADLINE command. But most of
the installations have JES2. In JES2, distributed environment, such commands are
not provided. But you can do it if you know the SLEEP function of OS. You
can submit a job before you leave for the day, which invokes a REXX program in
batch.
The REXX program can use sleep function and it can check the time for every
1 hour till 11 reaches and then for every 10 minutes till 11:50 reaches and
afterwards for every 1 minute. And as soon as 12:00 PM is reached, using
TSO SUBMIT command, it can submit the job. REXX can stay late instead of you!!
(Check our REXX section for SLEEP command syntax).

You might also like