Jcl-Mat at Tecsacon
Jcl-Mat at Tecsacon
TABLE OF CONTENTS
1.
Introduction................................................................................................................................... 3
Need of JCL ......................................................................................................................................... 3
2.
3.
4.
5.
PROCEDURE ............................................................................................................................. 46
SYMBOLIC PARAMETERS & SYMBOLIC OVERRIDES .......................................................... 50
THE PROC STATEMENT ............................................................................................................... 52
IN-STREAM PROCEDURES........................................................................................................... 53
6.
UTILITY ..................................................................................................................................... 54
IEFBR14 UTILITY ........................................................................................................................... 54
IEBGENER UTILITY ....................................................................................................................... 55
SORT UTILITY ................................................................................................................................ 57
1. Day-Wise Schedule
Day 1 Theory
Introduction to JCL
Structure of JCL; why is JCL?
-Syntax of in JCL
-JOB statements and its various parameters
Day 1 Lab
Assignment 1
Day 2 Theory
Day 2 Lab
Assignment 2 and 3.
Day 3 Theory
Day 3 Lab
Assignment 4 and 5.
Day 4 Theory
Procedures
- Cataloged procedure
- Instream procedure
- Regular and Symbolic overrides
Day 4 Lab
Assignment 6 and 7
Day 5 Theory
Utilities
-IEFBR14
-IEBGENER
-SORT
Day 5 Lab
Assignment 8 and 9.
1. Introduction
JCL is a language in which the users of a computer systems describes to that
system the requirements of their jobs.
Within a job, JCL provides the specification necessary for MVS to process the job.
Specifications of a job are :
User identity
Data file identity
Resource requirement
Error handling
Need of JCL
2. JCL Syntax
Syntax Rules
General JCL command format
//name
operation parameter1,parameter2
Comments
where;
name
: is not to exceed 8 characters
operation : generally begins in column 12
parameter : generally begins in column 17
comments : are separated from the parameters by a blank
Parameters are broadly classified into 2 categories viz. Positional and Keyword.
A positional parameter is identified by its position relative to other parameters in the
operand field.
Rule 1 : All positional parameters are coded first in the operand field and in their
proper sequence.
e.g. : p1,p2,p3
p1,p3,p2
Rule 4 : Both positional parameters and variable information for keyword parameters
may be composed of subparameters. The subparameters may be either
positional or keyword. Subparameters must be coded as a list. The list must
//dd1
//
//dd1
//
//
//
dd dsn=da0001t.empfile,disp=(new,catalg,delete),
unit=sysda,space=(trk,(5,1)),dcb=(lrecl=80,recfm=fb,blksize=800)
dd dsn=da0001t.empfile,disp=(new,catalg,delete),
unit=sysda,space=(trk,(5,
1)),dcb=(lrecl=80,recfm=fb,blksize=800)
Job Statement
The job statement identifies job to the O/S with the job name operand.
The format of the JOB statement is :
//jobname JOB parameters
Note that jobname cannot exceed 8 characters and is usually the userid (loginid)
//da0001ta JOB parameters
Loginid is generally 7 characters, so you need to add a suffix lest the system prompts
you to enter the character when a job is submitted to the system for execution.
When a job is submitted to the system, a job number is also assigned so that the job
can be further identified. This way jobs with the same name can be uniquely
identified. Jobs with the same name cannot execute simultaneously. If several jobs
with the same name are submitted they execute sequentially even if additional jobs
could be executing. Jobs waiting to run because of this time conflict are shown in hold
status.
Remark : 1 A JOB statement must be at the beginning of every job submitted to the
system for execution.
5
2 A JOB statement must have a name. The absence of a jobname will result
in a JCL error.
The rest of the JOB statement contains postional parameters followed by keyword.
LA2719 is the account number for the training dept. This varies from project to
project. Therefore, consult the right person.
If any portion of the field contains a special character other than a , (comma) or a
- (hyphen), the portion must be enclosed in apostrophes. If an ampersand or quotes
is used in the accounting field, code two consecutive ampersands or quotes.
e.g. :1
//da0001ta JOB LA2719,TRG
or //da0001ta JOB (LA2719,TRG)
e.g. :2
//da0001ta JOB (LA2719,P&&G)
Remark: An installation has the option of making the account number mandatory and
most installations do. If so, its absence will cause a JCL error.
If the account number is incorrectly specified, in this case its not JCL error.
However when job is submitted to the system for execution, we get the
message JOB NOT RUN in the sysout.
Programmers Name :
Following the accounting information parameter, another positional parameter, the
programmers name can be coded. The installation determines if this parameter is
required or not. If required, it must be coded immediately after the accounting
information, and its omission will cause a JCL error. The programmers name cannot
exceed 20 characters. If it contains any special characters other than a hyphen and a
period in the middle or the beginning (but not at the end) of the name, the name must
be enclosed in apostrophes. The apostrophes are not added to the length of the name.
If a name contains an apostrophe (e.g., DCOSTA), two apostrophes must be coded.
They count as one character in the length of the name.
e.g. : 1
//da0001ta JOB LA2719,Pai,parameters
e.g. : 2
//da0001ta JOB LA2719,DCOSTA,parameters
Note : Accounting information and Programmers name are the only two positional
parameters in the JOB statement, what follows after that are keyword
parameters.
MSGLEVEL parameter :
This parameter specifies whether the submitted JCL and/or JCL-related messages
should be shown on the jobs output.
General syntax
MSGLEVEL=([jcl][,messages])
Jcl - 0, 1, or 2
0
1
Keyword parameter
Messages 0 or 1
0 - No messages will be shown i.e information about step completion.
1 All messages will be shown viz allocation and termination messages.
7
TheMSGCLASS parameter :
This parameter assigns a sysout class to the Job log. The job log consists of what is
what is known as system or JES datasets:
JES2 or JES3 log
JCL and its associated messages
Allocation and Termination messages
MSGCLASS
General Syntax
MSGCLASS=class
Keyword parameter
Class - A character from A to Z or a number from 0 to 9 (in all 36 classes)
MSGLEVEL parameter indicates whether or not one wishes to print the JCL
statements and allocation messages. The MSGLEVEL can save paper. After a job is
debugged, there may be no need to print all the JCL and allocation messages each
time it runs. To reduce printing to a minimum, one may wish to MSGLEVEL=(0,0).
All datasets to be printed must have a class. This is normally called the output class,
sysout class or message class. Sysout datasets created by the executing programs are
assigned a class by the SYSOUT DISTINCT statement. After the job terminates, the
sysout datasets, which are saved on the spool pack , will be selected and printed by a
JES2 or JES3 component called a printer. There are several printers available, and
each one is assigned one or more sysout classes (from 1 t0 36). The sysout class can
be thought of as a print-scheduling class.
Remark : If the MSGCLASS parameter is omitted, an installation-defined default will
be used.
General Syntax
CLASS=jobclass
Keyword parameter
Jobclass A letter from A to Z or a number from 0 to 9 ( in all 36 classes)
The jobclass affects jobs processing in these ways :
When job is submitted, it is placed in an input queue where it waits to be
executed. Queues can be thought of as waiting lines for jobs. Each job class
has its own input queue
Job waits in the input queue until it is selected by an initiator to be
processed. Each initiator is set to a list of job classes that it can select from.
Simply put Jobclass identifies the nature of the job
- short running or long running
- resource utilization
Each installation group jobs that have like characterstics into classes. By segregrating
jobs with similar characterstics, an installation can maintain a good mix of the jobs
running at a given moment. This maintains system throughput and efficient use of
resources.
Let us look at the sample table below
Class
Code
1
2
A
B
C
Tape
Disk
Production
X
X
X
X
X
X
X
X
X
X
X
X
Test
X
X
X
Table 2.1
In the sample table, the job classes were separated by
- Production vs Test
- Tape vs disk
- expected run time
The example shows some of the characteristics an installation may look at, but
certainly not all. Also, resources used by a job may be critical at one installation, but
not at another. What is important is that one should follow installations standard.
is equivalent to
//DA0001TA JOB LA2719,SATYA,MSGCLASS=A,MSGLEVEL=(1,1),CLASS=A
Remark :
Frequently, installations develop a testing class structure that favors short-running
jobs with minimal resource requirements and penalize long-running jobs with heavy
resource demands. This is achieved by assigning the class used by trivial jobs to many
initiators and class used by heavy jobs to few. To keep people honest, the CLASS
parameter in a testing environment is often tied to several other parameters such as
TIME,PRTY, REGION, etc. For example, a job coding CLASS=A can be given
TIME=(0,5),PRTY=6. Note that the values assigned to these parameters is not shown
in the output. However, if any of these parameters were coded in the JOB statement,
they would be ignored.
Most installation assigns a default job class if the Class parameter is omitted.
10
keyword parameter
11
It is possible for a job to get more CPU time than that is specified in the TIME
parameter by a maximum 10.5 seconds. This is due to the fact that the system checks
for violations every 10.5 seconds.
12
E.g 3.
REGION=0K (or 0M) is coded the entire address space except for those areas used by
MVS/SP (or MVS/XA) is available.
keyword parameter
Stepname
The name of the step where execution is to begin.
Procexec.stepname The name of the EXEC statement invoking a procedure and the
name of the step within the procedure where execution is to begin
13
keyword parameter
HOLD - Job will held (and not executed temporarily) until the operator uses a
command to release. A job will be held in the input queue only if syntactically correct
JCLHOLD (JES2 only) Job will held (and not executed) until the operator uses a
command to release it. Note the job will be held in queue if it is syntactically
incorrect. Rarely used
SCAN Job will be scanned for all syntactical JCL errors but will not execute.
COPY (JES2 only)- Job will be printed. No execution and no syntax checking takes
place. Rarely used.
14
General Syntax
//[stepname] EXEC parameters
stepname is optional. When the stepname is omitted no reference can be made. A job
can contain a maximum of 255 steps.
The PGM Parameter
The PGM parameter identifies the program to be executed in a step.
General Syntax
PGM=pgmname
positional parameter
Pgmname - Name of the program to be fetched from the loadlibrary and executed.
The program specified in PGM is always a member of library (PDS). This is
commonly known as an executable program library or a load library. The EXEC
statement can identify only the member. It has no parameter available to identify the
library. If necessary, this must be done by using a JOBLIB or a STEPLIB DD
statement.
E.g.3.1
//da0001ta job la2719,SATYA,msglevel=(1,1),notify=&sysuid
//joblib
dd dsn=da0001t.lib.loadlib=shr
//s1
exec pgm=ass1
OR
//da0001ta
//s1
//steplib
job la2719,SATYA,msglevel=(1,1),notify=&sysuid
exec pgm=ass1
dd dsn=da0001t.lib.loadlib=shr
15
job la2719,SATYA,msglevel=(1,1),notify=&sysuid
exec pgm=ass1,region=500k
dd dsn=da0001t.lib.loadlib=shr
keyword parameter
16
- The step will not be timed for CPU. It was also not time out (S522
ABEND failure) when a single wait state exceeds the installation-defined
limit (often 10 to 20 minutes). Note that TIME=1440 is rarely used, and most
installation disallow its use in a testing environment. TIME=1440 should be
used by an on-line system like CICS OR ADS/O.
1440
//da0001ta
//s1
//steplib
job la2719,SATYA,msglevel=(1,0),notify=&sysuid
exec pgm=ass1,region=500k,time=(,3)
dd dsn=da0001t.lib.loadlib=shr
17
General Syntax
ACCT=(acctno [additional-acct-info])
keyword parameter
keyword parameter
String A string of characters up to 100. If commas are part of the string, the entire
field must be enclosed in parenthesis (or apostrophes). If any portion of the string
contains special characters (other than hyphen), that portion of the entire string must
be enclosed in apostrophes. Note that any parenthesis used count toward the
maximum. Apostrophes do not.
All information after the = in the PARM parameter, excluding apostrophes, will be
saved by the system within the steps own region. When the program begins
execution by using the appropriate instructions, it can find the saved information in
storage.
In COBOL, the following must be coded :
LINKAGE SECTION.
01 PARM.
05 PLENGTH
PIC S9(04) COMP.
05 INFO
PIC X(05).
PROCEDURE DIVISION USING PARM.
0000-MAIN-PARA.
18
Note that any valid name may be used in place of PARM. The string is stored in
PARM and the PLENGTH is set to the length of the string.
E.g 3.5
//da0001ta job la2719,SATYA,msglevel=(1,1),notify=&sysuid
//s1
exec pgm=ass2,parm=g2 ,time=(,3)
//steplib
dd dsn=da0001t.lib.loadlib=shr
.
.
Note that an expression in quotes cannot be continued, we need to enclose the string
in parenthesis and field containing special characters in apostrophes.
E.g.2 PARM=29/06/00 or (29/06/00)
E.g 3
PARM=(A,B,C,D) or A,B,C,D
The two, however , are not the same. When parentheses are used, the information
found by the program is (A,B,C,D). If apostrophes are used, the information found by
the program is A,B,C,D.
job la2719,SATYA,cond=((12,lt),(8,eq))
20
Before STEP2 begins execution, the system interrogates the existing return code (0),
using the tests in the COND parameter and reading the test from left to right,
Is 12 less than 0? The answer is no. The first test of the COND parameter was
not satisfied. The second test is tested.
Is 8 equal to 0? . The answer is no. Neither of the two tests was satisfied, and
therefore, STEP2 is executed.
Before STEP3 begins execution, the system interrogates the existing return codes (0
and 4), using the tests in the same COND parameter. Since the result for return code
0 is already known, only 4 will be tested :
Is 12 less than 4? The answer is no. The first test of the COND parameter was
not satisfied. The second test is tested.
Is 8 equal to 4 . The answer is no. Neither of the two tests was satisfied, and
therefore, STEP3 is executed.
Before STEP4 begins execution, the system interrogates the existing return codes (0 ,
4 and 16), using the tests in the same COND parameter. Since the results for return
code 0 and 4 are already known, only 16 will be tested :
Is 12 less than 16? The answer is yes. The first test of the COND parameter was
satisfied. There is no need for the second test . Executions of the job stops. STEP
4 and the remaining steps will not be executed.
A message will appear in the output:
IEF2011 DA0001TA STEP4-JOB TERMINATED BECAUSE OF CONDITION
CODES.
A formula can be devised and used to code the COND parameter, if return code
conventions are strictly adhered to :
COND=(last-good-return-code,LT)
Or
COND=(first-bad-return-code,LE)
Let us apply this formula to this example 0-4 is a good return code :
4 -is the last good return code.COND=(4,LT)
or
5 - is the first bad return code..COND=(5,LE)
The two COND parameters are logically equivalent to each other, and it makes no
difference which one is used.
Exercise : Code the COND parameter, where 0 is the only good return code.
The COND parameter in the EXEC statement
The COND parameter can perform a test (or multiple tests) before a step begins
execution against the return (condition) codes issued by previous steps. If a test is
satisfied, the step will not be executed.
General Syntax
COND=((code,operator[,stepname])[,(code,operator[,stepname])][,EVEN|ONLY
])
keyword parameter
21
Remark :
EVEN and ONLY cannot make reference to a particular step. They refer to any
previous step that has ABENDed.
EVEN and ONLY are mutually exclusive
EVEN and ONLY have no positional significance. Each can be coded
anywhere in the COND parameter in relation to other tests
Following an ABEND failure, a step cannot be executed unless it contains
EVEN or ONLY in the COND parameter of its EXEC statement
The first step will always be executed unless COND=ONLY appears in the
exec statement. COND=ONLY would cause the first step to be bypassed, since
no previous ABEND failures could have occurred. Any other COND parameter
in the first EXEC statement will be ignored (i.e., COND=(4,LT) or
COND=EVEN) or will result in JCL error (i.e., COND=(5,LT,stepname))
since there are no previous step.
A step that is not executed issues no return code because a program responsible
for for issuing the return code was not even loaded into the storage. As a result
no return code exists. An attempt to interrogate the return code of such a step in
the COND parameter of a subsequent step will be ignored.
A step that ABENDs issues no return code because a program always issues a
return code (conditionally or by default) if it reaches the end of its execution
and intentionally returns control to the system. When an ABEND occurs, the
program loses control instantly. And is evicted from from execution by the
system. As a result when a step ABENDs no return code exists ( a completion
code exists). An attempt to interogate the return code of such a step in the
COND parameter of a step will be ignored until it contains EVEN or ONLY.
22
An example can best illustrate the mechanism of the COND parameter. Consider a job
with five steps. This is a class room exercise.
//da0001ta
//s1
//s2
//s3
//s4
//s5
//s6
//s7
//s8
//s9
//s10
job la2719,SATYA,notify=&sysuid,msglevel=(1,1)
exec pgm=p1
(4)
exec pgm=p2,cond=((0,lt,s1),even)
(12)
exec pgm=p3,cond=(8,lt,s2)
(0)
exec pgm=p4,cond=(4,lt)
(8)
exec pgm=p5,cond=((4,lt,s1),(0,lt,s3))
abend
exec pgm=p6,cond=(even,(0,le,s5),)
(16)*
exec pgm=p7,cond=((0,lt,s1),even)
(0)
exec pgm=p8,cond=((0,lt,s1),(12,lt,s3) )
(0)
exec pgm=p9,cond=only)
(4)
exec pgm=p10,cond=only
(0)
If the COND parameter is coded neither at the JOB nor at the EXEC statement, the
step will be executed regardless of previous return codes. However it will not be if a
previous step has ABENDed.
If the COND parameter is coded in both the JOB statement as well as an EXEC
statement within the JOB. The COND parameter of the JOB statement is tested first.
If none of its tests are satisfied, then the COND parameter of the EXEC statement is
tested. If a test is satisfied, none of the steps from that point on will be executed.
23
4.
The DD statement
A DD (Data Definition_ statement must appear in a step when the executing program
expects to read from or write to a dataset. In other words DD statement describes the
dataset. The DD statement is the most complicated of all the JCL statements.
The maximum number of DD statements in a step is 3273 . The DD statement can be
coded in any order and always appear after the EXEC statement with the exeception
of
JOBLIB, JOBCAT, PROCLIB DD statement.
keyword parameter
Name It could be a qualified name. This name consists of two or more simple
name separated by periods for a maximum of 44 characters.
E.g 1 DSN=da0001t.SATYA.empfile
E.g.2
DSN=da0001t.SATYA.cobol(ass1)
identifies a library
(da0001t.SATYA.cobol) and a particular member. This notation describes a
sequential dataset.
e.g.3 DSN=&&name
A simple name preceded by two ampersands identifies a temporary dataset.
Temporary because it is not retained beyond job termination.
The system generates a name with the following format :
SYSyyddd.Thh.mm.ss.RV001.jobname.name
Yyddd Julian Calender;
hhmmss uses 24 hour clock ;
RV001 system provided information in reference to the reader;
jobname as it appears in the JOB statement ;
Name whatever is coded after &&.
//SORTWK1
DD UNIT=SYSDA,SPACE=(TRK,(1,2),RLSE)
SYS00173.T100000.RV001.da0001ta.R0000001
This form is basically used when a step requires a work dataset (a dataset created at
the beginning of the steps exeution and deleted at the end). Mostly by utilities.
,DELETE
,KEEP
,CATLG
,UNCATLG
,PASS
,DELETE
,KEEP
,CATLG
)
,UNCATG;
keyword parameter
DISP=(status-field,normal-disp-field,abnormal-disp-field)
The status-field : This field tells the system whether the dataset is to be created or
retrieved.
NEW Indicates that the dataset will be created in this step
OLD - Indicates that an existing dataset will be retrieved and demands exclusive
control.
25
SHR - Indicates that an existing dataset will be retrieved. It also indicates that this
dataset ,if on disk, can be shared with one or more other users.
MOD - This subparameter has two possible meanings :
Indicates that an existing dataset will be retrieved . This will be true if
The dataset is either cataloged or passed
The DD statement contains either VOL=SER or VOL=REF (a VOL
VOL=REF referring to a DD statement, which is a nonspecific request for
a new dataset, is not included)
Indicates that the dataset will be created. This is true if :
The DD statement contains neither VOL=SER nor VOL=REF and it
describes a dataset which is neither cataloged nor passed.
The DD statement contains VOL=REF referring to a DD statement which
is nonspecific request for a new dataset.
e.g. 1 //dd1
//
dd dsn=da0001t.empfile,disp=(mod,catlg),
unit=tape
Explanation:
1. The system assumes da0001t.empfile to be an existing dataset, since the DD
statement contains neither VOL=SER or VOL=REF. The system searches the
catalog and gets volume informatiom from the catalog entry. The volume have
been found. This dataset will be treted as existing dataset.
2. Had the dataset been neither cataloged nor passed. The systen would have been
unable to find the volume information and MOD will default to new.
e.g 2 //dd1
//
dd dsn=da0001t.empfile,disp=(mod,catlg),
unit=sysda,vol=ser=bs3003,space=(trk,(1,2))
Explanation: Since VOL=SER is specified, the fate of MOD is sealed, whether or not
it exists. It will be treated as OLD (with appropriate positioning). If the dataset exists
on that volume no problem, however, if it does not exist the result will be S213-04
ABEND failure (i.e dataset does not exists)
Note :When UNIT and VOL=SER is specified the system does not search the catalog
to locate the dataset.
The normal disposition field : This field is used to tell the system how to dispose of
the dataset when the step terminates normally (without an ABEND).
DELETE indicates that the dataset is to be deleted when the step terminates. For an
existing dataset, OLD, SHR or MOD (not defaulting to NEW), the dataset will also
be uncataloged, if the catalog were used while retreiving the dataset. It will only
delete if the catalog were not used during the retrieval. This means that for a cataloged
dataset, if you specify UNIT and VOL=SER the system does not search the catalog.
Note :
1 When a tape dataset is deleted, nothing happens. A tape dataset cannot be deleted
through the DISP parameter. It is effectively deleted when the dataset is written
over.
26
dd dsn=da0001t.empfile,disp=(new,catlg,delete),
space=(trk,(1,2)),unit=sysda,
dcb=(lrecl=80,recfm=fb,blksize=800)
If an entry for DA0001T.EMPFILE already exists in the catalog, the step termination
routines will not replace the existing entry with the new one, however it keeps the
27
dataset and issues the appropriate message. Unfortunately, NOT CATLGD 2 is just
a warning, operator tend to ignore.
Whenever, you get this message. The existing entry must be removed before the one
with the same one is added. Use IEHPROGM or any other utility to remove the
catalog before adding a new one.
What are the implications of ignoring this warning ? Assume that the existing catalog
entry for dataset points to BS3001, which may or may not contain such a dataset. As a
result of DD statement DD1 the dataset by the same name has been created and kept
on different volume say BS3008 while the catalog entry remains unaltered.
Later, the user, who did not notice the NOT CATLGD 2 message submits a job
containing a DD statement.
//infile
dd dsn=da0001t.emfile,disp=shr
The system will search the catalog, retrieves the dataset residing on volume BS3001,
with no outward appearance of failure. If the dataset by that name does not exist, the
result is S213-04 ABEND failure.
Note that an attempt to add a dulpicate entry in the volume encounters a
DULPCIPATE NAME ON DIRECT ACCESS VOLUME JCL error.
This problem is not encountered in MVS/ESA, because the system deletes the dataset
as well as uncatalog.
PASS Indicates that an entry for the dataset (containing dsn, volume and unit
information) be placed on a table in storage (Passed Dataset Queue). This entry is to
be used in a subsequent step to receive the passed dataset. A message will appear
PASSED.
The abnormal (or conditional) disposition field : This field is used to tell the systen
how to dispose of the dataset when the step terminates abnormally (ABENDs). It is
required only if this disposition is different from the normal disposition.
DELETE,KEEP,CATLG, and UNCATLG have the same meaning they do in the
normal disposition. Note that PASS is not permitted in the abnormal disposition field.
The best example of using the abnormal disposition field is
DISP=(NEW,CATLG,DELETE). If there is ABEND, the dataset is to be deleted. This
eliminates future manual intervention to delete and uncatalog the dataset in order to
restart.
Defaults: Some defaults in the DISP parameter are fixed and others variable.
If the DISP parameter is omitted, the default is always (NEW,DELETE.
//sysut1
//*
dd unit=sysda,space=(trk,(1,2))
dd dsn=da0001t.empfile,disp=shr
28
If a DD statement is receiving a passed dataset which existed before the job began
execution, the default is KEEP.
If the status field is OLD or SHR and the dataset name temporary, the default is
pass.
//dd1
dd dsn=old,dsn=&&temp
If the abnormal disposition field is omitted, the default is the normal disposition
field.
General Syntax
device address
UNIT =( generic device name
generated device name
,device count
device address Identifies the exact device address. This notation is almost never
used.
Generic device name Identifies the device type using a universal system-supplied
name.
e.g : UNIT=3390 ; UNIT=3400-5 ; UNIT=3480
generated device name Identifies the device type using an installation-defined name.
UNIT=SYSDA ; UNIT=DISK ; UNIT=TAPE
The generated names can be made to mean whatever an installation wishes them to
mean. For example, UNIT=SYSDA can mean all 3380 devices of any density, or
single density only, or a subset of double density devices or a combination of 3380
29
and 3390 device. Their definition can vary from installation to installation. Our GE
machine has UNIT=SYSALLDA.
Of the three, the generated name is far the most commonly used.
Device count Specifies the number of devices to be allocated for the dataset. The
limit is 59 devices. If omitted default is 1 except when DD statement describes a disk
multivolume dataset. In such case, device count=number of volumes.
E.g. 1 UNIT=(SYSDA,5) ; UNIT=(TAPE,2)
E.g. 2 UNIT=SYSDA is same as UNIT=(SYSDA,1) because of default
E.g. 3 //dd1
//
//
//
dd dsn=da0001t.empfile,disp=(,catlg,delete),
unit=sysda,vol=ser=(bs3001,bs3002,bs3003),
space=(trk,(1,2)),dcb=(lrecl=80,recfm=fb,
blksize=800)
,SER=(vol1 [,vol2].
=( ,REF=referback
,REF=dsname
30
REF=referback
Referback This can have three formats :
*.stepname.ddname - Requests that the volume be the same as for DD statement
ddname found in the previous step stepname.
VOL=REF=*.STEP2.DD1
*.ddname - Requests that the volume be the same as for previous DD statement
ddname found in the same step stepname.
VOL=REF=*.DD1
*.procexec.stepname.ddname - Requests that the volume be the same as for DD
statement ddname found in the previous step stepname found within a procecure
procexec (name of EXEC statement invoking the procedure.
VOL=REF=*.PR1.STEP2.DD1
Remark:
Referbacks are not encouraged. They should be used only when they are necessary. A
referback with a stepname will cause a JCL error if the referenced step does not
execute. Such referbacks must be avoided where restart is required.
REF=dsname Requests that the volume be the same as the one where dataset
dsname resides on. The dataset must be cataloged or Passed. The dataset does not
even have to exist, as long as it is cataloged or passed. The name of the referenced
dataset need not appear anywhere else in the job.
e.g : VOL=REF=DA0001T.EMPFILE
Remark:
When VOL=REF (referback or dsname) is used, the system supplies the volume as
well as the unit information. Therefore, the UNIT parameter is usually unnecessary.
An old dataset needs to alter its entitlement to additional space. i.e., Request
additional disk space for an old dataset when available space is exhausted.
General Syntax
TRK,
SPACE=( CYL,
(prim-alloc [,sec-alloc] [,directory]) [,RLSE])
Blksize,
TRK Requests that space be allocated in tracks.
31
The needed secondary allocation, if granted, will cause the dataset to exceed 16
extents on the volumes and no other volumes are allocated.
If either of these two conditions arises, the result will be a SB37-04 ABEND failure
(normally for a sequential dataset). For a PDS, the ABEND, can also be SE37-04.
Please note that a PDS is confined to a single volume, ehile a sequential dataset can
extend into a maximum of 59 volumes. The 16-extent-per-volume limit for a dataset
is system-supplied and cannot be altered.
The secondary allocation is optional. If omitted, defaults to 0. When no secondary
allocation is coded and the primary allocation is exhausted, the result is an SD37-04
ABEND failure.
32
Remark :
The secondary allocation can be used for new as well as old datasets. The secondary
allocation requested when the dataset is created is recorded in the datasets DSCB
(VTOC entry). If space is exhausted when the dataset is retrieved as OLD and
extended, the system attempts to provide secondary allocation appearing in the
DSCB. If ,however, a SPACE parameter is included in the DD statement, the
secondary allocation will be based on what is coded in this SPACE parameter rather
than what appears in the datasets DSCB.
E.g 1 SPACE=(TRK,(1,2))
E.g 2 SPACE=(CYL,(7,4))
E.g 3 SPACE=(23440,(200,100))
directory Specifies the number of directory blocks (256 bytes each) to be assigned
to the directory of a PDS.
The directory quantity, if not coded, defaults to zero; therefore, the directory quantity
must be specified for a new PDS. If it is, not S013-14 ABEND failure will occur if an
attempt is made to add the first member to a PDS.
Remark :
The directory quantity is taken away from the beginning of the primary allocation if
TRK or CYL is coded in the SPACE parameter. When blksize is coded, the system
adds the directory blocks to the data blocks and then computes the amount of primary
space.
E.g 1 SPACE=(TRK,(20,5,5)) OR SPACE=(TRK,(20,,5)) if no secondary
E.g 2 SPACE=(CYL,(20,5,5)) OR SPACE=(CYL,(20,,5)) if no secondary
E.g 3 SPACE=(23440,(200,50,5)) OR SPACE=(23440,(200,,5)) if no secondary
RLSE Requests that any unused space be freed when the dataset is closed. This
works for both new and old datasets, provided they were opened for output. Space
will be released on the boundary used in the SPACE parameter. If tracks (or
cylinders) were allocated, unused tracks (or cylinders), will be released.
Remark :
Using RLSE is highly recommended for datasets not intended for future expansions.
Temporary datasets are ideal candidates. For datasets that expand in future runs,
RLSE can result in a larger number of extents, and, possibly, a premature SB37-04
ABEND failure. RLSE will be ignored if the dataset is opened by another user (or
shared by another job) ot the step ABENDs.
e.g: SPACE=(TRK,(5,1),RLSE)
General Syntax
LABEL=([seq-no][,type])
keyword parameter
Seq-no Identifies the sequence number of the dataset on a tape volume. 1 to 4 digits.
If omitted, it defaults to 1. If 0 is coded, it defaults to 1. Maximum : 9999
e.g LABEL=3
type Identifies the type of label for the dataset.
There are many types of labels. To name a few, which are important from project
perspective.
SL Indicates IBM standard label. If the subparameter is omitted, SL is the default.
NL Indicates no labels are used. NL is not commonly used. Normally, NL is used
for a tape coming from or going to another installation which has no SL capabilities.
BLP Bypass Label Processing : Indicates that labels will not be recognized and will
be treated as ordinary files. BLP is used as a last resort when neither SL nor NL can
accomplish what is required.
Label Verification : When retrieving an SL tape dataset, both the volume serial and
the dataset name will be verified. When creating an SL tape dataset with VOL=SER
or VOL=REF, only the volume serial will be verified.
When retrieving an NL tape dataset, neither the volume serial nor dataset name can be
verified. However, only an NL tape volume can be mounted. An SL volume will be
rejected.
Defaults : If omitted, the LABEL parameter defaults to (1,SL). There are four ways to
supply the same information.
Omit the LABEL parameter
HDR1
HDR2
TM
SL DATA SET # 1
TM
EOF1
EOF2
TM
TM
NL
NL DATASET #1
TM
NL DATASET #2
TM
TM
TM Tape Mark
so on ) and constructs the DCB. Note that the DCB exists only for non VSAM
datasets and is checked by the OPEN routines (for input or output). Certain values
must be hard-coded in the DCB by the program. Others can can be left out, giving
the user the option of supplying these values via the DCB parameter( as well as other
means).
There are three suppliers of DCB information :
Values supplied by the program, referred to as hard-coded. When a value is hardcoded, it cannot be changed unless the program is changed.
Values coded in the DCB parameter of the DD statement. These values will be
ignored if they are already hard-coded.
Values from the standard label of the dataset. The values supplied by the label are
limited to : BLKSIZE,LRECL, RECFM, DSORG etc. Values from the label will
not be used if they are hard-coded inside the program or coded in the DCB
parameter.
General Syntax
DCB=([referback] | [model][,subparameter], keyword parameter
Referback This can have three formats :
*.stepname.ddname - Requests that the DCB parameter be copied from the DD
statement ddname found in the previous step stepname.
DCB=*.STEP2.DD1
*.ddname - Requests that the DCB parameter be copied from a previous
statement ddname found in the same step stepname.
DCB=*.DD1
DD
35
This dataset is called a model DSCB. The DCB information from the label of the
model is extracted and can be used.
E.g 1. DCB=DA0001T.EMPFILE
E.g 2. In case you want to override some of the subparameters, the overriding
subparameters must follow the DSCB model dataset name.
DCB=(DA0001T.EMPFILE,LRECL=100,BLKSIZE=800)
Models, are generally used, during the creations of GDGs and dummying the PDS.
Subparameters : There is vast number of subparameters, the great majority of which
are seldom or never used.
BLKSIZE -Specifies the size of the block (also known as the physical record).
For RECFM=FB, the blocksize must be multiple of the logical record length, and
it identifies the exact size of the block. For RECFM=VB, the blocksize can be any
value up to the limit but atleast 4 bytes larger than the logical record length. For
RECFM=U, the blocksize can be any value up to the limit
Remark : There is no default for BLKSIZE. Coding BLKSIZE=0, the system will
compute the optimum blocksize based on the device type.
E.g DCB=BLKSIZE=800
LRECL Specifies the size of the logical record. The maximum size is 32,760, and it
cannot be larger than blocksize, unless RECFM=VBS is used.
E.g. DCB=(LRECL=80,BLKSIZE=800)
RECFM Specifies the record format. There are several values (or combinations of
values) that can be coded.
F - All blocks and all logical records are fixed in size.
V - Blocks as well as logical records are of variable size. The first 4 bytes of each
block (and logical record) describes its length.
B One or more logical records reside in each block. B cannot be coded alone. It
is used in conjunction with F or V. For example FB or VB.
U Blocks are of variable size. There are no logical records. Mainly used with
Load Library.
S- For fixed-size records, it indicates that no short blocks are permitted anywhere
but the end of the data. For variable-size records, it indicates that a logical record
can span more than one block. S cannot be coded alone. It must follow F,V,FB or
VB.
36
A Indicates that the first character of each record is an ANSI control character to
be used for printer carriage control. A cannot be coded alone. It must follow
F,V,FB,VB or U.
E.g DCB=(LRECL=80,RECFM=FB,BLKSIZE=800)
If RECFM is not supplied through any means, U is the default.
DEN Identifies the density of the tape. DEN=3(or 4) indicates 1600 (or 6250 ) BPI
density.
BUFNO Identifies the number of buffers to be allocated in virtual storage by the
OPEN routines, which will contain the blocks to be rean in or written out. If omitted,
default is 5. The maximum is 255. Coding for BUFNO a number greater than 5 may
require that the REGION parameter be increased.
EROPT Specifies what action to take if an unrecoverable I/O error occurs while
reading or writing a block.
ABE Cause an ABEND failure (S001-1).
S013-34 ABEND when RECFM=FB is used and the LRECL is greater than the
BLKSIZE.
S013-34 ABEND when RECFM=VB is used and the LRECL is greater than the
BLKSIZE-4.
Remark :
If values for BLKSIZE or LRECL are not supplied by any source (hard-coded or the
DCB parameter or DSCB), the result will be an S013-34 ABEND failure.
37
S001-04 ABEND when BLKSIZE in the DCB parameter is smaller than the
actual blocksize and is a multiple of the LRECL in the DSCB of the dataset.
It is important to understand which of these often-used parameters are normally hardcoded and which are not :
BLKSIZE - Seldom hard-coded. The BLKSIZE is unrelated to the logic of the
program and hard-coding its value would cause unnecessary changes whenever
the BLKSIZE is changed. In COBOL, BLOCK CONTAINS 0 RECORDS must
be coded to avoid hard-coding the BLKSIZE. Omitting this clause will cause a
default of 1 to be used. The result will be a hard-coded BLKSIZE is equal to
LRECL. Many installation standards disallow hard-coding the BLKSIZE for
sequential and partitioned datasets.
Instream Data
The input stream submitted to the system for execution consists of two possible parts :
JCL mandatory part of the input stream
Data mixed in with JCL in the input stream. This data is known as sysin data or
input stream data. It is optional part of the input stream and always has a logical
record length of 80. Any records encountered in the input stream which are not
JCL statements will be treated as sysin data.
dd *
38
With the above type of DD statement, one complication arises if the sysin data must
consist of JCL statement. Because any JCL statement delimits sysin data. To
accomplish this, DD DATA instead of DD * must be used.
//sysut1 dd data
1234
abcd
//dd1 dd dsn=da0001t.empfile,disp=shr
/*
A /* must be used to delimit a DD DATA statement. A word of caution: Failure to
supply a /* will cause serious problems. JCL statements following DD DATA will
unintentionally become part of sysin data. However, If you want /* to be part of sysin
data, code DLM parameter.
//sysut1 dd data,dlm=)(
1234
abcd
//dd1 dd dsn=da0001t.empfile,disp=shr
/*
xyz
)(
The two characters that are coded in the DLM parameter (apostrophes must be used for
special characters) will act as a delimiter and /* will be treated as data. Any two
characters can be used. However, characters that are likely to appear in the first two
positions of any record must be avoided to prevent premature delimiting sysin data.
DD parameter
*
DATA
DLM
Function
For reading data without // or /* in columns 1 and 2.
For reading data with // but not /* in columns 1 and 2
containing JCL or statements.
For reading data with either // or /* in columns 1 and 2.
39
E.g
//da0001ta job la2719,..
//s1
exec pgm=ass1
//steplib dd
1234
//dd1
dd
is equivalent to
//da0001ta job la2719,..
//s1
exec pgm=ass1
//steplib dd
//sysin
dd * (generated statement)
1234
//dd1
dd
Note : A line with blanks is the most common offender. It is invisible to the user but it
will be treated as data by the system This may or may not cause problem. Let us look
at the following example.
//da0001ta job la2719,..
//s1 exec pgm=ass1
//steplib dd
//sysin dd *
1234
//dd1 dd
The system will interpret the above JCL in the following way :
//da0001ta job la2719,..
//s1 exec pgm=ass1
//sysin
dd *
//steplib dd
//sysin dd * (generated statement)
1234
//dd1 dd
Conclusion : If there are two or more DD statements by the same name in the same
step. This is not an error condition. When the program opens for SYSIN the first of
the two be used. The other will be allocated and ignored.
Remark :
Generically, each DD statement must have a unique ddname except in special cases
viz concatenation. In JES2, if a step contains identical ddnames, the system allocates
devices and space and does disposition processing for both the DD statements.
However, the systen directs all references to the first DD statement with that name in
the step. In JES3, if a step contains identical ddnames, the job ABENDS during
allocation.
written on the SPOOL pack and saved there for later viewing on a terminal or printing
(or both). This is called output spooling, and is under the control of JES2 or JES3
which later can use one of their print routines to print the dataset. These print routines
must schedule the datasets for printing, and msgclasses are used for this purpose. All
print routines (called printers or writers) are associated with one or more classes (in
all 36 classes) and each dataset to printed must also be assigned classes. The printer
routines selects datasets for printing in a very similar way as initiators selects jobs for
executions. Use S.ST option of ISPF menu to view the output dataset.
The SYSOUT parameter can assign this class, known as sysout or output class, to a
dataset. Such datasets are called sysout or output datsets.
General Syntax
SYSOUT=(class| *)
keyword parameter
Concatenation
Concatenating Datasets
At times, program may have to read in sequence several input datasets as if they were
one. This can accomplished without physically putting the data in one datasets. This is
done by concatenating the datasets in JCL code with comparable DCB characteristics
without programming changes.
Note that only sequential and partitioned datasets can be concatenated. For sequential
datasets, the maximum number of concatenations is 255 and for PDS it is 16.
Concatenation has meaning only for sequential processing.
E.g 1. Concatenation of physical sequential files.
//dd1
//
//
dd dsn=da0001t.SATYA.group1,disp=shr
dd dsn=da0001t.SATYA.group2,disp=shr
dd dsn=da0001t.SATYA.group3,disp=shr
41
dd dsn=da0001t.pds1.group1,disp=shr
dd dsn=da0001t.pds2.group2,disp=shr
dd dsn=da0001t.pds3.group3,disp=shr
4.
dd dsn=da0001t.SATYA.group1,disp=shr,dcb=23400
dd dsn=da0001t.SATYA.group2,disp=shr
dd dsn=da0001t.SATYA.group3,disp=shr
Both sequential datasets and partitioned datasets can be concatenated, but not with
each other sequential with sequential and partitioned with partitioned only.
Member of a PDS is treated as sequential dataset and thus can be concatenated
with sequential dataset.
E.g
//in
//
5.
dd dsn=da0001t.empfile,disp=shr
dd dsn=da0001t.SATYA.data(emp),disp=shr
Disk as well as tape datasets can be concatenated but not with each other. Only
like devices should be concatenated, disk with disk and tape with tape.
DUMMY Parameter
The DUMMY parameter is a positional parameter. At times, one might want to
execute a program but suppress read or write operations in certain jobs, For example.,
not print a report. At other times, one might want to test a program without actually
processing data.
The DUMMY parameter specifies that :
No device or external storage be allocated.
42
Remark :
1 DCB information is established. Generally used during testing process and in
procedures. Instead of using DUMMY, one may use DSN=NULLFILE. It
differs from DUMMY by virtue of its position. It is a keyword parameter.
E.g //DD1
DD DSN=NULLFILE
2
43
The STEPLIB statement identifies the program library (load library) where the
program to be executed for the step where STEPLIB resides. It can be placed
anywhere after the EXEC statement.
E.g 1:
//da0001ta job,la2719,
//s1
exec pgm=proga
//steplib
dd dsn=da0001t.lib.loadlib,disp=shr
//s2
exec pgm=progb
//steplib
dd dsn=da0001t.lib.loadlib1,disp=shr
A STEPLIB DD statement has the effect of negating the JOBLIB DD statement for a
particular step.
STORAGE DUMP
When a step encounters an ABEND failure, it is often advantageous to request a
virtual storage dump, which can then be helpful in determining the cause of an
ABEND. To request a storage dump, one of the following three DD statements must
be included in the step :
A SYSUDUMP DD statement
A SYSMDUMP DD statement
A SYSABEND DD statement
//sysudump dd sysout=*
All virtual storage allocated to your program i.e user region of jobs address space. It
is a formatted dump. SYSUDUMP usually writes to sysout. It can, however, write to
a disk dataset, providing a way to preserve the SYSUDUMP information for later
viewing and analysis.
//sysudump dd dsn=da0001t.dumpfile,space=(trk,(0,5),rlse),
//
disp=(,delete,catlg),unit=sysda
No DCB is required.
44
Remark :
SYSUDUMP DD statement is more often used.
//sysmudump dd sysout=*
This is same as SYSUDUMP DD statement except for the fact that the dump is
nonformatted. This type of dump is very difficult to analyze unless it is saved on a
disk and then processed by the PRDUMP service aid.
SYSMDUMP is seldom used.
//sysabend dd sysout=*
If more than one of the above statements is included in the JCL of a step, only the
last one will be used. The previous ones will be ignored.
//s1
exec pgm=ass1
//sysabend dd sysout=*
//sysudump dd sysout=*
45
5.
PROCEDURE
INVOKING A PROCEDURE
//PR EXEC ABC
OR
//PR EXEC PROC = ABC
RESTRICTIONS
Common Rules for EXEC & DD Statement to Override for JCL Procedures
To override any parameters in an concatenation other than the first one, the
following must be coded :
46
//stepname.ddname DD
//
DD
//
.
//
.
//
DD overriding parameters
To add an entire DD statement
// stepname.ddname DD complete parameter field.
All overriding EXEC parameters must be coded in the EXEC statement that
invokes the procedure.
47
procedure lam
//S1
//
//STEPLIB
//IN1
//IN2
//
//REP
//OUT
//
//
//
//S2
EXEC PGM=FORM, REGION=900K
//INA
DD
DSN=USER1.PLA,DISP=SHR
//
DD
DSN=USER1.F226,DISP=SHR
//
DD
DSN=USER1.F232,DISP=SHR
//
DD
DSN=USER1.F118,DISP=SHR
//OUTA
DD
DSN=USER.F323,DISP=(,CATLG,DELETE),
//
UNIT=TAPE, VOL=SER=001110
//
DCB=BLKSIZE=32700, LRECL=100,
//
RECFM=FB)
//PRNT DD SYSOUT=*
Required in Step S2 :
a)
b)
c)
d)
//S3
//1N3
//OUT3 DD
//
//
//
//PRINT DD
//
48
Required in Step S3 :
a) EVEN must be added to the COND parameter
b) In DD statement OUT3, RLSE must be removed from the SPACE parameter must
be nullified.
SOME TYPICAL EXAMPLES
Example 1:
//S1
//OUT1
//
//
//
EXEC PGM=ONE
DD
DSN=U1.S1,
DISP=(,CTLG, DELETE),
UNIT=TAPE
DCB=(BLKSIZE=32700)
Required
OUT1 must be dummied
Override
//S.OUT1
DD DUMMY
EXEC PGM=ONE
DD
DSN=U1.B1,DISP=SHR
DD
DSN=U2.B2,DISP=SHR
DD
DSN=U3.B3,DISP=SHR
Required
Second concatenation of INI must be dummy
Override
//S1.INI
DD
DD
DD
DSN=U1.B3
DUMMY
Example 3:
//S1
//CNTL
EXEC PGM=ONE
DD
DSN=U1.CNTLIB(S1), DISP=SHR
Required
DD statement CNTL must be //CNTL DD*
49
Override
//S1.CNTL
DD*
Example 4 :
//S1
//OVT4 DD
//
//
//
//
Required
DCB parameter must be eliminated
Override
//S1.OUT4
DD DCB=(BLKSIZE=LRECL=RECFM)
Symbolic overrides can be used only when symbolic parameters have been coded
inside the procedure
SYMBOLIC PARAMETER
Example 1 :
//S1 EXEC PGM=BL
//IN
DD
DSN=&H1..INFILE,DISP=SHR
//OUT DD
DSN=&HQ..OUTFILE,DISP=,CATLG,DELETE),
//
UNIT=SYSDA, DCB=(BLKSIZE=32700)
50
Example 2 :
Procedure BLTX
//S1 EXEC PGM=BL
//IN
DD
DSN=&HQINFILE,DISP=SHR
//OUT DD
DSN=&HQOUTFILE,DISP=,CATLG,DELETE
//
UNIT=SYSDA,DCB(=BLKSIZE=32700)
If a symbolic and a regular override conflict, the regular override always prevails.
PROCEDURE SSP
//S1 EXEC PGM = P1, PARM = &PEL
Assume possible values that the PARM parameter can assume are ALD, BLD, CLD,
etc.
//S1 EXEC PGM=P1, PARM = &PELLD
This will not work
Procedure SSP can be coded as
//S1 EXEC PGM=P1, PARM = PEL.LD
Now if the procedure is invoked
//A EXEC SSP, PEL=F
51
Substitution results in
//S1 EXEC PGM=P1, PARM = FLD
//S1 EXEC PGM = P1, PARM = &PEL
Example 1 :
//A EXEC SSP, PEL=FLD
Substitution results in
//S1 EXEC PGM=P1, PARM=FLD
Example 2 :
//B EXEC SSP, PEL = FLD, TIME = (5, 10)
substitution results in
//S1 EXEC PGM = P1, PARM=FLD, TIME = (5,10)
PROCEDURE SWP
//ABC
//S1
//IN
//OUT
//
//A
Substitution results in
//S1 EXEC PGM=P2, REGION=800K
//IN
DD
DSN=MAX.FILEX, DISP=SHR
//OUT DD
DSN=MAX.FILEY, DISP=(,CATLG),
//
UNIT =TAPE
For those symbolic overrides not found in the EXEC statement, the default
symbolic overrides in the PROC statement will be used.
52
IN-STREAM PROCEDURES
An in-stream procedures is a part of a job's input stream and exists only for the
duration of the job.
Remark :
1) A PROC statement in a catalogued procedure is optional. The only reason it is
required is to contain default symbolic overrides.
Example :
//da0001ta
JOB la2719,SATYA,msgclass=A,
//
msglevel=(1,1,),notify=da0001t
//*
Instream prosedure
//procbr14
proc
//s1
exec pgm=iefbr14
//sysprint
dd
sysout=*
//dd1
dd
dsn=da0001t.temp,
//
disp=(old,delete)
//
pend
//*
//step1
exec proc=procbr14
//s1.dd1
dd
dsn=da0001t.temp1,
//
disp=(,catlg,delete), unit=sysda,
//
space=(trk,(2,1)),
//
dcb=(1recl=80,recfm=fb,blksize=800)
//
53
6. UTILITY
IEFBR14 UTILITY
This Utility is commonly used to delete, allocate and to uncatalog dataset
Example 1 :
//DELETE
EXEC PGM=IEFBR14
//* TO DELETE A FILE
//DD1
DD
DSN=DA0001T.EMPLOYEE,
//
DISP=(MOD,DELETE,DELETE),
//
UNIT=SYSDA, SPACE=(TRK,0)
Example 2
//CREATE
EXEC PGM=IEFBR14
//*TO ALLOCATE A NEW FILE
//DD1
DD
DSN=DA0001T.EMPLOYEE,
//
DISP=(NEW,CATLG,DELETE),
//
UNIT=SYSDA,
//
SPACE=(TRK,(2,1)),
//
DCB=(BLKSIZE=800,LRECL=80,
//
RECFM=FB,DSORG=PS)
JOB
LA2719,SATYA,NOTIFY=DA0001T,
MSGCLASS=X, MSGLEVEL=(1,0)
EXEC PGM=IEFBR14
DD
DSN=DA0001T.MYFILE2,
SPACE=(TRK, (0),),UNIT=SYSDA
EXEC PGM=PROG2V1,PARM='AAAA'
DD
DSN=DA00021T,PVDB2.LOADLIB,
DISP=SHR
DD
DSN=DA00021T, EMPLOYEE
DISP=OLD
DD
DSN=DA00021T.MYFILE2,
DISP=(NEW,CATLG,DELETE),
DCB=(LRECL=80, DSORG=PS,
BLKSIZE=80, RECFM=FB),
VOL=SER=BS3011,
SPACE=(TRK, (45,15))
DD
SYSOUT=*
54
IEBGENER UTILITY
Interface Exec Block gener
************************************************************************
* USING THE IEBGENER UTILITY TO COPY DATASETS
* SYSSUTI PROVIDING THE INPUT AND SYSUT2 BEING
* THE OUTPUT
************************************************************************
//DA0001TA
//
//CPYSTEP
//SYSSUT1
//SYSUT2
//SYSIN
//SYSPRINT
//
JOB
************************************************************************
* USING THE IEBGENER UTILITY TO CONCATENATE DATASETS
* SYSSUT1 PROVIDING THE INPUT AND SYSUT2 BEING
* THE OUTPUT
************************************************************************
//DA0001TA JOB LA2719,SATYA,NOTIFY=DA000IT,
//
MSGCLASS=X
//CPYSTEP EXEC PGM=IEBGENER
//SYSUT1
DD
DSN=DA000IT.INDATA1,DISP=SHR
//
DD
DSN=DA000IT.INDATA3,DISP=SHR
//SYSUT2
DD
DSN=DA0001T.MYOUT,
//
DISP=(NEW, CATLG, DELETE),
//
UNIT=SYSALLDA,
//
SPACE=(TRK,(5,1),RLSE)
55
************************************************************************
* USING THE IEBGENER UTILITY TO EMPTY EXISTING DATASET
************************************************************************
//DA0001TA JOB LA2719,SATYA,NOTIFY=DA00IT,
//
MSGCLASS=X
//CPYSTEP EXEC PGM=IEBGENER
//SYSPRINT DD
SYSOUT=*
//SYSUT1
DD
DUMMY, DCB=(BLKSIZE=800,
//
LRECL=80, RECFM=FB)
//SYSUT2
DD
DSB=DA000IT.MYOUT,
//
DISP=SHR
//SYSIN
DD
DUMMY
//
56
SORT UTILITY
The utility is commonly used to sort data, copy selective data, remove duplicates,
change data throughout the file.
A - Ascending
D - Descending
MERGE UTILITY
This assumes that record are in proper sequence but at different locations i.e. in
different files. It merges those files into one, in the given sequence.
Eg. : General ledger transactions for different months, in the sequence of a/c no. to
be merged in one file.
SORT UTILITY
57
SORT JCL 1
//DA001TA JOB LA2719,SATYA, NOTIFY=DA0001T.MSGCLASS=X
//*******************************************************
//*SORT ON THE EMPLOYEE NAME IN ASCENDING ORDER
//*******************************************************
//SRTSTEP EXEC PGM = SORT
//SYSIN
DD *
SORT FIELDS = (1,5,CH,A)
/*
//SORTIN
DD
DSN=DA0001T.EMPLOYEE,DISP=SHR
//SORTOUT DD
DSN=DA0001T.OUT SORT,
//
SPACE=(TRK,(3,3)), UNIT=SYSDA
//SORTWK01 DD
SPACE=(TRK,(10,5)),UNIT=SYSALLDA
//SORTWK02 DD
SPACE=(TRK,(10,5)),UNIT=SYSALLDA
//SORTWK03 DD
SPACE=(TRK,(10,5)),UNIT=SYSALLDA
//SORTWK04 DD
SPACE=(TRK,(10,5)),UNIT=SYSALLDA
//SYSPRINT DD
SYSOUT=*
//SYSOUT
DD
SYSOUT=*
//SORTMSG DD
SYSOUT=*
//
SORT JCL 2
//DA001TA JOB LA2719,SATYA, NOTIFY=DA0001T.MSGCLASS=X
//*******************************************************
//*SORTS ON ASCENDING DEPTNO & DESCENDING ENAME
//*******************************************************
//SRTSTEP EXEC
PGM=SORT
//SYSIN
DD *
SORT FIELDS = (17,2,PD,A,2,6,CH,D)
//SORTIN
DD
DSN=DA000IT.DEPT,DISP=SHR
//SORTOUT DD
DSN=DA000IT.SORTOUT2
//
DISP=NEW,CATLG,DELETE)
//
SPACE=(TRK,(3,3)),UNIT = SYSDA
//SORTWK01 DD
SPACE(TRK,(10,5)), UNIT=SYSALLA
//SORTWK02 DD
SPACE(TRK,(10,5)), UNIT=SYSALLA
//SORTWK03 DD
SPACE(TRK,(10,5)), UNIT=SYSALLA
//SORTWK04 DD
SPACE(TRK,(10,5)), UNIT=SYSALLA
//SYSPRINT DD
SYSOUT=*
//SYSOUT
DD
SYSOUT=*
//SORTMSG DD
SYSOUT=*
//
58
SORT JCL 3
TO COPY SELECTIVE DATA
a) INCLUDE COND copies data that matches the condition given for e.g. in this
case it will copy data where one character in 19th position equals 'M' or 'S'.
//DA001TA JOB LA2719,SATYA, NOTIFY=DA0001T.MSGCLASS=X
/***********************************************************************
* SORTS ON THE INPUT FILE ON JOB AND SELECTS JOB BEGINNING WITH M
OR S INTO A DATA SET
//**********************************************************************
//SRTSTEP
EXCE PGM=SORT
//SYSIN
DD *
OPTION EQUALS
SORT FIELDS = (19,6,A), FORMAT=CH
INCLUDE COND = (19,1,CH,EQ,C'M', OR, 19, 1, CH, EQ, C 'S')
/*
//SORTIN
DD
DSN=DA0001T.INDATA3,DISP=SHR
//SORTOUT DD
DSN=DA0001T.SORTOUT3,DISP=(NEW, CATLG)
//
SPACE=(TRK,(3,3)), UNIT = SYSDA,
//
DCB=(BLKSIZE=800, LRECL=80, RECFM=FB,
//
DSORG=PS)
//SORTWK01 DD
SPACE=(TRK,(10,5)), UNIT=SYSALLDA
//SORTWK02 DD
SPACE=(TRK,(10,5)), UNIT=SYSALLDA
//SORTWK03 DD
SPACE=(TRK,(10,5)), UNIT=SYSALLDA
//SORTWK04 DD
SPACE=(TRK,(10,5)), UNIT=SYSALLDA
//SYSOUT
DD
SYSOUT=*
//
59
SORT JCL 4 (Sorts on Job and selects Jobs beginning with M and Deptno beginning
with 1)
//DA001TA JOB LA2719,SATYA, NOTIFY=DA0001T.MSGCLASS=X
//********************************************************
//*SORTS ON JOB INCLUDES JOBS BEGINNING WITH M AND DEPTNO
*BEGINNING WITH 1
//********************************************************
//SRTSTEP EXEC PGM=SORT
//SYSIN
DD *
OPTION EQUALS
SORT FIELDS = (19,6,A),FORMAT=CH
INCLUDE COND=(19,1,CH,EQ,C'M',AND,51,1,CSF,EQ,1)
/*
//SORTIN
DD
DSN=DA0001T.INDATA3,DISP=SHR
//SORTOUT DD
DSN=DA0021T.SORTOUT4,DISP=NEW,CATLG),
//
SPACE=(TRK,(3,3,)), UNIT = SYSDA,
//
DCB=(BLKSIZE=800, LRECL=80, RECFM=FB,
//
DSORG=PS)
//SORTWK01 DD
SPACE=(TRK,(10,5)),UNIT=SYSALLDA
//SORTWK02 DD
SPACE=(TRK,(10,5)),UNIT=SYSALLDA
//SORTWK03 DD
SPACE=(TRK,(10,5)),UNIT=SYSALLDA
//SORTWK04 DD
SPACE=(TRK,(10,5)),UNIT=SYSALLDA
//SYSOUT
DD
SYSOUT=*
//
SORT UTILITY
SORT JCL 5 (Sorts on Job and omits Jobs beginning with M or S
OMIT COND: INCLUDE and OMIT are mutually exclusive
Records which do not satisfy the condition are sorted and copies into the output
dataset
//DA001TA JOB LA2719,SATYA, NOTIFY=DA0001T,MSGCLASS=X
//********************************************************
//*SORTS ON JOB *OMITS JOBS BEGINNING WITH M OR S
//********************************************************
//SRTSTEP
EXEC PGM=SORT
//SYSIN
DD *
OPTION EQUALS
SORT FIELDS = (19,6,A),FORMAT=CH
OMIT COND = (19,1,CH,EQ,C,'M',OR, 19,1,CH,EQ,C'S')
/*
60
APPENDIX-A
(Assignments)
1.
Write a COBOL program to display to display hard coded values. Use
Compile/Link/Execute JCL to execute your program.
2.
Your are given a sample JCL with syntax errors, you have fix it. First JEM it,
find out the errors and then debug errors one at at a time.
3.
Try out all the parameters discussed on day 1 at JOB statement. Change one
parameter at a time.
- Change Jobname
- Change Account Number
- Violation of continuation rules for paramaters.
- MSGLEVEL
- CLASS
- MSGCLASS
- PRTY
- NOTIFY
- RESTART
- SCAN
Distinguish the difference between SCAN and JEM.
Note down the observation you made in your Compile/Link/Execute JCL and
submit this to the faculty as an assignment.
4.
Display the records from the G2 group with the use of PARM parameter at the
EXEC statement. Use the EMPFILE (flat file) created during the MVS Lab
session. Read the said file and compare the department value of each record
with the value passed through PARM parameter. Note all the ABEND codes
encountered and analyse the cause.
5.
6.
Write a COBOL program that reads from the EMPFILE and write onto
another sequential file. Specify a DD statement that creates the newfile in your
Run step.
7.
Create a member by name PROC and copy the Compile-Link JCL in your JCL
PDS. Remove the JOB statement and run step. JEM it if no errors, execute any
of your COBOL program by invoking the cataloged procedure. Code the
appropriate overriding statements.
8.
9.
10.
11.
Write a JCL for IEBGENER to copy from EMPFILE into another. Try out all
the JCLs given in the handout.
12.
62
13.
APPENDIX-B
(Bibliography/references)
-Mani Carathanassis
MVS/JCL
-Doug Lowe
63