0% found this document useful (0 votes)
27 views41 pages

Mainframe JCL Referesher

Uploaded by

Balaji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views41 pages

Mainframe JCL Referesher

Uploaded by

Balaji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

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 the program need to be executed, the data for the program and
the sequence of programs. CONTROL involves 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 statement should have // in column 1 and 2. STAR (‘*’) in the third column,
indicates that the line is a comment.

NAME is optional field. If coded, it should start at column 3 and can have maximum 8
characters. Alphanumeric and national characters are allowed in the NAME. The first
character must not be a number.

OPERATIONAL 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. OPERAION field can be JOB, EXEC and PEND.

OPERANDS are the parameter 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 next line. To continue the current line, end the
current line before column 72 with ‘,’ and start the next line anywhere between
column 4-16.

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.

JES2 is a decentralized environment. Every processor processes the incoming jobs


individually. JES3 is centralized environment. There is a global processor, which
controls all the other processors and assigns the jobs to them.

The datasets are pre-step allocated in JES2. That is, the datasets are allocated just
before the execution of that step. The datasets are pre-job allocated in JES3.
That is, all the datasets referred in the Job are allocated before the JOB starts its
execution. Most of the installation uses JES2.

JCL Statements

JOB. It should be the first statement in the JCL. It indicates accounting information
and JOB related information to the system.

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 contain the
data that need to be processed by the program or data that is produced by the
program.

Abnormal End (ABEND) & ERROR


Once the work to be done is written in JCL, it can be submitted to the
operating system using SUBMIT command.

JCL ERROR:
Submitted work (JOB) can be rejected before the execution and this is called
JCLERROR. It is generally due to the syntax error in the JCL coding. The error
message will appear in JES MESSAGES. Correct the error and submit the job once
again.

If there are no syntax errors, then the job start running step-by-step.
In JES2 system, all the resources needed for a particular step is allocated just before
the execution of that step. There are some errors that will be known only just before
the execution of the step. One example is duplicate dataset name. You are trying
cataloging a dataset, which is already available in the catalog.

ABEND:
ERROR occurs before the execution of JOB or STEP. But ABEND happens
during the execution of a program in a step. There may some invalid operation, the
operation that cannot be executed by the system in the program. When OS
encounters such an operation, the respective JOB is terminated with the ABEND
code.
Example: An arithmetic operation on computational field that have non numeric data
in COBOL.
Mainframe Refresher Part-1 JCL-Page:3

JOB Statement
Sample Syntax:
//JOBNAME JOB (ACCOUNTING INFO),(PROGRAMMER NAME),
// TIME=(MINUTES,SECONDS),
// CLASS=A,MSGCLASS=A,PRTY=14,ADDR=VIRT,
// REGION=nK,MSGLEVEL=(A,B),COND=(N,OPERATOR),
// 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 Department.)


1. Resource usages 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)


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

PRTY
Syntax: PRTY=N (N can be 0 – 15)
1. 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)
1. It is used to control the lists of information appear in the Job log. To get
maximum information in the listing, code MSGLEVEL as MSGLEVEL(1,1)
2. The first parameter controls the statements. (0-Only job statement, 1-JCL, JES
statement with expanded procedure, 2-Only JCL and JES statement).
3. The second parameter controls the messages. (0- Only Step execution messages,
1- All JCL, JES, operator and allocation messages).
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 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).
1. 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 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 allocates 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
When a job ABEND at STEP10 and if there are no dependencies, then the job
can be restarted from STEP10 instead of once again from STEP1.
RESTART parameter of JOB card provides option for this.
RESTART=STEP10 bypass STEP01 to STEP09 and start execution from STEP10.
If your job has procedures and one of the steps in the procedure is ABENDED,
then your restart parameter should be,
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.

Some installation use RESTART=* in their job card, that means start the execution
from step 1. In case real restart, we can just replace * with STEPNAME.

TYPRUN
It is used to request special job processing.
1. TYPRUN=SCAN checks the syntax errors without actual execution.
2. TYPRUN=HOLD checks 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 unlimited time
TIME=0 will produce unpredictable results.
The EXEC time limit or the JOB time remaining after execution of previous
steps, WHICHEVER IS SMALLER will be the time allowed for the job step.

Ex: //FIRST JOB (ACCT),TIME=3


//STEP1 EXEC PGM=PGMONE,TIME=2
//…
//STEP2 EXEC PGM=PGMTWO,TIME=2

In this job, though we have coded PGMTWO can use the processor for 2
minutes, if PGMONE already used 2 minutes of CPU time, then only one minute is
allowed for PGMTWO (as the complete JOB is allowed to run for only three minutes).
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 ore-defined with
CLASS parameter will be effective.

NOTIFY
TSO User-id to whom the job END / ABEND/ ERROR status should be notified.
NOTIFY=&USERID 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 id 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 ABENDED.
COND=EVEN allows the step execution independent of prior ABENDS.

Consider the COND parameter coded on EXEC statement,


Ex: //STEP2 EXEC=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
The return code from STEP1 is 89 or less.
Mainframe Refresher Part-1 JCL-Page:6

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

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)

PARM
1. It is used to pass variable information to the processing program, executed by this
job step.
2. If there is more than one sub parameter of if there is any special character then
enclose them in parentheses/quotes.
3. Maximum 100 characters can be passed in this way. Quotes and brackets are not
included in this 100.
4. The program can receive them using linkage section. Linkage section must be
coded with half word binary field as first field. This field is populated with length of
the PARM passed from the JCL.
Example:
//STEP3 EXEC PGM=WORK,PARM=(DECK,LIST,’LINECNT=80’,
// ‘12+80’,NOMAP)

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 operations) THEN
//…Steps...
// ELSE
//…Steps..
// END-IF.

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:
STEPNAME.ABEND=TRUE, STEPNAME.RUN=TRUE, STEPNAME NOT RUN
STEPNAME.ABENDCC = any-abend=code or
Mainframe Refresher Part-1 JCL-Page:7

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 he program (EMPPGM) in the
application reads this file, then JCL card for the DD looks like.

//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 file ASSIGN TO EMPFILE. (COBOL Program)


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

Maximum 3273 DD statements can be coded in a single EXEC step.

DSNAME(DSN)
The name of the dataset is coded in the DSN parameter. Dataset name can
contain 444 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 instruct the
system what to do with the dataset after successful/unsuccessful termination of the
step or job.
DISP=(current-status, normal-termination-status, abnormal-termination-status)

Current-status can be:

NEW Dataset does not exist. 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.
Mainframe Refresher Part-1 JCL-Page:8

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.

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
parameter. 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 record 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 record.

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 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 record 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 bloc.

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

BUFNO.
The number of buffers to be allocated for the dataset is coded with BUFNO
parameter. Maximum of 255 buffers can be coded. The performance of sequential
processing will increase if more buffers are allocated. The default buffers are enough
for most of the cases.
Mainframe Refresher Part-1 JCL-Page:9

