JCL Handbook All in One
JCL Handbook All in One
JCL Handbook All in One
Version 2.0
7th July 2000
0
JCL
TABLE OF CONTENTS
1. Introduction....................................................................................................................................3
Need of JCL..........................................................................................................................................3
2. JCL Syntax......................................................................................................................................4
Syntax Rules.........................................................................................................................................4
Job Statement........................................................................................................................................5
Accounting Information parameter :.....................................................................................................6
Programmers Name :...........................................................................................................................7
MSGLEVEL parameter :......................................................................................................................7
TheMSGCLASS parameter :................................................................................................................8
The Class Parameter :...........................................................................................................................8
The PRTY parameter...........................................................................................................................10
The TIME Parameter...........................................................................................................................11
The REGION parameter.....................................................................................................................12
The ADDRSPC parameter..................................................................................................................13
The NOTIFY parameter......................................................................................................................13
The RESTART parameter...................................................................................................................13
The TYPRUN parameter.....................................................................................................................14
3. The EXEC Statement...................................................................................................................15
The REGION Parameter.....................................................................................................................16
The TIME parameter...........................................................................................................................16
The ADDRSPC parameter..................................................................................................................17
The ACCT Parameter..........................................................................................................................17
The PARM Parameter.........................................................................................................................18
The COND Parameter.........................................................................................................................19
4. The DD statement.........................................................................................................................24
The DSN Parameter............................................................................................................................24
The DISP Parameter............................................................................................................................25
The UNIT Parameter...........................................................................................................................29
The VOL Parameter............................................................................................................................30
The SPACE Parameter........................................................................................................................31
The LABEL Parameter........................................................................................................................33
The DCB Parameter............................................................................................................................34
Instream Data......................................................................................................................................38
The SYSOUT Parameter.....................................................................................................................40
Concatenation......................................................................................................................................41
DUMMY Parameter............................................................................................................................42
The JOBLIB DD Statement................................................................................................................43
The STEPLIB STATEMENT..............................................................................................................43
STORAGE DUMP..............................................................................................................................44
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
JCL
1. Day-Wise Schedule
2
JCL
3
JCL
4
JCL
5
JCL
3. JCL Syntax
Syntax Rules
General JCL command format
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.
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 illegal because they are not in sequence.
Rule 2 : A keyword parameter follows positional parameter and can be coded in any
order.
e.g. : p1,p2,p3,k1=,k2=,k3=
p1,p2,p2,k3=,k2=,k1=
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
6
JCL
e.g : p1,(sp1,sp2),p3,k1=(sk1,sk2),k2=,k3=
p1,(sp1),p3,k1=(sk1),k2=,k3=
or p1,sp1,p3,k1=sk1,k2=,k3=
Rules for continuation : The JCL statement can be continued in a simple way. The
statement must be interrupted at a comma. This means that the last valid character of
the line must be a comma followed by atleast one blank. Then the statement can be
continued into the next line by coding two slashes at the beginning of the line and
continuing the parameter field starting anywhere between positions 4 and 16 (4 and
16 included). Note that the comma which indicates continuation, is not an extraneous
character but part of the statement.
//dd1 dd dsn=da0001t.empfile,disp=(new,catalg,delete),
// unit=sysda,space=(trk,(5,1)),dcb=(lrecl=80,recfm=fb,blksize=800)
//dd1 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.
Note that jobname cannot exceed 8 characters and is usually the userid (loginid)
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.
7
JCL
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.
e.g :
//da0001ta JOB LA2719,parameters
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
e.g. :2
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.
8
JCL
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
e.g. : 2
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
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.
The messages subparameter can be thought of as On (1) or Off (0) .
9
JCL
Remark:
2. If the job encounter an ABEND failure, the second field always defaults to 1 even if
coded as 0
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
General Syntax
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.
10
JCL
General Syntax
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.
Table 2.1
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
11
JCL
//DA0001TA JOB LA2719,CTS,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.
General Syntax
The PRTY parameter is used to define the jobs input class selection priority :
The higher the number, the better (greater) the priority
The PRTY parameter simply controls the jobs position in the input queue. It
has no affect on the jobs performance.
Jobs with higher priorities will be selected before jobs will lower priority
A jobs priority does not affect its performance. Once the job is selected for
execution, the priority function is finished.
Two jobs having same job class and same priority will be executed in
sequence
Remark :
This parameter is of seldom use in a testing environment. Since high priorty would be
used by practically all users negating the very purpose the parameter,. Therefore, in
most installation the PRTY, whether coded or not, will default to an installation-
defined value or will be supplied by the CLASS parameter.
12
JCL
General Syntax
If the TIME parameter is also coded in the JOB statement, both will be in effect and
either can cause a S322 ABEND failure. It is not advisable to use them both.
CPU time is the amount of time that the computer devoted to the job after it was
selected for processing. It is not the amount of time it was in the machine.
TIME parameter puts an upper limit on the amount of CPU time that a job may use.
e.g : TIME=(3,20).
All the steps in the job are allowed collectively 3 minutes and 20 seconds of CPU
time. If this amount is exceeded, the result will be a S322 ABEND failure.
If the TIME parameter is coded using only minutes, seconds defaults to zero. For
example, TIME=5 is the same as TIME=(6,0).
If the TIME parameter is coded using only seconds, minutes defaults to zero. For
example, TIME=(,6) is the same as TIME=(0,6).
The TIME parameter is intended almost exclusively for a testing environment and
should be coded to preempt the program going into CPU loop.
The TIME parameter can also be supplied by the CLASS parameter. When the TIME
parameter is omitted and the CLASS parameter does not supply it, the job will not be
timed for CPU time. However each step will be individually timed (TIME parameter
at EXEC statement or its installation-defined default), unless it contains TIME=1440.
Remark:
13
JCL
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.
General Syntax
E.g 1.
Assume REGION=1000K was coded in the JOB statement. All the steps in the job are
limited to this value. If more storage is needed, the usual result is S878 or S80A or
S804 ABEND failure. If one of these failures occurs, the user must increase the value
in the REGION parameter.
E.g 2.
REGION=10M
When the amount of storage requested in the REGION parameter is higher than the
address space can provide, an S822 ABEND failure will result.
Note that for job run under MVS/SP, the entire address space is limited to 16M, of
which usually less than 8M is available to the user. In case of MVS/XA, the entire
address space is limited to 2G, of which usually around 9M is available to the user.
14
JCL
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.
General syntax
ADDRSPC={VIRT|REAL}
VIRT The REGION will be virtual storage and is the default
REAL The REGION will be real storage.
Remark:
This is the rarely used parameter because of the default. Note that ADDRSPC=REAL
is a parameter that is disallowed in practically all installation because it can cause
serious performance problems for other jobs.
General Syntax
E.g NOTIFY=DA0001T
If coded, a message will appear on the users TSO terminal indicating if the job
abended or got a JCL error. If the job terminates while the user was logged off, the
message will appear when the user logs on. If the NOTIFY parameter is omitted, no
message will appear when the job terminates.
Remark :
You can also code NOTIFY=&SYSUID instead of your userid.
General Syntax
15
JCL
* - indicates that execution of the job is to begin with the first step and is the default.
Things to avoid :
Duplicate name for EXEC statements invoking procedure. If
RESTART=procsexec.stepname is used, the first procexec found will be used.
Duplicate stepnames within procedure. If RESTART=procsexec.stepname is used,
the first stepname within procexec found will be used.
Duplicate stepnames. If RESTART=stepname is used, the first stepname found
will be used.
EXEC statements (invoking procedures or any step) without names. No restart is
possible
Creating and passing temporary datasets. Such datasets are always deleted by the
time the job terminates and, therfore unavailable for restarting.
Creating and passing nontemporary datasets. If such a dataset is not received and
assigned a permanent disposition, Job Termination will delete it, making restart
impossible
General Syntax
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.
16
JCL
General Syntax
General Syntax
PGM=pgmname positional parameter
Pgmname - Name of the program to be fetched from the loadlibrary and executed.
E.g.3.1
OR
17
JCL
The following keyword parameters can be specified at the EXEC statement. They are
REGION, ADDRSPC, TIME , PARM and ACCT.
General Syntax
E.g. 3.2
General Syntax
18
JCL
1440 - 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.
Remark :
It is possible for a step to get more CPU time than that is specified in the TIME
parameter or the default by a maximum 10.5 seconds. This is due to the fact that the
system checks for violations every 10.5 seconds.
E.g 3.3
General syntax
ADDRSPC={VIRT|REAL}
VIRT The REGION will be virtual storage and is the default
REAL The REGION will be real storage.
If the ADDRSPC parameter is also coded in the JOB statement, the value in the JOB
will be used.
Remark:
This is the rarely used parameter because of the default. Note that ADDRSPC=REAL
is a parameter that is disallowed in practically all installation because it can cause
serious performance problems for other jobs.
19
JCL
General Syntax
The ACCT parameter is seldom used, and when it is, only the account number
normally appears. This is used to charge resource utilization for a step to a different
account number other than the one coded in the JOB statement.
If an account number is also coded in the JOB statement, the account number in the
EXEC statement will be used.
E.g 3.4
General Syntax
PARM=string 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.
LINKAGE SECTION.
1 PARM.
05 PLENGTH PIC S9(04) COMP.
05 INFO PIC X(05).
PROCEDURE DIVISION USING PARM.
0000-MAIN-PARA.
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.
20
JCL
E.g 3.5
E.g 3.6
A return code is a number between 0 and 4095, issued by an executing program just
before its execution is finished. It is intended to identify an important event found (or
not found) during the execution. For example, a program may issue a return code of
21 to indicate that a problematic event (such as a record is out of sequence) was
detected during the execution or a return code of 0 to indicate that the execution was
21
JCL
trouble free. The return code issued by a program is saved by the system for the
duration of the job. Any subsequent step of the same job can interrogate this return
code by using the COND parameter either in the JOB or EXEC statement. The result
of this interrogation is to permit or bypass the execution of the step. Note that the
return code is never available to a job other than the one issued it. In other words, the
step that interrogates the return code must be in the same job as, and subsequent to,
the step that issued it.
IBM-established conventions.
Return code of 0 indicates a complete success.
Return code of 4 indicates a warning. The warning is benign, so a return code will
normally be treated as acceptable.
Return code of 8 indicates a questionable results.
Return code of 12 indicates bad results.
Return code of 16 indicates a terminal condition.
The COND Parameter can perform a test (or multiple tests) at the beginning of each
step against the return (condition) codes issued by the previous steps. If a test is
satisfied , none of the steps from that point on will be executed.
General Syntax
An example can best illustrate the mechanism of the COND parameter. Consider a job
with five steps. Assume that none will ABEND.
STEP 1 is executed by default, since no previous return codes exist and hence, the
COND parameter in the JOB statement will be ignored for the first step.
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,
22
JCL
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 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.
General Syntax
COND=((code,operator[,stepname])[,(code,operator[,stepname])][,EVEN|
ONLY]) keyword parameter
23
JCL
Operator provides a comparison between a return code and the code. There are six
operators : LT, LE, NE, EQ, GT, GE
Stepname Identifies the name of the preceding step whose return code will be
interrogated. It can also appear as two names procexec.stepname where procexec
identifies the name of the EXEC statement invoking a procedure and stepname the
stepname within the procedure.
EVEN - requests that execution be permitted even though a previous (any previous)
step has ABENDed.
ONLY - requests that execution be permitted only if a previous (any previous) step
has ABENDed.
There can be a maximum of eight tests in the COND parameter. EVEN or ONLY
counts toward eight. Condition is evaluated from left to right and if a test is satisfied,
only that step is not executed.
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.
An example can best illustrate the mechanism of the COND parameter. Consider a job
with five steps. This is a class room exercise.
24
JCL
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.
25
JCL
5. 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.
General Syntax
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.CTS.empfile
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 &&.
Remark :
If the DSN name is omitted from a DD statement (except DD * , SYSOUT and
DUMMY) also indicates a temporary dataset. However the system generates a name
with the following format :
SYSyyddd.Thhmmss.RV001.jobname.R0000001
//SORTWK1 DD UNIT=SYSDA,SPACE=(TRK,(1,2),RLSE)
26
JCL
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.
e.g : DSN=*.step1.dd1
e.g : DSN=*.dd1
General Syntax
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.
OLD - Indicates that an existing dataset will be retrieved and demands exclusive
control.
27
JCL
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.
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.
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.
2 A VSAM cluster cannot be deleted by coding DISP=(OLD,DELETE) as it defaults
to DISP=(OLD,KEEP).
28
JCL
3 A member of PDS cannot be deleted, as DISP applies to the entire PDS, and as
result it deletes the entire PDS. Use either TSO or IEHPROGM utility.
4 The system always issues a message indicating DELETED or NOT
DELETED N N indicates the reason for failing.
KEEP Indicates that the dataset is to be kept when the step terminates. The system
takes no action and issues a message indicating the dataset was kept. Again, the
system issues a message KEPT. Note that NOT KEPT message does not exists.
CATLG Indicates that the dataset is to be kept and an entry for it placed in the
catalog when the step terminates.
Note :
1. If cataloging is successful, the system issues CATALOGED
2. If cataloging fails for a NEW dataset, the message will NOT CATLGD n
(n indicates the reason for failing).
3. If the dataset to be catologed is OLD or MOD , which was opened but did extend
into additional volume(s), the message will RECATALOGED n
4. If the dataset to be cataloged is OLD or MOD and has extended into additional
volume(s), the message will be recataloged
5. CATLG implies KEEP. DISP=(NEW,CATLG,DELETE) is a very common
parameter.
//dd1 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
dataset and issues the appropriate message. Unfortunately, NOT CATLGD 2 is just
a warning, operator tend to ignore.
29
JCL
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))
//* (NEW,DELETE) IS THE DEFAULT
30
JCL
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
DISP=OLD defaults to DISP=(OLD,PASS) and the message will appear in the
output INVALID DISP FIELD PASS SUBSTITUTED
If the abnormal disposition field is omitted, the default is the normal disposition
field.
General Syntax
device address
UNIT =( generic device name ,device count ,DEFER ) Keyword parameter
generated device name
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.
31
JCL
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)
Note : UNIT=(,2) can also be used if the device is being supplied by the catalog.
DEFER : Requests that the mount message to the operator not be issued by the
allocation routines but by the open routines when, and, if the dataset is opened.
Note : DEFER must never be used with disk. Generally, used for tapes.
There is no default for device name. If it is not coded in the UNIT parameter and it is
also not supplied by the catalog, the Passed dataset Queue, the result will be allocation
JCL error . The message is
IEF210I JOBNAME STEPNAME DDANAME UNIT FIELD SPECIFIES
INCORRECT DEVICE NAME, which is misleading. It means that the device name
was needed but not coded.
32
JCL
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
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 exausted.
General Syntax
TRK,
SPACE=( CYL, (prim-alloc [,sec-alloc] [,directory]) [,RLSE])
Blksize,
TRK Requests that space be allocated in tracks.
33
JCL
Remark :
The system will always allocate the primary quantity in the least number of extents
possible on a single volume. The primary quantity cannot be split over multiple
volumes. The primary allocation cannot be omitted (coding 0 is allowed). It is
ignored if the dataset is old.
e.g 1 SPACE=(TRK,3)
e.g 2 SPACE=(CYL,4)
e.g 3 SPACE=(23440,100)
e.g 5 SPACE=(TRK,0)
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.
34
JCL
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.
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)
35
JCL
General Syntax
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
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
TM Tape Mark
36
JCL
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).
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
Remark :
The DCB referback copies the DCB parameter as opposed to the DSN and VOL=REF
referbacks which acquire the dataset name and the volser respectively, whether or not
the DSN and VOL parameters are present in the referenced DD statement. If the DCB
referback refers to a DD statement which contains no DCB, nothing is copied and no
message appears.
37
JCL
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.
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.
38
JCL
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)
DEN Identifies the density of the tape. DEN=3(or 4) indicates 1600 (or 6250 ) BPI
density.
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.
39
JCL
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.
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.
40
JCL
In user writtem programs, if you use COBOL ACCEPT statement. In your run JCL one
of the DD statements will be SYSIN dd statement.
//sysin dd *
1234
/*
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
/*
//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 Function
* For reading data without // or /* in columns 1 and 2.
DATA For reading data with // but not /* in columns 1 and 2
containing JCL or statements.
DLM For reading data with either // or /* in columns 1 and 2.
Remark :
If sysin data is not preceded by DD *, the system will generate a statement and place
it in front of the sysin data .
E.g
41
JCL
//da0001ta job la2719,..
//s1 exec pgm=ass1
//steplib dd
1234
//dd1 dd
is equivalent to
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.
42
JCL
(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
This DD statement is used for printing system messages generated by JES2 or JES3.
Each step must have SYSPRINT DD statement. Absence will cause SYSPRINT
DD STATEMENT MISSING message in the sysout.
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.
//dd1 dd dsn=da0001t.CTS.group1,disp=shr
// dd dsn=da0001t.CTS.group2,disp=shr
// dd dsn=da0001t.CTS.group3,disp=shr
43
JCL
//dd1 dd dsn=da0001t.pds1.group1,disp=shr
// dd dsn=da0001t.pds2.group2,disp=shr
// dd dsn=da0001t.pds3.group3,disp=shr
E.g. Assume that in the JCL below, the first concatenation has a blocsize of 800, the
second a blocksize of 800- and the third a blocksize of 23400.
//infile dd dsn=da0001t.CTS.group1,disp=shr,dcb=23400
// dd dsn=da0001t.CTS.group2,disp=shr
// dd dsn=da0001t.CTS.group3,disp=shr
4. 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 dd dsn=da0001t.empfile,disp=shr
// dd dsn=da0001t.CTS.data(emp),disp=shr
5. 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.
44
JCL
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
Remark :
A JOBLIB DD statement can have several concatenations (max: 16)
E.g
//da0001ta job,la2719,
//joblib dd dsn=da0001t.lib.loadlib,disp=shr
// dd dsn=da0001t.lib1.loadlib,disp=shr
// dd dsn=da0001t.prod.loadlib,disp=shr
//s1 exec pgm=proga
45
JCL
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
E.g 2:
//da0001ta job,la2719,
//joblib dd dsn=da0001t.lib.loadlib1,disp=shr
//s1 exec pgm=proga
//s2 exec pgm=progb
//steplib dd dsn=da0001t.lib.loadlib,disp=shr
//s3 exec pgm=progc
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.
Remark :
SYSUDUMP DD statement is more often used.
46
JCL
//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=*
Remark :
1 If neither a SYSUDUMP nor a SYSMDUMP nor a SYSABEND statement is
coded wihin a JCL of an ABENDing step, a small amount of information is
provided. This information is seldom useful in resolving the problem that caused
the ABEND failure.
2 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.
47
JCL
6. PROCEDURE
There are two types of procedures :
- Catalogue Procedures
- InStream Procedures
INVOKING A PROCEDURE
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 :
48
JCL
//stepname.ddname DD
// DD
// .
// .
// DD overriding parameters
All overriding EXEC parameters must be coded in the EXEC statement that
invokes the procedure.
49
JCL
procedure lam
Required in Step S2 :
Required in Step S3 :
50
JCL
Example 1:
Required
OUT1 must be dummied
Override
//S.OUT1 DD DUMMY
Example 2 :
Required
Second concatenation of INI must be dummy
Override
//S1.INI DD
DD DSN=U1.B3
DD DUMMY
Example 3:
Required
DD statement CNTL must be //CNTL DD*
Override
51
JCL
//S1.CNTL DD*
Example 4 :
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 :
Example 2 :
52
JCL
Procedure BLTX
SYMBOLIC OVERRIDING
If a symbolic and a regular override conflict, the regular override always prevails.
PROCEDURE SSP
Assume possible values that the PARM parameter can assume are ALD, BLD, CLD,
etc.
Substitution results in
53
JCL
Example 1 :
Substitution results in
Example 2 :
substitution results in
PROCEDURE SWP
Substitution results in
For those symbolic overrides not found in the EXEC statement, the default
symbolic overrides in the PROC statement will be used.
54
JCL
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 :
55
JCL
7. UTILITY
IEFBR14 UTILITY
This Utility is commonly used to delete, allocate and to uncatalog dataset
Example 1 :
Example 2
56
JCL
IEBGENER UTILITY
This utility is commonly used to copy, concatenate and to empty sequential
datasets
************************************************************************
* USING THE IEBGENER UTILITY TO COPY DATASETS
* SYSSUTI PROVIDING THE INPUT AND SYSUT2 BEING
* THE OUTPUT
************************************************************************
************************************************************************
* USING THE IEBGENER UTILITY TO CONCATENATE DATASETS
* SYSSUT1 PROVIDING THE INPUT AND SYSUT2 BEING
* THE OUTPUT
************************************************************************
//DA0001TA JOB LA2719,CTS,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)
57
JCL
************************************************************************
* USING THE IEBGENER UTILITY TO EMPTY EXISTING DATASET
************************************************************************
//DA0001TA JOB LA2719,CTS,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
//
58
JCL
SORT UTILITY
The utility is commonly used to sort data, copy selective data, remove duplicates,
change data throughout the file.
WORKING : It assumes that all input records are out of sequence and it puts them in
sequence you request.
Eg. Employee data is sorted in the sequence of Emp. No., Emp. Name or Salary etc.
SORT UTILITY
Syntax
This syntax is used if all the fields on which the dataset to be sorted are of same type.
Position : Location of the 1st byte of the key field, in the input record
Length : Length in bytes of the key field. Sum of all key fields (their lengths) should
not exceed 4092
Format : Two characters code that identifies the format (type) of the data
Sequence : 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
59
JCL
SORT JCL 1
SORT JCL 2
60
JCL
SORT JCL 3
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'.
61
JCL
SORT JCL 4 (Sorts on Job and selects Jobs beginning with M and Deptno beginning
with 1)
SORT UTILITY
Records which do not satisfy the condition are sorted and copies into the output
dataset
//********************************************************
//*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')
/*
62
JCL
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.
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.
63
JCL
10. Write a JCL to create a sequential dataset and a PDS using IEFBR14.
11. Write a JCL for IEBGENER to copy from EMPFILE into another. Try out all
the JCLs given in the handout.
12. Write a JCL to sort the EMPFILE in descending or ascending order of EMP-
NO.
64
JCL
13. APPENDIX-B
(Bibliography/references)
-
-
-
- .
65