Source of DCB:
We don’t always have to write the DCB parameter for a dataset. Writing DCB
parameter is one of the three ways, the information can be supplied. The other two
ways are:

1. Coded in the program. In COBOL, RECORD CONTAINS clause specifies the LRECL,
BLOCK CONTAINS clause specifies the BLKSIZE, RECORDING MODE clause specifies
RECFM and RESERVE clause specifies BUFNO. DSORG can be assumed from the
name of the dataset and the directory space allocation of SPACE parameter.

2. Usually for an existing dataset, we don’t have to code DCB parameters. It will be
available in the dataset label. The dataset label is created in the VTOC (DASD) or
along with dataset (TAPE) during the dataset creation.

LABEL
Syntax: LABEL = (Dataset-sequence-number
,label-type
,PASSWORD | NOPWREAD
,IN | OUT
,RETPD=nnn |EXPDT = (yyyddd|yyyy|ddd))

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.

Label – indicates the label type of the tape/cart volume.


SL - indicates that a dataset has IBM standard labels. Default value.
NL - indicates that a tape dataset has no labels.
NSL - indicates that a tape dataset has nonstandard labels.
SUP - indicates that a tape dataset both IBM standard and user labels.
BLP - request that the system bypass label processing for a tape dataset.

PASSWORD - indicates that a dataset cannot be read, changed, deleted or written


to unless the correct password is specified.
NOPWREAD - indicates that a dataset cannot be changed, deleted or written, unless
the correct password is specified. No password is necessary for reading the dataset.

IN - indicates that a dataset opened for I/O is to be read only.


OUT - indicates that a dataset opened for I/O is to be written only.

RETPD / EXPDT - indicates the retention period and the expiration date for a
dataset.

Ex: LABEL=EXPDT=04121 (Dataset expires in 121st day of 2004)


LABEL=RETPD=200 (Dataset is retained for 200 days)
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 from1 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 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 that allocated space must be equal to an integral number of cylinders.
Else ignored.

Extents
Extent is contiguous memory location. Only 16 extents are possible for a
physical sequential dataset in a volume. In loose terms, only 16 pointers can be
stored for a PS dataset in one volume. For a VSAM dataset it can be 123. In addition
to this, the primary (first) or secondary (consecutive) space request has to be met
within 5 extents.
If any of the above is not met, then there will be space ABEND. So far a PS
dataset, even though you request 1600tracks (using the space parameter
(SPACE=TRKS,(100,100)), the system may not allocate you 1600 tracks always.
If all the contiguous available spaces are of size 20 tracks, then 5 extends are
used for satisfying every primary or secondary. So 15 extents are used for providing
just 300 tracks. If the system could find any 100 tracks for the 16th extent, it would
offer it and if not, there will be space ABEND. So in the best case you will 1600
tracks and in the worst case you will get 400 tracks for the space parameter
mentioned.
Mainframe Refresher Part-1 JCL-Page:11

Space ABENDS:
If you go through the JOB failure history of any system, you will find the
frequency of space ABENDS are more than any other ABEND. The various space
ABENDS are listed below.

SB37: End of volume. We have requested 1600 tracks (including primary and
secondary). When the program tries to write more than 1600 tracks, the operation
ended with SB37. It should be noted that though I have requested 1600 tracks,
I may get this ABEND even after just 400 tracks. Because 1600 tracks is the best-
case allocation and 400 tracks is the worst-case allocation.

Solution:
1.Increase the size of primary and secondary reasonably. If you increase the size
blindly, then also you will get SB37 if the size of secondary or primary is not
available within five extents.

2.If the job again and again comes down, then simple solution is make the dataset
multi volume by coding VOL=(,,,3). Now the dataset will get space of 48 extents and
it would be more than enough for successful run.

SD37: Secondary space is not given. We have coded only the primary space and that
is already filled and then if the program tries to write more, you will get SD37 space
ABEND.

Solution:
Include the secondary space in the SPACE parameter of the dataset that has given
problem.

SE37: End of Volume. This is same as SB37. You will get this ABEND usually for a
partitioned dataset.

Solution:
If the partitioned dataset is already existing one, then compress the dataset
using ‘Z’ in ISPF/IEBGENER and then submit the job once again. If it again
ABENDED, then create a new dataset with more primary, secondary and directory
space and copy all the member of current PDS to the new PDS, delete the old,
rename the new to old and resubmit the JOB.

UNIT
It is used to request the system to place the dataset on a specific device/a
certain type of 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.
Mainframe Refresher Part-1 JCL-Page:12

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 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)

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 (@,#,$) character.
You can code a maximum o 255 volume serials.
Ex : VOLUME=SER=DEV001 VOL=(,,,3,SER=(PAGE01,PAAGE02,PAGE03))
Mainframe Refresher Part-1 JCL-Page:13

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 devices or devices for the output class. ‘*’ refer-
backs to MSGCLASS character of JOB CARD.

Positional and Keyword Parameter


All the parameters of JOB, DD and EXEC statements can be broadly classified
into two types. They are POSITINAL and KEYWORD parameters.
Parameter that has its meaning defined by its position is positional
parameter. Bypassing of any positional parameter has to be formed 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 statement 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 character coded
DLM=@@ in DLM appears at column 1 & 2.
//SYSIN DD DATA,DLM=##
//EMPFILE DD *
2052MUTHU
1099DEV
/*
##

OTHER Statements

OUTLIM
It limits the number of prints lines. The limit ranges from 1 to 16777215. the
job is terminated if the limit is reached.
//name DD SYSOUT=*,OUTLIM=3000
If the program tries to write 3001st line, JOB will ABEND with S722.
Mainframe Refresher Part-1 JCL-Page:14

DEST
The DEST parameter is used in conjunction with the SYSOUT parameter
where the output is to be sent. This might be used where a job is run on several MVS
systems and the output is directed to a single system for the convenience of the
end-user.
Syntax: //name DD SYSOUT=*,DEST=destination-ID

OUTPUT
OUTPUT statement is used to specify SYSOUT parameters for several DD
statements with a single JCL statement. It allows printing the output from single DD
statement several times, each with different SYSOUT parameter.
COPIES, OUTLIM, CLASS, DEST, FORMS, GROUPID, can be coded in OUTPUT.

DEFAULT=Y can be coded on JOB and STEP level. STEP level default overrides
JOBLEVEL default.

//TEST#10 JOB …
//STEP1 EXEC PGM=ONE
//FORM2 OUTPUT DEFAULT=YES.COPIES=2,DEST=PPP
//SYSPRINT DD SYSOUT=A == > Produces 2 copies at PPP
//STEP2 EXEC PGM=TWO
//FORM3 OUTPUT COPIES=3,DEST=XYZ
//SYSPRINT DD SYSOUT=Q,OUTPUT=(STEP2.FORM3,STEP1.FORM2)
== > Produces 3 copies at XYZ and 2 copies at PPP.

Maximum number of COPIES possible is 254.

FORMS
Specify the type of forms on which the SYSOUT datasets should be printed.
It is 1-8 alphanumeric or national characters. SYSOUT DD FORMS parameter
overrides OUTPUT PARMS parameter.
//name OUTPUT FORMS=form-name

FREE
The datasets are allocated just before the execution of step and de-allocated
after the execution of step. FREE parameter de-allocates the file as soon as the file is
closed. //DDNAME DD SYSOUT=X,FREE=CLOSE

INCLUDE
The purpose of INCLUDE statement is same as COPY statement of COBOL
program. This is used to specify a PDS member that will be copied into the JCL at job
submission time. It is used to specify a standard list of DDNAMES, which would
otherwise be duplicated in many similar PROCS. This also has the advantage that
amendments need only be made in one place. But it makes JCL unnecessarily
fragmented or difficult to read/maintain in a live environment.

// 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.
Mainframe Refresher Part-1 JCL-Page:15

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

START in the SYSOUT parameter refer back to MSGCLASS of JOB card.

Refer-back example:
//STEP1 EXEC PGM=TRANS
//TRANFILE DD DSNAME=AR.TRANS.FILE,DISP=(NEW,KEEP),
// UNIT=SYSDA,VOL=SER=MPS800,
// SPACE=(CYL,(5,1),
// DCB=(DSORG=PS,RECFM=FB,LRECL=80)
//TRANERR DD 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

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 resides on different devices and device types.
Mainframe Refresher Part-1 JCL-Page:16

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. It 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.
SYSDUMP
Prints the program area, contents of registers, and gives a trace back of
subroutines called. It will be in hexadecimal format.
SYABEND
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:17

Procedures
Set of Job control statements that are frequently used are saved separately
as procedures and invoked in the JOB. The use of procedures helps in minimizing
duplication of code and probability of error. This is because a procedure should
consist of pre-tested statements. Each time a procedure is invoked, there is no need
to retest its functionality, since it is pre-tested.

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


procedure. They start with PROC statement and end with PEND statement. They
should be coded before first EXEC statement.

If a procedure exists in a PDS, it is called as catalogued procedure. PEND


statement is not needed for catalogued procedures. One procedure can invoke
another procedure and this is called nesting. Nesting can be done till 15 levels. But
there is an indirect of limit of 255 steps. So we have to make sure than expansion of
any proc in the JOB is not exceeding this limit on number of steps.

//procedure PROC <== names the cataloged/in-stream procedure.


// JCL statements
// PEND == > Only for instream procedure to point end of an
instream proc

You execute the JCL statements contained in the cataloged procedure by


writing:

// EXEC procedure

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, TIME.COB=(0,10) => Adds 10 seconds time limit for COB step.
// EXEC COBCLG, REGION.COB= => Nullifies 400K region request. Default
Region will be allocated now.
Mainframe Refresher Part-1 JCL-Page:18

Other Rules:
1. Multiple overrides are allowed but they should follow the order. That is first you
should override the parameters of step1, then step2 and then step3. Any overrides
in the wrong order are IGNORED.
2. If the STEPNAME is not coded during override, then the system applies the
override to first step alone.
//EXEC COBCLG,REGION=512K

Procedure Modification- DD Statement


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

1. DD statement overrides should be done in the same order they appear in


procedure. Within a DD statement, the order of parameter does not matter.

2. Any additions should follow modification. 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 fro ma 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 PROC,UNIT=TEMPDA will set &UNIT as TEMPDA for this run of
procedure.

Statement Not Allowed in a Procedure


You can place most statements in a procedure, but there are a few
exceptions.
1. The JOB statement and JES2/JES3 Control statements.
2. The JOBCAT and JOBLIB statements.
3. An in-stream procedure (an internal PROC/PEND pair)
4. SYSIN DD *, DATA statements
Mainframe Refresher Part-1 JCL-Page:19

Procedure Example

SMSXL86.TEST.PROCLIB(EMPPROC)
//EMPPROC PROC CLASS=’*’,SPACE=’1,1’
//*default values are coded for the symbolic parameters CLASS and SPACE
//STEP1A EXEC PGM=EMPPGM
//SYSOUT DD SYSOUT=&CLASS
//EMPMAST DD DSN=&HLQ..EMPLOYEE.EDS,DISP=SHR
// DD DSN=&HLQ..EMPLOYEE.MBT,DISP=SHR
// DD DSN=&HLQ..EMPLOYEE.IBM,DISP=SHR
//* &HLQ is a symbolic parameter that don’t have default value. So it has to be
//* provided during the invoke of this proc.
//EMPOUT DD DSN=&&INVSEL,DISP=(NEW,PASS),
// UNIT=SYSDA,SPACE=(CYL,(&SPACE))
//INVSEL is a temporary dataset.
//EMPCNTL DD DUMMY
//* EMPCNTL is a control card and any in-stream data can be coded during the
//* invoke.
//*
//INV3020 EXEC PGM=EMPRPT
//SYSOUT DD SYSOUT=&CLASS
//INVMAST DD DSNNAME=&&INVSEL,DISP=(OLD,DELET)
//*temporary dataset INVSEL is deleted here.
//INVSLST DD SYSOUT=&CLASS

SMSXL86.TEST.JCLLIB(EMPJCL)
//EMPJCLA JOB (1000,200),CLASS=A,MSGCLASS=Q,NOTIFY=&SYSUID
//PROCLIB JCLLIB ORDER=(SMSXL86.TEST.PRCLIB)
// SET SPACE=’1,1’
//*SET statement is used for substituting the symbolic variables.
//STEP01 EXEC EMPPROC,PARM.STEP1A=’02/11/1979’,HLQ=PROD
//* STEP1A PARM is added and value for symbolic parameter HLQ is supplied.
//STEP1A.EMPMAST DD
// DD DSN=PROD.EMPLOYEE.CTS,DISP=SHR
//*Instaed of PROD.EMPLOYEE.MBT, PROD.EMPLOYEE.CTS dataset is used whereas
//*other two datasets PROD.EMPLOYEE.EDS and PROD.EMPLOYEE.IBM retains there
//*position in concatenation.
//STEP1A.EMPOUT DD UNIT=TEMPDA
//*UNIT parameter of EMPOUT file is modified
//STEP1A.EMPCNTL DD *
DESIG=SSE
/*
//*EMPCNTL control card value is passed.
//STEP1A.EMPOUT2 DD DSN=PROD.EMPLOYEE.CONCAT,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(10,10))
//*EMPOUT2 file is added to the step STEP1A.

In the above example, CLASS retains the default value coded on the PROC definition
Statement (CLASS=’*’).
Mainframe Refresher Part-1 JCL-Page:20

IBM Utilities
IBM has provided utilities for the frequent file operations, as application
programmer used to do. By familiar with these utilities, one can effectively develop
an application by reducing the work in programming side. For example, if you want
to select particular set of records from a master file for special processing, then you
can easily complete this task if you are aware of SORT utility. Otherwise you would
have gone for a new program coding, compilation, testing etc.

IKJEFT01
IKJEFT01 is known as terminal monitor program. All the TSO commands can
be executed in batch using this program. DB2 program are run in batch using this
program. IKJEFT1A and IKJEFT1B are two alternate entry point of this program.

Example: IKJEFT01 for TSO command execution

//STEP EXEC PGM= IKJEFT01


//SYSPRNT DD SYSOUT=*
//SYSTSIN DD *
SE ‘HELLO..HOWZ THE PREPARATION GOING ON:’ U(ABCD)
/*

The above step executes TSO SEND command in batch. It sends the message to user
ABCD.

IEFBR14
It is a dummy Program. This is two line assemble program which Clears
register 15 and branch to register 14. So whatever operation you do with IEFBR14,
you will get return code of 0. In this sense, we cannot call this as utility program. But
it is as useful as any other utility program.

If you return the job without deleting the dataset created by the job in the
prior run, then your job will end with JCLERROR with message ‘duplicate dataset
name found’. (NOTCAT2). To avoid this, all the dataset are deleted in the first step
using IEFBR14. Disposition of the dataset should be (MOD,DEL,DEL) so that if the
dataset is not found, it will be allocated and deleted.
It can be used for allocating datasets.
It can be used for deleting the datasets in TAPE, which you cannot do in TSO.

Example:
//STEP1 EXEC PGM=IEFBR14
//DD1 DD DSNAME=MM01.COPYLIB.COBOL,DISP=(NEW,CATLG),
// UNIT=SYSDA,VOL-SER=MPS8BV,
// SPCAE=(3200,(1000,250,5),,,ROUND),
// DCB=(DSORG=PO,RECFM=FB,LRECL=80)
//DD2 DD DSNAME=MM01.TEST.DATA,DISP=(OLD,DELETE)
Cause OS/390 to allocate and catalog the data set named MM01.COPYLIB.COBOL
and delete the data set named MM01.TEST.DATA.
Mainframe Refresher Part-1 JCL-Page:21

IEBCOPY
It is used to copy one or more member from an existing dataset to a new or
existing PDS dataset. 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 SYSORINT.

FIELD Meaning
COPY Function is COPY
SELECT Specifies the member to be copied/replaced
Syntax: (NAME-IN-OUTPUT,NAME-IN-OUTPUT,REPLACE-IF-EXISTS)
EXCLUDE Specifies the member 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 (INOUT02,R). IT instruct to IEBCOPY that like named
members are to be replaced. LIST=NO indicates that the names of the members
copied need to 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 member except MEM1 and MEM2 are copied into OUTPUT from INPUT01.

IEBCOPY-Complete step for Compressing PDS


//COMPRESS EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//COMPFILE DD DSN=MM01.COPYLIB.COB,DISP=OLD
//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 attribute 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 value 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 FIELD 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=MM!
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 record in the input file.
FIELD RECORD FILED=(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 record into memb2
until it finds 22222222 in column 1. The remaining records in the input datsets are
copied into MEMB3.
Mainframe Refresher Part-1 JCL-Page:23

IEBGENER- SYSIN CARD FOR REFORMATTING DURING COPY


//SYSIN DD *
GENERATE MAXFLD=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 column 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.

Example:
The following JOB lists the VTOC of INTB01 in a formatte way.
//MYJOB JOB CLASS=A,MSHCLASS=A,REGION=256KMSGLEVEL=(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, replace the LISTVTOC command in the SYSIN
card with this: LSTPDS DSNAME=(your.pds.name)

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 *
Mainframe Refresher Part-1 JCL-Page:24

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).
Message dataset can be altered using MSGDDN= parameter of SYSIN.

SORT Card to copy all the records from SORTIN to SORTOUT


SORT FIELDS=COPY.

SORT card to skip first 100 records and then copy 20 records
SORT FIELDS=COPY SKIPREC=100 STOPAFT=20

SORT cards to sort he records based on key fields


SORT FIELDS=(STARTPOS,LENGTH,TYPE,ASC|DESC)
Type = CH (Character), BI (Binary), ZD (Zoned Decimal), PD (Packed Decimal),
FS (Signed numbers)

Ex: SORT FIELDS=(1,10,CH,A,15,2,CH,A)


SORTS all the SORTIN records with 1-10th column as major key and 15-16th column
as minor key before writing to SORTOUT.

SORT card to select the records meeting the criteria


INCLUDE COND=(STARTPOS,LENGTH,TYPE,RO,VALUE)
RO-Relational operator can be EQ,NE,LT,GT,LE,GE.
Card to select the records with TRICHY in the column 4-9
INCLUDE COND= (4,6,CH,EQ,C’TRICHY’)
Card to select the records which has same values in 2-3 and 5-6
INCLUDE COND= (2,2,CH,EQ,5,2,CH)

SORT card to reject the records meeting the criteria


OMIT CARD=(STARTPOS,LENGTH,TYPE,RO,VALUE)
Card to reject the records with TRICHY in the column 4-9
OMIT COND= (4,6,CH,EQ,C’TRICHY’)
Card to reject the records which has same values in 2-3 and 5-6
OMIT COND= (2,2,CH,EQ,5,2,CH)

Sort card to change the PD to ZD


If input file has a PD field S9(5)V99 Comp-3 and to reformat as PIC S9(5).9(2) then
use,
OUTREC FIELDS=(1,5,PD,EDIT(STTTTT.TT),SIGNS=(,-,,))
Mainframe Refresher Part-1 JCL-Page:25

SORT card to remove the duplicates


SORT FIELDS= (1,5,CH,A),EQUALS
SUM FIELDS+NONE
SORTIN records are sorted on the key 1-5 and if more than one record is
found to have same key, then only one record will be written to SORTOUT. If
EQUALS is coded, then the record to be written is the FIRST record else it can be
anything.

SORT card to sum the values for same-key records


SORT FIELDS= (1,5,CH,A),EQUALS
SUM FIELDS=(10,5,PD)
SORTIN records are sorted on key 1-5 and if more than one record is found to
have same key, then the records are summed on column 10-14 and one record is
written with total sum.

SORT cad to add sequence number to the output file


OUTREC=(1,20,SEQNUM,4,ZD)  4 digit zoned decimal sequence number is
added with all he records of input file in column 21-24
This will be useful for reading a file from bottom to top. This will be useful for
matching logic in JCL. Matching logic in JCL will be explained later.

SORT card to restructure the input file before feeding to sort


INREC FIELDS=(37,2,6,6,40,4,31,2)
The length of the output file is 14.

SORT card to create multiple files from single input file (Maximum 32 files)
OUTFIL FIELS=1 INCLUDE=(1,6,CH,EQ,C’MUMBAI’)
OUTFIL FIELS=2 INCLUDE=(1,6,CH,EQ,C’TRICHY’)
Code output files as SORTOF1 and SORTOF2.

SORT card to restructure the sorted file before writing


OUTREC FIELDS=(1:1,20, => FIRST 20 CHAR FROM INPUT FILE
21:C’MUTHU’, = > FOLLOWED BY STRING MUTHU
26:10Z, => FOLLOWED BY 10 BINARY ZEROS
36:21,10) => 21st to 10 CHARACTERS FROM INPUT FILE.

SORT card to change any ‘XX’ in the column 6-7 to ‘YY’


OUTREC FIELDS=(1:2,5,
6:1,2,CHANGE=(2,C’XX’,C’YY’),NOMATCH=(6,2),
8,42)

SORT card to merge


MERGE FIELDS=(STARTPOS,LENGTH,TYPE,ASC|DESC,STARTPOS,…)
128 such Keys can be given. Datasets to be merged are coded in SORTIN00 to
SORTIN99.
Mainframe Refresher Part-1 JCL-Page:26

ICETOOL

DD statements in ICETOOL:
TOOLMSG FOR ICETOOL MESSAGES
DFSMSG FOR SORT MESSAGES
TOOLIN FOR ICETOOL-CONTROL-CARD
XXXXCNTL FOR SORT-CONTROL-CARD USED BY ICETOOL
XXXX is coded in USING clause of TOOLIN.

TOOLIN card to copy


COPY FROM(INDD) TO(OUTDD) ( Up-to 10 DD can be given).

TOOLIN card to copy only unique records


UNIQUE FROM(INDD) ON(STARTPOS,LENGTH,TYPE)
COPY FROM(INDD) TO(OUTDD)

TOOLIN card to copy unique/selected duplicate records


SELECT FROM(INDD) TO(OUTDD) ON (STARTPOS,LENGTH,TYPE)
NODUPS/ALLDUPS/LOWER(n)/HIGHER(n)/EQUAL(n)/FIRST/LAST

NODUPS - COPY only the unique records.


ALLDUPS - COPY only the duplicates.
HIGHER(n) - COPY those duplicates that occurs more than n times (n = > 1-99)
LOWER(n) - COPY those duplicates that occurs less than n times (n = > 1-99)
EQUAL(n) - COPY those duplicates that occurs exactly n times (n = > 1-99)
FIRST - Retains the first copy in case of duplicates
LAST - Retains the last copy in case of duplicates

TOOLIN Card to get the statistics of a numeric field


STATS FROM(INDD) ON(START,LENGTH,TYPE)
Print the maximum, average and total for numeric fields. (10 ON possible)

TOOLIN Card to get the number of unique values in a field


UNIQUE FROM(INDD) ON(START,LENGTH,TYPE)
Print count of unique values.

TOOLIN Card to get all the values for a particular field


DISPLAY FROM(INDD) ON(STARTPOS,LENGTH,TYPE) LIST(LISTDD)
Prints values of a field in the input dataset to :ISTDD. (20 ON possible)

TOOLIN Card to get al the values for a particular field – With Occurrence constraint
OCCURS FROM(INDD) ON(STARTPOS,LENGTH,TYPE) LIST(LISTDD) OPTION
OPTION = > HIGHER(n) LOWER(n) EQUAL(n) ALLDUPS NODUPS
HIGHER(2) means only the values that are repeated more than 2 times is reported at
LISTDD dataset.

TOOOLIN Card to get number of records fell into the range mentioned
RANGE FROM(INDD) ON(START,LENGTH,FORMAT) LIST(OUTDD) options

Options are OCCURS HIGHER(n)/LOWER(n)/HIGHER(n1) LOWER(n2)/


EQUAL(n) NOTEQUAL(n)
It prints count of records meeting value criteria and the FORMAT should be numeric.
Mainframe Refresher Part-1 JCL-Page:27

TOOLIN card to invoke SORT


SORT FROM(INDD) TO(OUTDD) USING(xxxx)
SORT statement should be coded under the DDNAME xxxxCNTL

Matching Logic in JCL


I have two files file 1 and file2. I want t generate three reports out of these
two files.
1.The first report should have records that exist in both files.
2.The second report should contain records that exist only in first file and not in
second file.
3.The third report should contain records that exist only in the second file and not in
the first file.

//STEP0100 EXEC PGM=ICETOOL


//*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
1234567890
3456789012
5678901234
//IN2 DD *
3456789012
7890123456
8901234567
//T1 DD DSN=&T1,SPACE=(CYL,(5,5),RLSE),DISP=(,PASS)
//T2 DD DSN=&T2,SPACE=(CYL,(5,5),RLSE),DISP=(,PASS)
//INT DD DSN=*.T2,DISP=(OLD,PASS),VOL=REF=*.T1
// DD DSN=*.T2,DISP=(OLD,PASS),VOL=REF=*.T2
//FILEA DD SYSOUT=*
//FILEB DD SYSOUT=*
//OUT DD SYSOUT=*
//TOOLIN DD *
SORT FROM(IN1) USING(CTL1)
SORT FROM(IN2) USING(CTL2)
SORT FROM(INT) USING(CTL3)
//CT1CNTL DD *
SORT FIELDS=(1,10,CH,A)
OUTFIL FNAMES=T1,OUTREC=(1,80,C’1’)
//CT2CNTL DD *
SORT FIELDS=(1,10,CH,A)
OUTFIL FNAMES=T2,OUTREC=(1,80,C’2’)
//CT3CNTL DD *
SORT FIELDS=(1,10,CH,A)
SUM FIELDS=(81,1,ZD)
OUTFIL FNAMES=OUT,INCLUDE=(81,1,ZD,EQ,3),OUTREC=(1,80)
OUTFIL FNAMES=FILEA,INCLUDE=(81,1,CH,EQ,C’1’),OUTREC=(1,80)
OUTFIL FNAMES=FILEB,INCLUDE=(81,1,CH,EQ,C’2’),OUTREC=(1,80)
/*
Mainframe Refresher Part-1 JCL-Page:28

Explanation:
CTL1 – Add 1 to all the records of the first file at 80th column
CTL2 – Add 2 to all the records of the second file at 80th column
CTl3 – Concatenate both files and sort the file on key if duplicates found, sum on
81st column. So if any record exists in both the file, it will have 3 after summing.
So now extract records with ‘1’, ’2’ and ‘3’ into three files. While writing the records,
remove the 81st byte added for our temporary purpose.
‘1’ – Records only in first file
‘2’ – Records only in second file.
‘3’ – Records exist in both the files.

IEHPROGM
It is used to
1.Catalogued a dataset (CATLG DSNNAME=A.B.C, VOL=SER=nnnn)
2.Uncatalog a dataset (UNCATLG DSNNAME=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][,DELET])
5.Deleting the index for GDG (DTLX INDEX=index-name)
The SYSIN cards are given in bracket. The utility needs SYSUT1 and SYSUT2 work
space and SYSPRINT for messages.

IDCAMS will be covered in detail, in VSAM section of this book.


Mainframe Refresher Part-1 JCL-Page:29

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 Generation 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, you code it as GDGBASE(+1) and if the second
step creates another generation, then you SHOULD code this as GDGBASE(+2) as
the (+1) version is not yet promoted as current version. Similarly if you want to
refer the GDG created in the second step down the line, you have to 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 is created using IDCAMS. The parameter given while creating the GDG
are:

Parameter Purpose
NAME 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,
EMLTY keeps ONLY the most recent generation.
NOEMPTY keeps the LIMIT number of newest generation.
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.
Mainframe Refresher Part-1 JCL-Page:30

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 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) –
LIMT(5) -
MOEMPTY -
SCRATCH )
/*

GDG VERSIONS ARE UPDATED ONLY AT THE END OF THE JOB

Two step that updates GDG master base twice:


//MM01PY1 JOB (36512),’MUTHU’,NOTIFY=&SYSUID
//UPDATE1 EXEC PGM=PAY3200
//OLDMAST DD DSNAME=MM01.PAYROLL.MASTER(0),DISP=OLD
//NEWMAST DD DSNAME=MM01.PAYROLL.MASTER(+1),DISP=(NEW,CATLG),
// UNIT=SYSDA,VOL=SER=MPS8BV,
// SPACE=(CYL,(10,1)
//*
//UPDATE2 EXEC PGM=PAY3210
//OLDMAST DD DSNAME=MM01.PAYROLL.MASTER(+1),DISP=OLD
//NEWMAST DD DSNAME=MM01.PAYROLL.MASTER(+2),DISP=(NEW,CATLG),
// UNIT=SYSDA,VOL=SER=MPS8BV,
// SPACE=(CYL,(10,1))

Two on-step jobs that update the GDG master file


//MM01PY2 JOB (36512),’MUTHU’,NOTIFY=&SYSUID
//UPDATE1 EXEC PGM=PAY3200
//OLDMAST DD DSNAME=MM01.PAYROLL.MASTER(0),DISP=OLD
//NEWMAST DD DSNAME=MM01.PAYROLL.MASTER(+1),DISP=(NEW,CATLG),
// UNIT=SYSDA,VOL=SER=MPS8BV,
// SPACE=(CYL,(10,1)),
// DCB=(LRECL=80)
//*
//MM01PY3 JOB (36512),’MUTHU’,NOTIFY=&SYSUID
//UPDATE2 EXEC PGM=PAY3210
//OLDMAST DD DSNAME=MM01.PAYROLL.MASTER(0),DISP=OLD
//NEWMAST DD DSNAME=MM01.PAYROLL.MASTER(+1),DISP=(NEW,CATLG),
// UNIT=SYSDA,VOL=SER=MPS8BV,
// SPCE=(CYL,(10,1))
Mainframe Refresher Part-1 JCL-Page:31

ABENDS

If your program ABENDED, first check whether the ABEND is SYSTEM ABEND
or USER ABEND. (Snnn OR Unnn). If system ABEND, check the ABEND code in QW.
If needed, identify the statement that caused the ABEND using offset. If the ABEND
is user ABEND, then check the ABEND code in the program and study the reason
from the comment section/functionality of the program.

SB37, Space ABEND. 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.
SOC1 Operation exception. Misspelled DD names

SOC4 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.
SOC5 Addressing exceptions – Trying to access a memory location that is not
available in memory.
SOC7 Data exception: Non-numeric operation on numeric field. It is usually due to
un-initialized numeric item.
SOC8- Fixed Point- Overflow and Divide exceptions respectively.
SOC9
SOCA, Decimal Point- Overflow and Divide exception respectively.
SOCB
SOCC, Floating point- Exponent Underflow and overflow exceptions respectively.
SOCD
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:32

How to Solve System ABENDS (SOC4,SOC7)?

1.Refer the SYSOUT of the job and get the next sequential instruction to be executed
(Offset).
2.Compile the program with LIST option.
3.Check for the offset in the compilation list and Get the respective statement
number.
4.Identfy the statement. This would be a numeric operation on non-numeric data.
5.Identify the source of the numeric data and correct it.

SYSOUT Message:
From compile unit TESTPGM at entry point TESTPGM at compile unit offset
+0000043A at entry offset +0000043A at address 00008116.

In the compilation listing:


INVOCATION PARMAETERS:
NONUM,MAP,XREF,OBJ,OFF,BUF(28672),SSR,NOCMPR2,DATA(31),SSRANGE,LIST

LINE # HEXLOC VERB LINE # HEXLOC VERB


000046 0003BE MOVE 000047 0003C4 MOVE
000049 00042E MOVE 000050 00043A COMPUTE

43A is a part of statement number 50

Refer the statement number in the listing/Program:

5000 COMPUTE ACOMP = ACOMP / 3

So the problem is with the arithmetic operation of ACOMP.


Find the sources of the field after confirming the junk value in it.
Delete the corrupted record, the sources for this field, from the file and ran the job
again.
(Production Support people- Need to check the importance of the data and correct or
delete accordingly.)

Submission of Job from COBOL Program


Write the Job statement to a output file and route the file to INTRDR instead
of cataloguing. INTRDR-Internal Reader

JOB: //STEP1 EXEC PGM=MAINPM


//DD1 DD DSN=MUTHU.TEST,DISP=SHR
//JCLDD DD SYSOUT=(*,INTRDR)

PROGRAM:MAINPGM
SELECT JCLFILE ASSIGN TO JCLDD…. (Environment Division)
FD JCLFILE.
01 JCL-REC PIC X(80). (File Section)
OPEN OUTPUT JCLFILE. (Open in output and write JCL statements)
MOVE ‘//TESTJOB JOB 1111’ TO JCLREC.
MOVE ‘//STEP01 EXEC PGM=IEFBR14’ TO JCLREC.
CLOSE JCLFILE (TESTJOB will be submitted automatically)
Mainframe Refresher Part-1 JCL-Page:33

Submission of Job from CICS Program


Open the SPOOL using SPOOL OPEN command. Pass all the JCL statements to
a COBOL variable (should be declared using OCCURS Clause) and then write the line
one by one to the SPOOL using SPOOL WRITE command. While Closing the SPOOL
using SPOOL CLOSE, the job will be submitted.

Storage Management Subsystem


It is optional feature of the operating system that manages user datasets. The
SMS parameters apply only to the new datasets and the system ignores for existing
datasets, DD* or DD DATA datasets, JOBCAT and JOBLIB DD statements, and
SYSOUT datasets.

The following data classes establish various default values for catalogued
datasets. An administrator assigns a name to each group of default values, and then
you reference this name on your DD statement to use the values.

STORCLAS – Defines UNIT and VOL parameters


DATACLAS - Defines RECFM, LRECL, AVGREC, SPACE, RETPD/EXTPD, DSNTYPE,
KEYLEN, RECORG, KEYOFF..etc
MGMTCLAS – Migration, backup, releasing unused space in a dataset.

If you want to override any one of the values of default, you can do that.
//PDS DD DSN=BPMAIN.MUTHU.SOURCE,DISP=(NEW,CATLG),
// STORCLAS=DASDONE,SPACE=(,(,,50)),DATACLAS=COB2
 Overrides the directory space defined for COB2 data class.
Mainframe Refresher Part-1 JCL-Page:34

JCL for SAR-IN-BATCH


The production Job logs are usually routed to one of the third party products.
SAR is one such product. The other products are CA-VIEW and VIEW-DIRECT.
The following JCL is used to query the SAR in batch.

//LOADLOG EXEC PGM=SARBCH


//STELIB DD DSN=SYSP.CAI.CAILIB,DISP=SHR
//SYSPRINT DD SYSOUT=*
//REPORT DD DSN=CORP.DBSY2KT.JOBRPT,DISP=MOD
//LOADDD DD DSN=CORP.DBSY2KT.LOADLOG,DISP=OLD
//SYSIN DD DSN=CORP.DBSY2KT.UTILS(CYCCARDW),DISP=SHR

To load the complete log (JOB PRODBKUP of generation 4941) into a dataset
named as LOADDD, use the following card:
/LOAD DDNAME=LOADDD ID=PRODBKUP GEN=4941

To get run-date, run-time, return code and generation of all the prior runs of
a job, use the following card. The result will be stored in the dataset named as
REPORT.
/LIST ID=JOBNAME

JCL for CA7-IN-BATCH


CA7 is a scheduler product. We brief about the product in the next section.
This JCL is used to query CA7 in batch.

//UCC77BTI PROC ID=0,POOL=’1-8’,DSNPFX=,OPT=,PG=SASSBSTR


//BTERM EXEC PGM=SAASBSTR,
// PARM=’0,POOL=(1-8)’
//STEPLIB DD DISP=SHR,DSN=CAI.CA7.LOADLIB
//UCC7CMDS DD DISP=SHR,DSN=CAI.CA7.COMMDS
//SYSPRINT DD SYSOUT=*,DCB=BLKSIZE=133
//ERRORS DD SYSOUT=*,DCB=BLKSIZE=133
//SYSUDUMP DD SYSOUT=*
//SYSIN DD*
Code the CA7 commands
/*

JCL FOR XDC-IN-BATCH


There may be a need to read the run details of a job log inside the REXX.
This can be done using the OUTPUT command of TSO. The following JCL capture the
complete log information of the job CANNAEFD with ID JOB08079 into
T.ISP.MUTHU(TEST1)

//RUNTSO EXEC PGM=IKJEFT01


//SYSPRINT DD SYSOUT=*
//SYSTSIN DD *
OUTPUT CENNAEFD(JOB08079) PRINT(‘T.ISP.MUTHU(TEST1)’)
/*
//*
Mainframe Refresher Part-1 JCL-Page:35

JCL FOR QW-IN-BATCH

QW is the ONLINE-help available in mainframe.


When the Information/Warning/Error/ABEND displayed in the JES message is not
descriptive or syntax of any command, one can easily refer in QW>
QW searches the specified string in all the manuals available. If the string is
found in more than one manual, it lists all the manuals. We have to choose the
manual and proceed accordingly.

The following JCL can be used to invoke QW in batch to download the manuals
available in WQ.

//SDRXG12A JOB (ACCT),’ICETOOL’,CLASS=A


// MSGCLASS=X,MSGLEVEL=(1,1),REGION=0M,NOTIFY=&SYSUID
//QWBATCH EXEC PGM=QWIKREF1,PARM=’V=* P=* R=V1R14,I=ICETOOL’
//STEPLIB DD DSN=SYS5.QWF.LINKLIB,DISP=SHR
//QWPRINT DD DSN=SDRXG12.QW.ICETOOL,DISP=(,CATLG,DELETE),
// DCB=(RECFM=VBA,LRECL=133,BLKSIZE=6000),
// SPACE=(CYL,(5,5),RLSE),UNI=SYSDA
//QWREFDD DD DSN=SYS50.QWF.DATABASE,DISP=SHR

This Will get the V1R14 ICETOOL document into QWPRINT. (PARM=’V=* P=*
R=V1R14 I=ICETOOL’).
QREFDD is the Database of manuals and STEPLIB must have the load
QWIKREF1. These datasets may differ from installation to installation. QINFO on QW
panel lists this information for the installation.
Mainframe Refresher Part-1 JCL-Page:36

Scheduler: CA-7
JES selects the job for processing. Once you submitted the job, you lose your
control over the job. JES checks for the availability of initiators for the CLASS of the
job submitted by you. If an initiator is available, it checks for any high priority
(PRTY) JOB with same class is available. If not, based on FIFO policy it selects the
job submitted by you.

So we cannot call JES as a scheduler. It just processes the job submitted by


you. But a scheduler schedules the jobs at the time and the successful completion of
the first job may trigger the second job automatically and the second can trigger
third and this is how the whole business BATCH cycle is implemented in production
system. Preciously saying, the trigger need to be always job but can be also
dataset(s) or time. Other constraints like mutual exclusiveness, dependencies can be
also added to a job during the definition in the scheduler. Well-defined jobs needs
less human intervention as the jobs are automatically submitted at the right time.

Obliviously, if any job is ABENDED, human intervention is needed and that is


a crucial part of any production support project. If the person in shift could not solve
the problem and restart the job within the time, then the full cycle may get delayed
and the ONLINE may not be up at the time agreed in SLA (Service Level Agreement).

There are lot of schedulers are available in the market. Control-M, OPC and
CA-7 are few of them. Discussion of scheduler products is outside the scope of the
book but we would like to introduce few commands that are frequently used in CA-7
environment and they are given in the table.

Difference between CA-7 and CA11


CA-7 is scheduler where as CA-11 is automatic re-run facility. It directs CA7,
which step to start in case of ABEND. So no restart PARM is needed if you don’t want
to revert the updated done by prior steps. In that case, you may need to modify this
parameter. I CA11 is there, you never get NOT CAT2 error. It performs dataset and
GDG maintenance error. Using the file JEHF produced by CA11, we can get statistics
of ABEND and RESTART details.

CA-11 inserts a step at the beginning of the job called CA07RMS. With this
step, CA-11 scans the JCL being run and looks for any data sets being created in the
job. If the first instance of a file in the job has a disposition beginning with “NEW”,
CA-11 then checks the system catalog to see if there is already an existing data set
by that name. If there is, CA-11 then deletes it to prevent a NOT CAT2 error. THIS
HAPPENED WHETHER IT IS A PRODUCTION RUN OF THE JOB, OR A RESTART.

Also, if necessary, GDG adjustments are made by CA-11 in the step. Any
changes to bias number, (+1) to (0) on a restart, for example, are done by CA-11.

Difference between FORCE COMPLETE and CANCEL


If you CANCEL the job, it will be deleted from CA7 queue and if there is any
job depends on this completion of this job, then it may not get triggered at all.
In such situations, you should go for FORCE-COMPLETION than CANCEL. If there is
no dependency, then you can do anyone.
Mainframe Refresher Part-1 JCL-Page:37

TSO CA7CLIST will take you CA7 panel. If you have access, then you can issue the
following commands in that panel.

Command Purpose
LJOB,JOB=xxxxx,LIST=ALL Display all the details of the job xxxxx.
LIST=TRIG gives only triggering and triggered
jobs.
LIST-RQMT gives only the requirement that
should be satisfied for the job to run.
LSIT List all the jobs that need restart, You
frequently give this command to check for any
ABENDS
LPRRN,JOB=xxxxx Lists last execution details.
LJCL,JOB=xxxxx List JCL for the JOB xxxxxxx
LDSN,DSN=xxx.yyyy,LIST=USERS All jobs using xxx.yyyy dataset.
DEMANDH,JOB=xxxxx Demand job into request queue. If you code
DEMAND instead of DEMANDH then it will get
into active queue directly. SET=NTR is used to
avoid any triggering that may be done by this
job.
LRLOG Details of previous runs since midnight.
Add date=* which gives the last five days
worth. Can also find out which jobs ran late or
were cancelled by using ST=LATE/CANC
FSTRUC,SCHDID=n,JOB=xxxxx All jobs triggered by JOB xxxxx and all
subsequent jobs triggered by those will be
displayed in tree structure. Please note that
there can be more than one schedule ID for
each job and for each day.
SUBTM,JOB=Y***** Allow you to make your job run at a particular
time once already on the XQJ queue. Followed
by TIME=hhmm
HELP Given help on commands, syntax etc.
LSCHD,LSIT=CALS,JOB=xxxxx It gives the calendar listing of what dates the
job will run in the current year.

XQM:
Type XQM. You will get all the jobs, which are in request-ready-active and restart
status. If you want to do any operation on the listed job, do it from this panel. It is
vary user friendly. You no need to remember the commands.
Ex: CANCLE, Post-requirements etc.
Mainframe Refresher Part-1 JCL-Page:38

Debugger- XPEDITOR
XPEDITOR/TSO is a testing, debugging and analysis tool that allows the
programmer to view the source code as it executes in order to identify incorrect
logic, test hard-to-validate routines and analyze both program structure and data
flow. It is a CA product.

The program to be debugged in XPEDITOR environment has to be compiled


with the JCL that has XPEDITOR steps. Check the installation configuration controller
or the installation own utility for compiling a program with XPED option. The load
library of the XPED compiled source must be added to the XPED load lib panel.

DDIO file should be allocated before the execution of the program. It is used
to capture the source listing output from your XPEDITOR/TSO session. Now the
program can be executed in XPEDITOR in one of the ways – TSO (Online) or BATCH
(Interactive debugging, Un-attended debugging).

Once the program source listing is displayed, break points can be set up in
any line by the line command B. GO command executes all the statements from the
current statement of the program to the break point. After the break point, if you
want, you can go step-by-step execution by GO 1 command or alternatively again
you can type GO command that takes you to next break point or END/ABEND of the
program. GT line command is used for unconditional transfer of the execution to that
line. S line command is used to skip the execution of particular statement. GT and S
line commands have equivalent command line commands ‘GT statement-no’ and ‘S
statement-number’.

If you want to come out of execution of the program in between, use the
command ‘EXIT’. ‘RETEST’ command starts the test once again from the beginning.
‘DELETE’ is used to delete all the XPED command (Ex: Break points).

K VAR-NAME in the command line displays the value of the variable. If you
want to change the value of the variable before it is passed to next statement, it can
be done. PEEK VAR-NAME can be also used for this purpose.

If you want to track the program flow when the variable got specific value in
it OR when the value in the variable changes, then use the command ‘WHEN VAR-
NAME= ‘value’’ OR ‘WHEN VAR-NAME CHANGES’. ‘WHEN DELETE’ command
will reset the WNEM command issued before.

REVERSE command is used to review the execution path that led to current
break point. To use REVERSE, MONITOR command should have been issued before.
MONITOR command records the program execution in a buffer. After REVERSE
command, GO 1 statement executes 1 statement in the reverse direction.

Command ‘INTERCEPT SUB-PROGRAM-NAME’ just before the call statement,


takes you to the first statement of sub-program (provided the sub-program is
compiled with XPED option). Otherwise GO 1 command of main program (just before
the execution of sub program) will take you to the next statement in the main
program.

INTERCEPT, REVERCE, BREAK POINT, and DDIO files are imported from
interview point of below.
Other Debuggers: COBTEST, INTERTEST.
Mainframe Refresher Part-1 JCL-Page:39

JCL Interview:

1. Difference between JES2 and JES3


2. How can you specify temporary dataset in JCL?
3. Ways of passing data from JCL to program.
4. Space parameter and space ABENDS B37, D37 and E37.
5. How to solve system ABEND like SOC7?
6. GDG Defining parameter (LIMIT), Model dataset?
7. DISP parameters, What PASS will do?
8. Difference between in-stream and catalogued procedure?
9. Familiarly with SORT control cards.
10. Ways of overriding procedure.
11. What is symbolic parameter?
12. \STEPLIB JOBLIB JCLLIB purpose.
13. How to restart a job from a proc step.
14. Questions on condition codes.
15. COND, TIME and REGION can be coded in EXEC and JOB. Which overrides what?
16. Number of steps in JCL, nesting level of procedures, number of in-stream
procedure in a job, number of DD statements in a step.

Some interesting questions, we used to ask in interviews:

If I submit a job without any step, what return code will I get?
You will get JCL error stating ‘JOB HAS NO STEPS’.

Will the following JOB step will give any error?


//STEP1 EXEC PGM=TEST
MVSQUEST
//DD1 DD DSN=DATA.TEST,DISP=SHR
No. MVSQUEST will go as in-stream data to the program. If the program
issues an ACCEPT, it can get MVSQUEST.

I have 5 jobs in a PDS member. What will happen if I submit it? Which job will run
first?
5 jobs will be submitted. If all are of same job-name, then they will go one
after other in FIFO basis. If their names are different, then depending on availability
of initiator, multiple jobs can run concurrently.

I have three jobs in my PDS. The successful execution of first job, should trigger the
second one and the successful execution of the second job, should trigger third. How
will I implement this scenario?
In the last step of this job, include an IKJEFT01 step with SYSTSIN card
SUBMIT PDS(JOB2). This step should have condition code in it, so that it will submit
the next job only if all the prior steps properly ended. In the second job, include
similar step that submit third job. Alternatively, you can use IEBGENER that use
job2-pds-member as SYSUT1 and SYSUT2 as SYSOUT=(*,INTRDR).

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.
Mainframe Refresher Part-1 JCL-Page:40

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 do you check an empty file in a batch stream?


1. IDCAMS – PRINT command with COUNT(1) will result return code 4, if the file
is empty
2. 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 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 need 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.

Do I need to mention SPACE for tape dataset?


No.

What the PERFORM parameter of the EXEC does?


It is used to specify the performance group of 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.

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. When you delete a member, the system
makes it space available for use –No directory space needs to be set aside for
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.
Mainframe Refresher Part-1 JCL-Page:41

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 command 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 options for this. You have to go for
some third party 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