You are on page 1of 273

1

COURSE OBJECTIVES
• Appreciate the need for Job Control Language.
• Have an overview of Job Control Language in IBM environment.
• Know the structure of Job Control Language statements.
• Know the usage of the various parameters of Job Control
Language statements.
• Know the structure of Job Control Language procedures.
• Know the concept of Generation Dataset Groups.
• Know the purpose and usage of common IBM utilities.
• Be able to write JCLs and test them on MVS workbench.
• Appreciate the relation between COBOL program and JCLs.

2
SESSION -- I

3
OBJECTIVES

To understand
• What is a JCL ?
• Why JCL is required ?
• Overview of Job Entry Sub-System
• Various components of a JCL statement.

4
JOB CONTROL LANGUAGE ( JCL )

• Job Control Language is a means of communication between a


program and the MVS Operating System.
• Without JCL, no program can run on an IBM Mainframe.
• JCL is not a procedural language.
• Provides primary interface between user and JES ( Job Entry
Subsystem ).
• Used to perform batch mode processing under MVS.
• Within a job, JCL provides the specification necessary for
MVS to process the job.

5
• Specifications for a job are

* User identity.
* Data file identity.
* Resource Requirement.
* Error handling.

6
WHY JCL ?

• To identify themselves (users) to the system for security and


accounting purposes.
• To identify the directory and data files required for the job.
• To specify the I/O devices required by the job ( Tape, Disk,
Printer).
• To specify what action the system should take in exceptional
cases.

7
JOB ENTRY SUB SYSTEM

JES is a MVS component assigned with the task of keeping track


of Jobs that enter the system, present them to MVS for processing
and send their spooled output to correct destination.

• JES processes jobs based on job class and priority.


• This scheduling of job is handled by a special type of program
called Initiator.
• Each initiator is associated with one or more jobs.

8
HOW JOB IS EXECUTED

• The Initiator selects a job for execution and invokes the


interpreter.
• The interpreter’s job is to examine the job information
passed to it by JES and create a series of control blocks in the
address space.
• For each job step the initiator invokes Allocation Routines
to allocate resources (units, volumes and data sets) required by
the job step.

Contd..

9
HOW JOB IS EXECUTED ( Contd..)

• The Initiator then creates a user region, loads the user program
into it and transfers control to the user program.
• When the execution of user program is complete, the initiator
invokes routine to deallocate the resources used by the job step.

10
OUTPUT LISTING GENERATED AFTER JOB
EXECUTION

• Job log : is a record of JES messages written to the operator’s


console as well as the operator’s reply where appropriate.
• JCL listing: lists the JCL steps performed.
• The Message Log : shows system messages concerning the
execution of job steps and the allocation and deallocation of data
sets.
• Sysprint : output listing for sysprint data set which specifies
sysout =A

11
BASIC FORMAT OF JCL STATEMENTS

identifier [name] [operation] [parameters] [comments]

Explanation

Identifier Two slashes starting in column 1. Exceptions: (1) for a


delimiter statement,/* starting in column 1;(2) for a
comment statement,//* starting in column 1.

Name O ne to eight alphanumeric or national characters,


starting with a letter or national character.
Must begin in column 3 if coded.

Contd..

12
Operation A valid operation code,such as JOB,EXEC,or DD.
Must be preceded and followed by a space.

Parameters One or more parameters depending on the operation.


Individual parameters are separated from one another
by commas,with no intervening spaces.

Comments Comments may follow the parameters,preceded by one


space and not extending beyond column 71.

13
E.g.. The statements in the sample JCL can be categorized
into five different fields.

// Name Operation Parameters Comments


// JOB1 JOB (P155),
‘XYZ’,
CLASS=A,
PRTY=6.
// STEP1 EXEC PGM=
PROGRAM1
// REPORT1 DD SYSOUT=A
//

14
SESSION -- II

15
OBJECTIVES

To understand

• Job statement

• Positional parameters in JOB statement

• Keyword parameters in JOB statement

To try and solve classroom exercises.

16
17
‘JOB’ STATEMENT

INTRODUCTION

• In JCL, a job can be considered as a unit of work that has to be


executed. It contains several JCL statements that instruct the
operating system what to do.

• The job statement identifies the beginning of a job to the


operating system.

18
The format of the statement is as given below.

// NAME OPERATION PARAMETERS COMMENTS


// JOBNAME JOB OPERANDS COMMENTS
<
POSITIONAL /
KEYWORD
PARAMETERS
>

19
JCL PARAMETERS ON THE JOB STATEMENT

FUNCTION CORRESPONDING JCL


PARAMETER
Specification of the JOB
job
Specification of job JOBNAME
name
Specification of (ACCOUNTING INFORMATION)
accounting
information
Specification of the NAME
programmer name

Contd..

20
(JCL PARAMETERS ON THE JOB STATEMENT Contd...)

FUNCTION CORRESPONDING JCL


PARAMETER
Categorization of job CLASS
Specification of output MSGCLASS
class to job log
Specification of MSGLEVEL
printing the system
messages
Assignment of priority PRTY
to a job
Holding a job for later TYPRUN
execution

21
JOBNAME

• The jobname must start in column 3, immediately following


the double slashes.

• It must be followed by at least one space.


• Valid names can be 1 to 8 alphanumeric characters in length.
• The #, @, and $ symbols can also be included in the name.
• The first character of the name must be alphabetic or national.
It cannot be numeric.

22
Some examples of valid job names

//cci9393
//r4

Some examples of invalid job names

//122fsf ( number is coded as the first character )


// safasfa ( space coded after the slashes )
//afasfjlasfjlasf ( jobname is longer than 8 characters )

23
POSITIONAL PARAMETERS IN JOB
STATEMENT

• Job accounting information parameter.

• Programmer name parameter.

24
JOB ACCOUNTING INFORMATION
PARAMETER

• Accounting information in an IBM mainframe environment is


used to bill or charge back any job that is run on the mainframe.

• The accounting information parameter identifies the account


number which will be billed for the CPU time utilized on the
mainframe.

SYNTAX

( account-number, additional accounting information)

25
EXAMPLE 1 :

//JOB1 JOB (A123,DEPT1)

JOB1 is the name of the job. JOB is the operation. A123 is the
account number. DEPT1 is the additional accounting information.
Since both the parameters are coded, they are enclosed in the
parenthesis.

EXAMPLE 2 :

//JOB1 JOB ‘A123, DEPT1’

26
PROGRAMMER-NAME PARAMETER

Programmer name parameter specifies two things:

. Programmer name

. Information related to the job being submitted.

SYNTAX

It should be coded immediately after the accounting


information parameter

27
EXAMPLE :

//JOB1 JOB (A123), VENU

The parameters in this statement are:

The double(//) slashes are required at the start of each JCL


statement, in columns 1 and 2.
JOB1 is the job name and immediately follows the double
slashes.
JOB is the operation.
(A123) is the account number. VENU is the programmer
name parameter.

28
KEYWORD PARAMETERS

• Keyword parameters must follow positional parameters.

• They can be coded in any order.

Some of the keyword parameters are :

CLASS
PRTY
MSGCLASS
MSGLEVEL
TYPRUN
NOTIFY

29
‘CLASS’ PARAMETER

• The class parameter assigns a Jobclass to a job.

• A Jobclass identifies the nature of the job that is to be


submitted.

• Jobs can be short-running or can take a long time, or may


utilize heavy resources.

• The Jobclass is used to identify these characteristics to the


operating system, there by categorizing the job being submitted.

30
SYNTAX

CLASS= Job class

Where job class is any character between A-Z or number


between 0-9.

EXAMPLE :

//JOB1 JOB ( A123), VENU, CLASS=K

31
‘PRTY’ PARAMETER

• The PRTY parameter is related to the CLASS parameter. It


assigns priority to jobs which belong to the same class.

SYNTAX

PRTY=priority

Priority can range between 0 to 14, or 0 to 15, depending on what


job entry subsystem (JES2 or JES3) is being run at the time.

32
EXAMPLE :

//JOB1 JOB (A123), VENU,CLASS=8, PRTY=6


//JOB2 JOB (A123), VENU,CLASS=8, PRTY=9

Job 2 will execute before Job1, because it has a higher priority


number (9) than Job1.

33
‘MSGCLASS’ PARAMETER

Messages can be categorized into two types.

• First, there are those related to the system and the JCL.

• Second, there are those that are output by the program or


procedure being executed.

• The MSGCLASS parameter determines the output device to


which, system messages and JCL messages are written.

34
SYNTAX

MSGCLASS=output-class-name

Where output-class-name can be any alphabet (A-Z) or number


(0-9).

The output-class-name is related to a specific output device to


which messages are routed.

MSGCLASS

35
EXAMPLE 1 :

//JOB1 JOB (A123), VENU, CLASS=K,PRTY=6,


MSGCLASS=A.

JOB1 is the jobname, JOB is the keyword identifying the JOB


statement,
(A123) is the account number, VENU is the author, priority is set
to 6,
and MSGCLASS is A.

36
EXAMPLE 2 :

//JOB1 JOB (A123),VENU,CLASS=K,PRTY=6,


MSGCLASS=1

The message class is set to 1, which could specify a printer or


any other output device.

37
‘MSGLEVEL’ PARAMETER

. The MSGLEVEL parameter is used to specify the JCL and the


allocation messages which will be recorded on the output device
specified in the message class.

As a JCL job is submitted, many kinds of messages are


generated by the system. These messages can be categorized as
follows :

• First, log messages indicating job name, user name, etc. are
routed to the output device.

Contd..

38
‘MSGLEVEL’ PARAMETER (Contd..)

• Next, JCL statements comprising that job are output.

• Messages related to the execution of the job are output.

• Finally, the output of the program being executed is output.

39
SYNTAX

MSGLEVEL = (statements, messages)


Or
MSGLEVEL = statements
or
MSGLEVEL = (,messages)

Where statements may be the number 0,1, or 2, and messages is a


value which can be 0 or 1.

STATEMENTS:
Coding a 0 in statements will result in messages related to the job
statement only being output.
Contd….

40
SYNTAX (Contd..)
Coding a 1 will result in all JCL in the job being submitted being
output.
In addition to this, if any cataloged procedures are invoked, then
their JCL will also be output.
Coding a 2 will result in only the input JCL statements being
printed.
MESSAGES:
In the messages field, 0 or 1 can be coded.
Coding a 0 will result in all allocation messages being output if the
job terminates abnormally.
Coding a 1 will result in all allocation messages being output,
regardless of whether the job terminates normally or abnormally.
MSGLEVEL

41
EXAMPLE 1 :

//JOB1 JOB (A123),‘JAI’,MSGLEVEL=(1,1)

MSGLEVEL is set to (1,1). All JCL statements will be printed,


including allocation messages.

EXAMPLE 2 :

//JOB1 JOB (A123),‘JAI’,MSGLEVEL = 0

Only the JOB statement will be printed.

42
‘ TYPRUN’ PARAMETER

. Used to specify whether a job is to be held until it is released,


or it is to be scanned for syntax errors.

SYNTAX

TYPRUN=HOLD
Or
TYPRUN=SCAN

Contd..

43
‘ TYPRUN’ PARAMETER (Contd..)

Specification of HOLD parameter results in the job being held


until further notice. Useful when jobs which utilize a lot of
resources are to be held until a time when the system is relatively
unused.

Specification of the SCAN parameter results in the job being


scanned for syntax errors and reports them to the requested output
media

44
EXAMPLE 1 :

//JOB1 JOB (A123),‘JAI’,TYPRUN=HOLD

JOB1 will be held until it is released by the operator.

EXAMPLE 2 :

//JOB2 JOB (A123),‘JAI’,TYPRUN=SCAN

The JCL will be checked for syntax errors.

45
NOTIFY PARAMETER

• The NOTIFY parameter on the JOB statement automatically


notifies the specified user when the job is completed.

Example :
//JOB10 JOB NOTIFY=JB007

User JB007 will be notified when the job finishes.

46
CLASSROOM EXERCISE - I

Write a JOB statement wherein JOB name is JOB3, accounting

information is NTP4, author name is Your name,Class is Z,

priority 9 and message class =A.

47
CLASSROOM EXERCISE - II

Write a Job statement wherein job name is JOB1, accounting

information is A123, class is A, message class is B, message level is

default, priority is 10 and typrun = scan.

48
SESSION -- III

49
OBJECTIVES

To understand
• EXEC statement
• Positional parameters and Key word parameters
• The following parameters coded on the EXEC statement
PGM ACCT PARM
ADDRSPC DPRTY PERFORM
RD
• JOBLIB and STEPLIB statements
To try and solve the classroom exercises

50
51
‘ ‘EXEC’ STATEMENT

INTRODUCTION

The EXEC statement is the first statement of each job step.

• A Job Step is a unit of work that is submitted to the


operating system in the form of collection of JCL statements.

• A unit of work can be the execution of a program or, it can


be the execution of a procedure that is pre-written and available
for general use by users of the system.

52
SYNTAX

//stepname EXEC PGM=program-name, keyword parameters

where stepname is the name assigned to the job step, EXEC is the
operation, program-name is the name of the program ( this is a
positional parameter ) and keyword parameters follow the
positional parameter

53
STEPNAME

. The STEPNAME is used to give unique and meaningful


names to each step.
SYNTAX
No special syntax is required for this parameter.
EXAMPLE 1:
//STEP01 EXEC PGM=PROGRAM1
STEP01 is the name of the step. EXEC is coded in the operation
field.PGM is the positional parameter. PROGRAM1 is being
executed.

54
Conditions In Which Stepname Is Mandatory.

• When it is necessary to reference a previously executed job step.


• When an overriding parameter is used.
• When it is required to use a restart parameter. Restart parameter
helps to restart the job from the step that failed and avoids
restarting the entire job consisting several job steps.

55
POSITIONAL PARAMETERS OF THE EXEC
STATEMENT

• Positional parameters are characterized by the order in which


they appear, and they must precede keyword parameter.

• There is only one positional parameter in the EXEC statement,


that is :

PGM parameter.

56
‘PGM’ PARAMETER

• The PGM parameter identifies the name of the program that is


to be executed.

SYNTAX

//stepname EXEC PGM=program-name

57
KEYWORD PARAMETERS OF THE EXEC
STATEMENT

• The keyword parameters coded for a job step will apply only to
that step.
• Keyword parameters can be coded in any sequence.
• Keyword parameters used in EXEC statement are :

ACCT parameter PARM parameter

ADDRSPC parameter DPRTY parameter

PERFORM parameter RD parameter

58
‘ACCT’ PARAMETER

. The ACCT parameter is used to supply accounting


information for the job step that it is used in.

SYNTAX

ACCT=(account-information,...)
Or
ACCT=account-information
account-information consists of one or more subparameters
defined by installation.

59
EXAMPLE 1:

//STEP1 EXEC PGM=PROGRAM1, ACCT=(A123,RR)

STEP1 is the stepname, EXEC is the operation. PROGRAM1 is


being executed.
The accounting information that follows the ACCT parameter is
specific to this job step only.

EXAMPLE 2:

//STEP2 EXEC PGM=PROGRAM2,ACCT=A123

60
‘PARM’ PARAMETER
• The PARM parameter is used to supply information to a program
as it executes.
SYNTAX
PARM=value
Where value is a string from 1 to 100 characters long.

EXAMPLE 1 :
//STEP1 EXEC PGM=PROGRAM1,PARM=PRINT
PROGRAM1 is executed, and the string “PRINT” is supplied to it
during execution.

61
EXAMPLE 2 :

//STEP2 EXEC PGM=PROGRAM2,PARM=‘13+10’

A special character (+) is included in the string, and therefore the


string is enclosed in apostrophes. The apostrophes are not passed to
the program as part of the string.

PARM

62
‘JOBLIB’ AND ‘STEPLIB’ STATEMENTS

• It is not enough to know the name of the program that is to be


executed. It is essential to know where that program resides.

• The EXEC statement identifies the member name only. Its


location in the system has to be specified by the JOBLIB or
STEPLIB statements.

63
‘JOBLIB’ STATEMENT
• The JOBLIB statement immediately follows the JOB
statement.
• It is a DD (Data Definition ) statement , and it specifies where
the program that is specified by the EXEC statement resides.
EXAMPLE 1 :
//JOB1 JOB (A123),‘JAI’
//JOBLIB DD DSN=M1.TEST.LOADLIB,
DISP=SHR
//STEP1 EXEC PGM=PROGRAM1
JOBLIB DD statement is used to specify the location of the
program that is to be executed. Program1 is a member of the
partitioned dataset M1.TEST.LOADLIB.

64
EXAMPLE 2 :

//JOB1 JOB (1234),‘JAI’


//JOBLIB DD DSN=M1.TEST.LOADLIB,
DISP=SHR
//STEP1 EXEC PGM=PROGRAM1
//STEP2 EXEC PGM=PROGRAM2

Both PROGRAM1 and PROGRAM2 exist in the library called


M1.TEST.LOADLIB.

JOBLIB

65
EXAMPLE 3 :

//JOB2 JOB (A123),‘VENU’


//JOBLIB DD DSN=PROGRAM3,
// DISP=SHR,
// UNIT=3321,
// VOL=SER=PACK1

The UNIT and VOL parameters are used because PROGRAM3


is uncataloged.

JOBLIB

66
‘STEPLIB’ STATEMENT
• The function of the STEPLIB statement is the same as the JOBLIB
statement. This statement is coded after the EXEC statement .
• Is effective only for that jobstep, instead of the entire job.
EXAMPLE :
//JOB1 JOB (1234),‘VENU’
//STEP1 EXEC PGM=PROGRAM1
//STEPLIB DD DSN=PROD.LOADLIB1, DISP=SHR
//STEP2 EXEC PGM=PROGRAM2
//STEPLIB DD DSN=PROD.LOADLIB2, DISP=SHR
Program1 is a member in the PROD.LOADLIB1 and program2 is a
member in the PROD.LOADLIB2.

67
CODING BOTH ‘JOBLIB’ AND ‘STEPLIB’
STATEMENTS

• If both the JOBLIB and STEPLIB statements are coded, then the
STEPLIB specification will override that of the JOBLIB for that
jobstep

• The specification of the JOBLIB will continue for any jobstep


that does not have a corresponding STEPLIB statement.

• If the same library is used for all jobsteps, then it is good practice
to code the JOBLIB statement.

68
EXAMPLE :

//JOB1 JOB (1234),‘VENU’


// CLASS=0
// MSGCLASS=T
//JOBLIB DD DSN=A100.TEST.LOADLIB,
// DISP=SHR
//STEP1 EXEC PGM=PROGRAM1
//STEPLIB DD DSN=B100. TEST.LOADLIB,
// DISP=SHR
//STEP2 EXEC PGM=PROGRAM2
//STEP3 EXEC PGM=PROGRAM3
//STEPLIB DD DSN=C100. TEST..LOADLIB,
// DISP=SHR
//

69
‘ADDRSPC’ PARAMETER

• The purpose of this parameter is to indicate to the system that


the job should use either virtual or real storage.

• Virtual storage results in program addresses being independent


of the addresses that actually exist in the computer.

• Setting the ADDRSPC to VIRT results in that job step being


paged.

• If ADDRSPC is set to REAL, then the job step is locked into


real storage only.

70
SYNTAX

ADDRSPC=REAL
Or
ADDRSPC=VIRT

VIRT indicates virtual storage, and REAL indicates real storage


only.

If ADDRSPC is omitted, virtual is the default.

71
EXAMPLE 1 :
//JOB1 EXEC PGM=PROGRAM1,
// ADDRSPC=VIRT
Program1 will be paged.

EXAMPLE 2 :
//JOB2 EXEC PGM=PROGRAM2,
// ADDRSPC=REAL

PROGRAM 2 will utilize real storage only, and will not be


paged.

72
‘DPRTY’ PARAMETER
• Used to assign Dispatching Priority to the job step.

• Dispatching priority is used by the system to determine the


order in which tasks are to be executed.

• Dispatching priority is different from class priority. Class


assigns a priority to the job, and DPRTY assigns a priority to the
job step.

73
SYNTAX

DPRTY=(value1,value2)

Where value1 ranges from 0 to 15 and specifies the priority of the


job step.
Higher the number, higher the priority.
Value 2 ranges from 0 to 15.
DPRTY is computed as follows: DPRTY=(value1)*(16)+ value2

74
EXAMPLE :

//JOB1 JOB (A123),‘VENU’


//STEP1 EXEC PGM=PROGRAM1,
// DPRTY=(12,9)

The priority in step1 is determined as :

( 12 * 16 ) + 9 = 192 + 9 = 201

75
‘PERFORM’ PARAMETER
• The PERFORM parameter is used to specify the Performance
Group for the job step.

• A Performance Group determines the rate at which the job


steps in a job have access to system resources and is helpful in
optimizing system performance.

SYNTAX

PERFORM=n
where n ranges from 1 to 999.

76
EXAMPLE :

//JOB1 JOB (A123), ‘VENU’


//STEP1 EXEC PGM=PROGRAM1,
// PERFORM=10

STEP1 is assigned the performance group10. The number 10 will


be installation defined.

77
‘RD’ PARAMETER
• The RD ( Restart Definition) is used to specify automatic restart
of a job if it abends.

• It also fully or partially suppresses the CHKPT (Checkpoint)


macro instruction, so that no checkpoints are taken as a program
executes.

• A Checkpoint is taken by the system to record the status of a


program as it executes.

• Checkpoints enable to restart a job from the last successful


checkpoint rather than from the beginning of the run .

78
SYNTAX

RD=R
Or
RD=RNC
Or
RD=NR
Or
RD=NC

Where R for restart


RNC for restart with No Checkpoint
NR for No Automatic Restart
NC for No Checkpoint.

79
EXAMPLE 1 :

//JOB1 JOB (A123), ‘VENU’


//STEP1 EXEC PGM=PROGRAM1,
// RD=R

The operator can perform automatic step restart if the job abends.
The checkpoint macro is not suppressed.

80
EXAMPLE 2:

//JOB2 JOB (B123),‘VENU’


//STEP2 EXEC PGM=PROGRAM2,
// RD=RNC

The operator can perform automatic step restart if the job step
fails. Checkpoints are suppressed.

81
CLASSROOM EXERCISE

Write a JCL with job name JOB1 , consisting of 4 steps. Step1 is


executing program COBOL1, Step2 executes COBOL2, Step3
executes COBOL3 and Step4 executes COBOL4. COBOL1 resides
on TRNG.NTP4.COB1, COBOL2 is in TRNG.NTP4.COB2,
COBOL3 and COBOL4 lie in TRNG.NTP4.COB3. The PARM
parameters associated are
Step1 ------- PRINT, Step2-------- READ, STEP3---------WRITE
Step4--------- SAVE

82
SESSION -- IV

83
OBJECTIVES

To understand
• The usage of following additional parameters coded on
both JOB and EXEC statement.
REGION
COND
TIME
• The DD statement
• Concept of Temporary datasets and Permanent datasets.
• DSN parameter coded on the DD statement.
To try and solve classroom exercises.

84
85
‘REGION’ PARAMETER

At the time that a job is run, a default amount of work space is


automatically assigned to it. This default can be overriden via
the REGION parameter.

SYNTAX

REGION=value1K
Or
REGION=value2M
Where value1 is the storage in multiples of 1024 bytes, and
value2 is storage in multiples of one million bytes. The K and M
must follow value1 and value2.

86
EXAMPLE 1 :

//JOB1 JOB (A123), ‘VENU’


//STEP1 EXEC PGM=PROGRAM1,
// REGION=96K

REGION parameter is coded in the EXEC statement, and is used to


specify that this job step can utilize 96 thousand bytes of storage.

87
EXAMPLE 2 :

//JOB1 JOB (A1230),‘VENU’


//STEP1 EXEC PGM=PROGRAM1,
// REGION=88K

REGION parameter is in the EXEC statement and is set to 88K.

88
EXAMPLE 3:

//JOB3 JOB (A123),‘VENU’,


// REGION=3M
//STEP1 EXEC PGM=PROGRAM3

REGION is coded on the JOB statement. The system will allocate


3 million bytes of storage for job3.

89
‘REGION’ CODED ON THE
JOB STATEMENT
Usually the system will provide a default region size in which the
job is to execute. However this can be overriden by using the
REGION parameter coded on the JOB statement. If enough storage
space is not specified the job will terminate abnormally.

‘REGION’ CODED ON THE


EXEC STATEMENT
The REGION parameter coded on an EXEC statement requests
storage only for that individual job step.If enough storage is not
specified the job will abend .

90
‘COND’ CODED IN THE JOB STATEMENT
A COND parameter coded on the JOB statement applies to all job
steps within the job, and it overrides COND parameters coded on
the EXEC statement, if they exist.

SYNTAX
COND=(comparison-code,condition)

Where comparison-code is a number between 0 and 4095, and


condition specifies the type of comparison to be made between the
comparison-code that has been coded, and the return code of the
prior step.

91
SOME COMMON CONDITION CODES
Return Explanation
Code
0 Implies successful execution of job
step

4 Implies warning messages have been


issued for the job step

8 Implies serious error in job step

16 Implies fatal error, execution of


subsequent job steps is halted.

92
OPERATORS CODED ON THE ‘COND’
PARAMETER

Operator Explanation
GT Bypass current step if comparision-code
is greater than the return code.
GE Bypass current step if comparision-code
is greater than or equal to return code.
LT Bypass current step if comparision-code
is less than return code.

93
OPERATORS CODED ON THE ‘COND’
PARAMETER (Contd...)

Operator Explanation

Bypass current step if comparison-code


LE
is less than or equal to return code.
Bypass current step if comparison-code
EQ
is equal to return code.
Bypass current step if comparison-code
NE
is not equal to return code.

94
EXAMPLE :

//JOB1 JOB (A123),‘VENU’,


// COND=(4,LT)
//STEP1 EXEC PGM=PROGRAM1
//STEP2 EXEC PGM=PROGRAM2
//STEP3 EXEC PGM=PROGRAM3

If a condition code less than 4 is returned at any step


then the subsequent steps would not be executed.

95
‘COND’ CODED IN THE EXEC STATEMENT

• The condition parameter coded on the EXEC statement applies


only to the Job Step that it is coded in.

• This job step is executed or bypassed, depending on the return


codes returned by one or more prior job steps.

96
SYNTAX

COND=(comparison-code,condition)
or
COND=(comparison-code,condition, stepname...)
or
COND=EVEN
or
COND=ONLY

• Comparison-code ranges between 0 and 4095,condition


specifies the type of comparison to be made between the
comparison-code that has been coded, and the return code of the
prior step.
Contd....

97
• Step name specifies the name of the preceding step whose
return code is to be checked.

• The keyword ONLY is used to specify that the step in which


it is specified is to be executed only if any of the prior steps
terminate abnormally.

COND

98
EXAMPLE :

//JOB1 JOB (A123),‘VENU’


//STEP1 EXEC PGM=PROGRAM1
//STEP2 EXEC PGM=PROGRAM2,
// COND=(8,EQ,STEP1)

The COND parameter is used to specify that step2 should be


bypassed if 8 is equal to the return code issued by step1.

99
‘TIME’ PARAMETER

• This is an optional keyword parameter and is used to specify


the amount of CPU Time that a job or step is permitted to utilize
before it is terminated.
• CPU Time is the time that a job takes to execute.
• When coded in the JOB statement, it specifies the amount of
CPU time that the JOB is allowed to use.
• When coded in the EXEC statement, it specifies the amount of
CPU time that the job step is allowed to use.
• If the TIME parameter is not specified, then the installation
defined TIME parameter is used.

100
SYNTAX

TIME=(minutes)
or
TIME=(minutes,seconds)
or
TIME=(,seconds)

EXAMPLE :
//JOB1 JOB (A123),‘VENU’,
//STEP1 EXEC PGM=PROGRAM1,
// TIME=5
5 minutes of CPU time is assigned to STEP1.

101
‘TIME’ Coded On Both JOB Statement And
EXEC Statement

• If the TIME parameter is coded on both the JOB and EXEC


statements, then the TIME parameter on the EXEC statement will
override the TIME parameter on the JOB statement .

102
CLASSROOM EXERCISE
Write a JCL where job name is JOB1,programs to be executed are
COBOL1, COBOL2, COBOL3, COBOL4.

COBOL1 and COBOL2 are in TRNG.NTP4.COB,

COBOL3 is in TRNG.NTP4.COB3 and COBOL4 is in


TRNG.NTP4.COB4.

Region for COBOL2 is 40K and CPU time is 10 min.

COBOL4 must be executed only if COBOL3 has terminated


normally.

103
104
‘DD’ ( DATA DEFINITION ) STATEMENT

INTRODUCTION

• The data definition statement is used to identify the source of


input and the placement of output information.

On successful execution of a job, the data can be:

• Deleted.
• Kept.
• Cataloged.
• Passed to subsequent job steps.
• Uncataloged.

105
‘DD’ STATEMENT

// Name Operation Parameters Comments

// dd name DD Operands Comments


<positional/
keyword
parameters>

106
‘DD’ NAME
• The ddname identifies the name of the data definition
statement.
• As a job executes, the system performs device and space
allocations for each ddname specified.
• Each ddname should be unique within the jobstep.
EXAMPLE :
//JOB1 JOB A123,’VENU’
//STEP1 EXEC PGM=PROGRAM1
//NAME1 DD DSN=DATA1
NAME1 is the DD name.

107
DD NAMES RESERVED FOR THE SYSTEM
USE

The following names are reserved for the system use and may
not be used to define DD statements:

//JOBLIB //JOBCAT
//SYSABEND //SYSIN
//SYSCHK //STEPLIB
//STEPCAT //SYSUDUMP
//SYSOUT //SYSOUD
//SYSDBOUT

108
‘DSN’ PARAMETER
• The DSN parameter is a keyword parameter on the DD
statement. It is used to specify the name of the data set to the
operating system.

SYNTAX

DSN=data-set-name
Where data-set-name can be qualified or non-qualified.

109
QUALIFIED NAMES

• Qualified names consist of two or more non-qualified names,


each separated from the next by a period . The first name is called
the highest qualifier of that name.

• Qualification results in the location of the data set being easily


identified by its name.

DSN parameter

110
EXAMPLE:

//JOB1 JOB A123,‘VENU’


//STEP1 EXEC PGM=PROGRAM1
// DD DSN=PROJECT1.GROUP2.DATA(TEST1)

111
TEMPORARY DATA SETS

• A temporary data set is created during a job execution and


deleted after job completion.

• A temporary data set is recognized as such if the DSN parameter


is omitted.

• The system assigns a unique name to it, and reference is made to


it by referencing the stepname and ddname. This is called a refer
back.

112
EXAMPLE 1:

//JOB1 JOB A123,‘VENU’


//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD
//STEP2 EXEC PGM=PROGRAM2
//DATA2 DD *.STEP1.DATA1

Step1 executes PROGRAM1 and a data set DATA1 is created


in the next statement.

Step2 executes PROGRAM2 and the temporary data set


DATA1, created in STEP1 is referenced via referback. * indicates
a referback.

113
• A temporary data set is also recognized by starting the dataset
name with two ampersands in the DSN parameter .

EXAMPLE 2 :

//JOB1 JOB A123,‘VENU’


//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD DSN=&&ABCD

Here ABCD is prefixed with two ampersands and is a temporary


dataset.

114
PERMANENT DATA SETS
• A permanent data set is not deleted after a job is completed and
may be cataloged, if requested.

• It is coded by setting a DSN parameter that is equal to a


qualified or non-qualified name.

EXAMPLE :

//JOB1 JOB A123,‘VENU’


//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD DSN=MIS.PROJECT.COBOL(FILE1)

115
CLASSROOM EXERCISE

Write a JCL where job name is JOB1, Two programs COBOL1 and

COBOL2 are executed and they are in TRNG.NTP4.COB. A

temporary dataset NTP is created by step1 and is used by step2. Use

refer back technique.

116
SESSION -- V

117
OBJECTIVES

To understand
• The following parameters and their sub-parameters coded on
the DD statement.
DISP
UNIT
To interpret the examples using the above parameters and their
sub-parameters.

To try and solve the classroom exercises.

118
‘DISP’ PARAMETER
• DISP is a keyword parameter, used to instruct the system as to
the current status of a data set, and the steps to be taken with the
data set upon normal and abnormal termination of the job.

SYNTAX

DISP=(status,normal-disposition,abnormal-disposition)

• The status field indicates the current status of the data set i.e
whether it exists or has to be created.

Contd...

119
SYNTAX (Contd..)

• If the data set exists the mode of access is to be specified i.e


whether to be used exclusively , or if it can be shared by other
jobs in execution.

• The normal disposition subparameter specifies how the data


set is to be disposed upon normal execution of the job.

• The abnormal-disposition subparameter specifies how the


data set is to be disposed upon abnormal execution of the job.

DISP parameter

120
SUB-PARAMETERS ON ‘DISP’PARAMETER

Status Normal disposition Abnormal disposition


NEW DELETE DELETE
OLD KEEP KEEP
MOD CATLG UNCATLG
SHR UNCATLG CATLG
PASS

121
‘NEW’ SUB-PARAMETER

• Coding DISP= NEW indicates that a new data set is to be


created.

• If the data set is to reside on a direct access volume, such as


disk then the UNIT and SPACE parameters must also be coded.

• NEW is also the default, if nothing is coded in the status


field.

122
EXAMPLE :

//JOB1 JOB A123,‘VENU’


//STEP1 EXEC PGM=PROGRAM1
//DATA DD DSN=PROJECT1.GROUP1.JCL.(TESTDATA),
// DISP=NEW

Program1 is executed and the data set is created. The next


statement utilizes the DISP parameter to inform the operating
system that this is a new data set

123
‘OLD’ SUB-PARAMETER

• Coding OLD in the status field results in the operating system


searching for an existing data set with the name specified in the
DSN parameter.
• The data set becomes available exclusively to the step in which
it is referenced.

EXAMPLE :
//JOB1 JOB A123,‘VENU’
//STEP1 EXEC PGM=PROGRAM1
//DATA DD DSN= PROJECT1.GROUP1.JCL(TESTDATA),
// DISP=OLD

124
‘MOD’ SUB-PARAMETER

• The MOD subparameter is used to modify sequential data


sets.

The MOD parameter does the following things :


• If the sequential data set does not exist, then the system
replaces MOD with NEW, and creates it.

• If the data set already exists, use of the MOD subparameter


results in the reader/writer of the device positioning itself just
after the last record, so that records can be added to it easily.

125
SHR SUB-PARAMETER

• Setting DISP=SHR allows multiple jobs to read the same data set
which already exists.

EXAMPLE :

//JOB1 JOB A123,‘VENU’


//STEP1 EXEC PGM=PROGRAM1
//INPUT1 DD DSN=USER1.GROUP1.JCL.NAMEFILE
// DISP=SHR

126
CLASSROOM EXERCISE

Write a JCL where job name is JOB1 and two programs COBOL1

and COBOL2 are being executed. Both the programs reside in

TRNG.NTP4. COBOL1 creates a new permanent dataset which

will reside in TRNG.NTP4.DATA1 and it is referred by COBOL2.

127
NORMAL-DISPOSITION FIELD

• The normal disposition field in the DISP parameter is used to


indicate what to do with the data set upon normal termination of the
job.

SYNTAX
DISP=(status,normal-disposition,abnormal-disposition)
The sub-parameters that can be coded here are :
DELETE
KEEP
CATLG
UNCATLG
PASS

128
‘DELETE’ SUB-PARAMETER

• The delete sub-parameter indicates that the data set being


referred is to be deleted after the successful termination of the job.

EXAMPLE :

//JOB1 JOB A123,‘VENU’


//STEP1 EXEC PGM=PROGRAM1
//NAME1 DD DSN=TEMPFILE,
// DISP=(OLD,DELETE)

TEMPFILE is a pre-existing data set that is deleted upon the


successful termination of the job JOB1.

129
‘KEEP’ SUB-PARAMETER

• The KEEP subparameter indicates that the data set is to be


retained or kept upon successful execution of the job.

• This parameter should be used with permanent data sets.

EXAMPLE :
//JOB1 JOB A123,‘VENU’
//STEP1 EXEC PGM=PROGRAM1
//NAME1 DD DSN=BOOKS,
// DISP=(OLD,KEEP)
A permanent data set called BOOKS is retrieved and kept after it
has been read.

130
‘CATLG’ SUB-PARAMETER

• The CATLG subparameter is used to specify that the data set


is to be retained and recorded in the system catalogs after
successful termination of the job.

• The data set name, unit, and volume are recorded.

• Temporary data sets can never be cataloged, they can only be


passed to the next step using the PASS subparameter.

131
‘UNCATLG’ SUB-PARAMETER

• The UNCATLG subparameter is used to remove the entry of the


data set from the system catalogs.
• The data set itself is not deleted.
EXAMPLE :
//JOB1 JOB A123,‘VENU’
//STEP1 EXEC PGM=PROGRAM1
//NAME1 DD DSN=DISK.OUTPUT,
// DISP=(OLD,UNCATLG)
The pre-existing data set, called DISK.OUTPUT, is removed from
the system catalogs. If the data set is not found the job terminates
abnormally.

132
‘PASS’ SUB-PARAMETER
Setting DISP to PASS specifies that the data set is to be passed to
a subsequent job step within the same job.

• The data set will continue to be passed to subsequent steps, if it


is not utilized by any intervening job steps.
• The data set can be used by any subsequent step.
• Both temporary and permanent data sets can be passed to
subsequent steps.
• Data from a prior step can be referenced by its name, or by the
referback syntax.
• If this subparameter is used with tape data sets, then the tapes
remain mounted between job step.

133
EXAMPLE 1 :
//JOB1 JOB (K123),‘JAI’
//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD DSN=FILE1,
DISP=(NEW,PASS)
//STEP2 EXEC PGM= PROGRAM2
//DATA2 DD DSN=FILE1,
DISP=(OLD,DELETE)
PROGRAM1 creates a new dataset called FILE1.
The DISP parameter is used to pass it on to subsequent steps
within that job.
In STEP2, FILE1 which is passed from the prior step is
accessed. Hence the DISP parameter is : DISP=(OLD,DELETE)

134
EXAMPLE 2 :
//JOB1 JOB (K123),‘JAI’
//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD DSN=FILE1,
DISP=(NEW,PASS)
//STEP2 EXEC PGM= PROGRAM2
//DATA2 DD DSN=*.STEP1.DATA1,
DISP=(OLD,DELETE)
Data passed from STEP1 is accessed in STEP2 via Referback.
Referback follows the following syntax :
DSN=*.stepname.ddname
Where ‘*’ is required, stepname is the name of the step, and
ddname is the DD statement name.

135
EXAMPLE 3 :

//JOB1 JOB (K123),‘JAI’


//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD DSN=&&XYZ,
// DISP=(NEW,PASS)
//STEP2 EXEC PGM= PROGRAM2
//DATA2 DD DSN=*.STEP1.DATA1,
// DISP=(OLD,DELETE)

The Refer back method is used to access the temporary dataset


&&XYZ, which was created in STEP1.

136
CLASSROOM EXERCISE

Write a JCL where job name is JOB1 and two programs P1 and

P2 are executed. A PDS is created by P1 and is exclusively used

and should be retained on normal termination of the job.

137
ABNORMAL-DISPOSITION FIELD
• The abnormal disposition field tells the system what to do with
the data set upon abnormal termination of the job.
• This subparameter is required only if the abnormal disposition
is different from the normal disposition.
DISP=(status,normal-disposition,abnormal-disposition)
The following subparameters can be used in this field :
DELETE
KEEP
UNCATLG
CATLG
The description of each of the above parameters remain the same
except that now they refer to abnormal termination of the job.

138
EXAMPLE 1 :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD DSN=FILE1,
// DISP=(NEW,CATLG,DELETE)

The dataset called FILE1, is created. If the job terminates


successfully, the system is informed that it should be cataloged.
If the job terminates unsuccessfully, the system is instructed to
delete it.

139
EXAMPLE 2 :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PGM=PROGRAM2
//DATA1 DD DSN=FILE1,
// DISP=(NEW,CATLG,KEEP)

A new dataset FILE1 is created and on successful termination of


the job the system is instructed to catalog it. Upon unsuccessful
termination, the system is instructed to retain the dataset, but not
to catalog it.

140
EXAMPLE 3 :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PGM=PROGRAM3
//DATA1 DD DSN=FILE1,
// DISP=(OLD,CATLG,DELETE)

The system is informed that FILE1 is a old data set. Upon


successful termination of the job, this dataset is to be cataloged.
Upon unsuccessful termination of the job, it is to be deleted.

141
CLASSROOM EXERCISE

Write a JCL where job name is JOB1 and two programs P1 and P2

are executed . A PDS is created as a result of the execution of

program P1 and should be cataloged on normal termination of the

job and should be deleted on abnormal termination of the job. This

PDS should be referred back by step 2 where in program P2 is

executed.

142
‘DISP’ DEFAULTS

• The status field defaults to NEW


• If the status is NEW the default for normal disposition is
DELETE and if the status is old the default for normal disposition
is KEEP.

• The abnormal disposition field defaults to the same value as the


normal disposition field.

143
‘UNIT’, ‘VOL’ AND ‘LABEL’ PARAMETERS

• The DD statement is used to supply the input and output


information to the operating system.

• The UNIT parameter is coded on the DD statement to specify


an input or output device that is to be accessed.

• The VOL parameter is also coded on the DD statement to


identify specific disk tape volume(s).

• The LABEL parameter is used to specify information specific


to tape datasets.

144
‘UNIT’ PARAMETER

INTRODUCTION

In an IBM mainframe environment, input and output devices can


be categorized in different ways. The following characteristics can
be used to identify them to the operating system:

• All devices have an address assigned to them at the time that


they are added to the system. Devices can be referenced via this
address.

• Device can be distinguished by a number which indicates the


numeric model.
Contd...

145
‘UNIT’ PARAMETER (Contd...)

• Certain types of devices can be grouped together, and the group


given a name. Devices can be referenced via group name.

• If a device is specified in one job step, then a subsequent step


may request the same device by referencing the ddname of the
DD statement in which the unit was originally specified.

146
JCL PARAMETERS USED IN ‘UNIT’

CORRESPONDING JCL
FUNCTION PARAMETERS AND
SUBPARAMETER
Specification of device via address UNIT=device-address
Specification of device by model UNIT=device-type
type
Specification of device as part of a UNIT=group-name
group
Specification of device used by a UNIT=AFF
previous job step
Deferring the mounting of a tape UNIT=(device.defer)
device, until it is ready to be used

147
SYNTAX

The general syntax for the UNIT parameter is :

UNIT=device-address

UNIT=device-type

UNIT=device-group-name

UNIT=AFF=prior-ddname

UNIT=(device,DEFER)

148
SPECIFICATION OF DEVICE ADDRESS

• Each I/O device attached to a computer is assigned a hardware


address when a system is generated

• Device addresses are expressed as three hexadecimal digits.

EXAMPLE
//JOB1 JOB A123,‘JAI’
//STEP1 EXEC PROGRAM1
//DATA1 DD DSN=FILE1,
// UNIT=A04
A dataset called FILE1, which resides on a device identified by its
hardware address A04, is accessed.
Unit parameter

149
SPECIFICATION OF DEVICE TYPE
• A device type is identified by the model number assigned to that
device by IBM.
• In order to code the device type on the UNIT parameter, one
needs to know the devices that are being used by the installation.
EXAMPLE:
//JOB1 JOB A123,‘JAI’
//STEP1 EXEC PROGRAM2
//DATA1 DD DSN=FILE2,
// UNIT=3380.
A dataset called FILE2, which resides on a 3380 disk unit, is
accessed.
Unit parameter

150
SPECIFICATION OF DEVICE GROUP

• A device group name is a symbolic name which is assigned to a


group of devices when the system is generated.

• Devices are often grouped together based on their function.For


example, SYSDA is traditionally assigned to direct access storage
devices.

Unit parameter

151
EXAMPLE :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PROGRAM3
//DATA1 DD DSN=FILE3,
// UNIT=SYSDA

A data set called FILE3 resides on any of the devices which are
grouped under the symbolic name SYSDA.

UNIT parameter

152
CLASSROOM EXERCISE

Write a JCL where job name is JOB1 which executes a program

P1 and creates a dataset called ABC on unit 3380.

153
‘AFF’ SUB-PARAMETER
• The AFF subparameter can be used to reference a device,
specified in a prior DD statement. AFF stands for affinity.
• This kind of specification results in unit affinity, that is same
unit is reused.
SYNTAX
//ddname1 DD UNIT=TAPE
//ddname2 DD UNIT=AFF=ddname1
ddname1 is the name of the DD statement in which the device for
the UNIT parameter was originally specified .
ddname2 is the name of the DD statement in which the AFF
parameter is used to reference the prior DD statement.

154
EXAMPLE 1 :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PGM=PROGRAM1
//NAME1 DD DSN=DATA1,
// UNIT=CART
//NAME2 DD DSN=DATA2,
// UNIT=AFF=NAME1

AFF subparameter is used to specify that the data set called


DATA2 must reside on the same unit as that specified in
NAME1.

UNIT parameter

155
‘DEFER’ SUB-PARAMETER

• The DEFER subparameter is coded on the UNIT parameter so


that it may defer mounting of the volume that it references, until
the data set that resides on it is opened.

• It prevents volumes from being mounted until they are actually


needed, thereby freeing up resources for other jobs.

• If the defer parameter is encountered for a volume that is


already mounted , then it is simply ignored.

UNIT parameter

156
SYNTAX

//ddname DD UNIT=(device,,DEFER)

The extra comma in the middle is used to specify the device count
subparameter.

The device count subparameter identifies the number of tapes


required for the job.

157
EXAMPLE :

//JOB1 JOB C123,‘VENU’


//STEP1 EXEC PGM=PROGRAM1
//NAME1 DD DSN=DATA1,
// UNIT=(TAPE,,DEFER)

DEFER parameter is used to specify that DATA1 resides on tape,


and that the tape need not be mounted until the system specifically
requests it.

This request will be issued by the system at the time that JOB1 is
executed and PROGRAM1 requires access to DATA1.

158
SESSION -- VI

159
OBJECTIVES
To understand
• The following parameters and their sub-parameters coded on
the DD statement.
VOL
SPACE
DCB
To interpret the examples using the above parameters and their
sub-parameters.

To try and solve the classroom exercises.

160
‘VOL’ PARAMETER

INTRODUCTION

• The VOL parameter is also coded on the DD statement and is


used to identify specific tape(s) or disk volume(s). VOL or
VOLUME can be used interchangeably on the DD statement.

• This parameter is used to identify the volume serial number of


the device on which a given data set is to be written or on which a
dataset resides.

161
‘VOL’ PARAMETER (Contd..)

Position Within A JCL Statement

// Name Operation Parameters Comments

// ddname DD VOL= Comments

162
CORRESPONDING JCL PARAMETERS
FUNCTION SUBPARAMETERS
CODED ON THE VOL
STATEMENT.
Specification of serial SER
number
Referencing VOL REF
specification
Allowing acces to volume by This is the default, unless
all users coded otherwise.
Inhibiting dismounting of PRIVATE
volume by single user
Specification of sequence in SEQ
which volumes are to be
mounted.

163
TYPES OF LABELS
VOLUME LABEL

• This contains the volume serial number, and is used for


identification purposes by the system.

DATA SET LABEL


• Data set labels are found at the beginning and at the end of
tape data sets.
• They consist of 80 byte records that contain information for the
data set.
• Both types of labels reside on the volume itself as data.

164
TYPES OF VOLUMES

Volumes can be classified by the type of access available to the


users . They can be categorized as follows:

PRIVATE
These are accessible to a single user only. Tapes are always private.

PUBLIC
These are accessible to all users.

165
‘SER’ SUB-PARAMETER

• The SER subparameter coded on VOL in the DD statement is


used to request specific volumes.

SYNTAX

VOL=SER=serial number.
Or
VOL=SER=(serial number1, serial number2)

Vol parameter

166
EXAMPLE :

//JOB1 JOB A123,‘VENU’


//STEP1 EXEC PGM=PROGRAM1
//NAME1 DD DSN=DATA1,
// VOL=SER=23456

DATA1 is accessed on a volume whose serial number is 23456

167
‘REF’ SUB-PARAMETER

The REF subparameter is a shortcut method used to specify a


volume which has been previously defined within the same job.

SYNTAX

VOL=REF=referback

Vol parameter

168
EXAMPLE :

//JOB1 JOB A123,‘VENU’


//STEP1 EXEC PGM=PROGRAM1
//NAME1 DD DSN=DATA1,
// VOL=SER=VOL1
//NAME2 DD DSN=DATA2,
// VOL=REF=*.STEP1.NAME1

169
‘PRIVATE’ SUB-PARAMETER

• Coding PRIVATE on the VOL parameter results in exclusive


use of the volume for the data set specified in the job step. This
means that only one job can access it at a time.

SYNTAX
VOL=PRIVATE
EXAMPLE :
//JOB1 JOB A123,‘VENU’
//STEP1 EXEC PGM=PROGRAM1
//NAME1 DD DSN=DATA1,
// VOL=(PRIVATE,,,,SER=23456)
Vol parameter

170
‘RETAIN’ SUB-PARAMETER

• The RETAIN sub parameter is used to indicate that the volume


is not to be dismounted after completion of the job step that it is
coded in.The volume remains mounted until the entire job is
completed.

SYNTAX

VOL=(,RETAIN)
Or
VOL=(,RETAIN,...)
Vol parameter

171
EXAMPLE :

//JOB1 JOB A123,‘VENU’


//STEP1 EXEC PGM=PROGRAM1
//NAME1 DD DSN=DATA1,
// VOL=(,RETAIN,,,SER=TAPE1)

172
‘SEQ’ (SEQUENCE) SUB-PARAMETER

• The sequence subparameter is used to specify the sequence


number of the volume that is to be mounted for a particular
step.Like PRIVATE and RETAIN it is a positional parameter.

SYNTAX

VOL=(, ,sequence-number)
Or
VOL=(, ,sequence-number,...)
Vol parameter

173
EXAMPLE :
//JOB1 JOB A123,‘VENU’
//STEP1 EXEC PGM=PROGRAM1
//NAME1 DD DSN=DATA1,
// VOL=SER=HUGE
//STEP2 EXEC PGM=PROGRAM2
//NAME2 DD DSN=DATA2
// VOL=(, ,3,,SER=A123,A124,A125,A126,A127)
STEP1 executes PROGRAM1 and the dataset called DATA1 is
accessed on the volume whose serial number is HUGE.Since no
sequence no. is supplied at position 3, processing starts at volume 1.
In STEP2 the VOL parameter is used to specify that processing
should start at volume 3 of a multivolume dataset DATA2.

174
CLASSROOM EXERCISE

Write a JCL where job name is JOB1 and two programs P1 and P2

are executed . A dataset ABC is created as a result of the execution

of program P1. This is created on unit 3380 Volume serial number

234 with sequence no starting at 5 and ending at 10.

175
‘SPACE’ AND ‘DCB’ PARAMETERS

• The SPACE and DCB parameters are coded on the DD


statement.

• The SPACE parameter is used to allocate storage for new


data sets on direct access storage devices.

• The DCB parameter is used to customize the way data is


stored on devices.

176
‘SPACE’ PARAMETER

• It is an optional keyword parameter on the DD statement.

// Name Operation Parameters Comments

// ddname DD SPACE=... Comments

177
SYNTAX

SPACE=(CYL(primary,secondary,directory),
RLSE,CONTIG,MXIG,ROUND)
OR
SPACE=(TRK(primary,secondary,directory),
RLSE,CONTIG,MXIG,ROUND)
OR
SPACE=(blk(primary,secondary,directory),
RLSE,CONTIG,MXIG,ROUND)

178
‘TRK’ SUB-PARAMETER

• The TRK subparameter is used to allocate space in terms of no


of tracks.
EXAMPLE :
//JOB1 JOB A123,‘JAI’
//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD DSN=FILE1,
// UNIT=3390,
// SPACE=(TRK,4)
Dataset called file1 is created on a 3390 disk. Space equal to four
tracks is requested for the dataset.
SPACE parameter

179
‘CYL’ SUB-PARAMETER
• The CYL subparameter is used to allocate space in terms of
no of cylinders.

EXAMPLE :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD DSN=FILE1,
// UNIT=3390,
// SPACE=(CYL,4)
SPACE parameter

180
REQUESTING ‘SPACE’ IN BLOCKS
• Space can also be requested in terms of blocks. Blocksize is
independent of the device type.

EXAMPLE :
//JOB1 JOB A123,‘JAI’
//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD DSN=FILE1,
// UNIT=3390,
// SPACE=(2400,1000)
Here the space allocated is 1000 blocks having block size of
2400 bytes.

181
PRIMARY AND SECONDARY ‘SPACE’
ALLOCATION
• Primary space is the no of bytes that you expect the dataset will
require for storage.

• Secondary space is the additional space requested if the


requested primary space is insufficient.

• Secondary space, when allocated, does not have to be


contiguous with the location of primary allocation.

• Up to 15 extends may be allocated on secondary space.

182
EXAMPLE :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD DSN=FILE1,
// UNIT=3390,
// SPACE=(TRK,(50,25))

50 tracks are assigned as primary space, and 25 as secondary


space for FILE1.

183
‘DIRECTORY’ SUB-PARAMETER

• The DIRECTORY subparameter is used when defining PDS.

• This storage space is used to record the names and locations of


the members created within the PDS.

• This subparameter follows the primary and secondary space


subparameters.

SPACE parameter

184
EXAMPLE :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD DSN=FILE1,
// UNIT=3390,
// SPACE=(TRK,(200,50,10))

200 tracks are assigned as primary space, and 50 as secondary


space and 10 tracks are requested for storing name and location
information for members that will reside in the PDS

185
‘RLSE’ SUB-PARAMETER

• The RLSE sub parameter is used to request that space originally


allocated to an output dataset be released when the dataset is
closed.

• A dataset is considered to be closed after the successful


completion of a write operation.

• The release parameter helps free up resources for other jobs.

SPACE parameter

186
EXAMPLE :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD DSN=FILE1,
// UNIT=3390,
// SPACE=(TRK,(200,50),RLSE)

187
CLASSROOM EXERCISE

Write a JCL where job name is JOB1 , program P1 is executed

creating a dataset FILE1 on Unit 3380 for which the space is

allotted in terms of Tracks with a primary space of 15 tracks and

secondary space of 30 tracks. Ensure that at the end of the job the

unused space is released.

188
‘CONTG’ SUB-PARAMETER
• The CONTG subparameter is used to specify that only
contiguous space should be allocated to the data set.
• This parameter applies only to primary space allocations.
EXAMPLE :
//JOB1 JOB A123,‘JAI’
//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD DSN=FILE1,
// UNIT=3390,
// SPACE=(TRK, 200, ,CONTG)
The extra comma between the primary specification and the
CONTG parameter is for the RLSE parameter.
SPACE param

189
‘MXIG’ SUB-PARAMETER
• The MXIG subparameter is used to specify that space requested
should be allocated on the largest contiguous area of space
available on the volume
EXAMPLE :
//JOB1 JOB A123,‘JAI’
//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD DSN=FILE1,
// UNIT=3390,
// SPACE=(TRK, 700,RLSE,,MXIG)
700 tracks of primary space is requested on a 3390 disk in an area
where 700 or more tracks of contiguous space is available.
SPACE parameter

190
‘ROUND’ SUB-PARAMETER
• The use of this subparameter results in space being allocated as
the entire cylinder instead of just portions of it.

• The system computes the amount of storage required, rounds it


off to the nearest cylinder, and allocates that number of cylinders to
the request.

• The advantage associated with the use of this parameter is that


data will reside, starting with the first track of the cylinder, till the
end of the last track. Access time is decreased.

191
EXAMPLE :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD DSN=FILE1,
// UNIT=3390,
// SPACE=(500,50,,,ROUND)

50 blocks of 500 bytes are requested as storage space and the round
subparameter results in space being rounded to the nearest cylinder.

SPACE parameter

192
‘DCB’ PARAMETER

• The DCB parameter let’s you specify file characteristics that are
stored in the file’s Data Control Block.

• The DCB parameter is coded only for a new data set .

• For existing data sets the information is retrieved from the data
set label.

• In addition, you don’t have to code the DCB parameter for a


new data set if your application program supplies the required
information.

193
• The DCB parameter has four sub-parameters

DSORG, RECFM, LRECL and BLKSIZE.

• They are keyword sub-parameters so you can code them in


any order you want.

SYNTAX :

DCB=(DSORG=xx,RECFM=format,
LRECL=length,BLKSIZE=block size)

194
‘DSORG’ SUB-PARAMETER

• The DSORG sub-parameter specifies the organization of the


data set.

DSORG Specifies the data set’s organization,as follows


PS Physical sequential
PO Partitioned
DA Direct
IS Indexed sequential

EXAMPLE : DCB=(DSORG=PS)
Specifies a sequential data set.

195
‘RECFM’ SUB-PARAMETER

• The RECFM sub-parameter is used to specify the record format


of the dataset being created.

RECFM Specifies the format of the file’s records,as follows

F Fixed length,unblocked
FB Fixed length,blocked
V Variable length,unblocked
VB Variable length,blocked
U Undefined

DCB parameter

196
EXAMPLE 1 :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD DSN=FILE1,
// UNIT=3390,
// DCB=(RECFM=F)

FILE1 is created on a 3390 disk and the parameter F indicates that


the FILE1 will contain fixed length records.

197
‘LRECL’ PARAMETER

The LRECL ( Logical Record Length ) is used to specify the length


of the record, in bytes, for fixed or variable length records.
• For Fixed Length Record LRECL is equal to the record length.
• For Variable Length Record LRECL is set to the size of the
largest record plus 4 bytes, which is used by the system to specify
the actual length of the record that follows.

SYNTAX
LRECL=number
Where number is the length in decimal digits.
DCB parameter

198
EXAMPLE :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD DSN=FILE1,
// UNIT=3390,
// DCB=(RECFM=F,LRECL=80)

DCB parameter

199
‘BLKSIZE’ PARAMETER

This parameter is used to specify the blocksize of dataset in bytes.


• It must be specified as a multiple of the record length for fixed
length records.
• It must be equal to at least the record length plus four bytes for
variable length records.
• It must be set to the size of the largest block for undefined length
records.
SYNTAX
BLKSIZE=number
DCB parameter

200
EXAMPLE :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD DSN=FILE1,
// UNIT=3390,
//
DCB=(RECFM=FB,LRECL=80,BLKSIZE=1600)

DCB parameter

201
‘BUFNO’ PARAMETER
• The BUFNO parameter is used to specify the number of buffers
to be allocated to virtual storage for the dataset.
SYNTAX
BUFNO=number
EXAMPLE 1:
//JOB1 JOB A123,‘JAI’
//STEP1 EXEC PGM=PROGRAM1
//DATA1 DD DSN=FILE1,
// UNIT=3390,
// DCB=(RECFM=FB,LRECL=80,
// BLKSIZE=1600,
// BUFNO=40) DCB parameter

202
CLASSROOM EXERCISE

Write a JCL where job name is JOB1, program P1 is executed to

create a dataset FILE1 on unit 3380,volume serial number 234, the

space allotted as primary is 4 cylinders and secondary is 45

cylinders , unused space to be released at the end of the job, code

for contiguous space, the record format is Fixed block, Record

length is 80 and Block size is 1600.

203
SESSION -- VII

204
OBJECTIVES
To understand
• The function of DUMMY and Concatenated data sets
• The function of special DD statements like SYSOUT, SYSIN
SYSUDUMP, SYSABEND
• The use of DLM, DEST, HOLD, OUTLIM parameters coded
on the DD statement.
• Importance and usage of Procedures.
• Use of symbolic parameters in Procedures
• The concept of Generation Data Groups

To try and solve the classroom exercises.

205
CODING DATA SETS AND I/O ON THE DD
STATEMENT
Types of data sets are

• Dummy
• Concatenated

Special DD statements are :


• SYSOUT
• SYSIN
• SYSUDUMP
• SYSABEND

206
‘DUMMY’ PARAMETER
• The Dummy parameter is coded on the DD statement to test the
execution of a program without actually reading or writing to a
data set.
Position In JCL :

// Name Operation Parameters Comments

// ddname DD DUMMY Comments

• If DUMMY or NULLFILE is read, then the Operating System


passes an EOF indicator to the program that is being executed.

207
EXAMPLE 1 :
//JOB1 JOB A123,‘JAI’
//STEP1 EXEC PGM=TEST1
//DATA1 DD DUMMY

The program TEST1 is executed and a DUMMY dataset is


accessed.

EXAMPLE 2 :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PGM=TEST2
//DATA1 DD DSN=NULLFILE

208
CONCATENATING DATASETS
• A dataset can be concatenated and perceived as one file by the
operating system by coding each applicable dataset name one after
the other.

EXAMPLE 1 :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PGM=CONCAT1
//DATA1 DD DSN=FILE1
// DD DSN=FILE2
// DD DSN=FILE3.
FILE1 , FILE2, FILE3 are concatenated.

209
‘SYSUDUMP’ DD STATEMENT
• Sysudump is coded in the name field of the DD statement.

• Used to obtain a dump of the contents of various registers and


variables in case of abnormal termination of the job.

EXAMPLE 1 :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PGM=PROGRAM1
//SYSUDUMP DD DSN=DUMPFILE,
// UNIT=3390,
// SPACE=(CYL,(1,1),RLSE)

210
‘SYSABEND’ DD STATEMENT
• SYSABEND is coded in the name field of the DD statement.
• Used to obtain a dump of the contents of various registers and
variables in case of abnormal termination of the job ( on an output
device ).
• SYSTEM AREA, at the time of abnormal termination will also
be written to the output dataset.

EXAMPLE 1 :
//JOB1 JOB A123,‘JAI’
//STEP1 EXEC PGM=PROGRAM1
//SYSABEND DD SYSOUT=A.

211
‘SYSIN’ DD STATEMENT
• SYSIN is conventional DD name assigned to input data streams
which is the data entered when the job is submitted.
POSITION IN A JCL :
// Name Operation Parameters Comments

// SYSIN DD * or DATA Comments


< data follows >
/*
The * or DATA indicates to the Operating System that input
should be accepted from the keyboard or coded in the JCL.
• /* indicates the end of input data stream in the JCL.
• The ‘*’ or ‘DATA’ parameter can not be coded in procedures.

212
EXAMPLE 1 :
//JOB1 JOB A123,‘JAI’
//STEP1 EXEC PGM=PROGRAM1
//SYSIN DD *
<........... lines of data..................>
/*
EXAMPLE 2 :
//JOB1 JOB A123,‘JAI’
//STEP1 EXEC PGM=PROGRAM1
//SYSIN DD DATA
<................ lines of data................>
/*
In the second e.g. the use of DATA allows us to use special
characters // and /* in the data segment.

213
‘DLM’ PARAMETER
• The DLM parameter specifies the delimiting character that is to
be used to mark the end of the input data stream.
EXAMPLE :
//JOB1 JOB A123,’JAI’
//STEP1 EXEC PGM=PROGRAM1
//SYSIN DD DATA,DLM=@@
<................... lines of data...................>
/*
@@
Here the delimiter is‘@@’ and not ‘/*’ which is also a part of the
input data stream.

214
‘DEST’ PARAMETER

• The DEST parameter is used to route output to a specific


destination, which may or may not be a remote location.

POSITION IN JCL

// Name Operation Parameters Comments

// ddname DD DEST Comments

215
SYNTAX

The syntax depends on the Job Entry Subsystem being used. In a


JES2 environment the syntax is:

DEST=RMTxxxx
Or
DEST=RMxxxx
Or
DEST=Rxxxx
Or
DEST=Uhhh
Or
DEST=Nxxxx
Or Contd.......

216
SYNTAX ( Contd..)

DEST=NnnnRyy
Or
DEST=LOCAL

RMT, RM and R stand for Remote Terminal. U specifies a local


terminal. N specifies a node.
For the syntax :
DEST=NnnnRyyy
N specifies node, and R specifies a remote workstation connected
to the node.

217
EXAMPLE 1 :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PGM=XYZ
//DATA1 DD DSN=FILE1,
// SYSOUT=A,
// DEST=RMT1190

Here the output is directed to output device assigned to class A and


its location is designated by the code RMT1190.

218
EXAMPLE 2 :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PGM=XYZ
//DATA1 DD DSN=FILE1,
// SYSOUT=A,
// DEST=LOCAL

Output is routed to the local device.

219
‘HOLD’ PARAMETER
• Hold parameter is used to specify whether the output is to be
printed immediately or held until further notice.

POSITION IN JCL

// Name Operation Parameters Comments

// ddname DD HOLD Comments

SYNTAX

HOLD=YES/NO

220
EXAMPLE :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PGM=ABCD
//DATA1 DD DSN=FILE1,
// SYSOUT=A,
// HOLD=YES.

221
‘OUTLIM’ PARAMETER
• The OUTLIM parameter is used to limit the number of lines
that are output to the destination specified in the SYSOUT.

POSITION IN JCL

// Name Operation Parameters Comments

// ddname DD OUTLIM Comments

222
EXAMPLE 1 :

//JOB1 JOB A123,‘JAI’


//STEP1 EXEC PGM=OUT1
//DATA1 DD DSN=FILE1,
// SYSOUT=A,
// OUTLIM=1000.

Output routed to the printer is limited to 1000 lines.

223
224
JCL PROCEDURE

• A JCL procedure is a pre-written segment of code that can


be included in a job stream.

• The use of procedures helps minimize duplication of code


and probability of error.

• JCL procedures can be either :

Cataloged procedures
or
In-stream procedures

225
IN-STREAM PROCEDURES

• Statements of an in-stream procedure appear in the job that


invokes the procedure and are not members of any PDS.

• An in-stream procedure is available only to the job that contains


it.

• Same instream procedure can be invoked more than once from


within a job.

• In-stream procedures are used mostly for testing procedures that


will eventually be cataloged.

226
EXAMPLE :

Creating and Executing an Instream Procedure

//JOB1 JOB A123,‘JAI’


//INPROC1 PROC
//STEP1 EXEC PGM=OUT1
//DATA1 DD DSN=FILE1,
// DISP=SHR
//STEP2 EXEC PGM=OUT2
//DATA2 DD DSN=FILE2,
// DISP=SHR
// PEND
//STEP77 EXEC PROC=INPROC1
//

227
CATALOGED PROCEDURES

• Statements of a cataloged procedure are written and stored in a


partitioned data set.

• A cataloged procedure can be invoked by any job in the system.

• SYS1.PROCLIB is the system procedure library.


It contains mostly system oriented procedures.

• You can also establish alternate procedure libraries,which you


can use instead of SYS1.PROCLIB.

228
EXAMPLE 1 :

//CATPRO PROC
//STEP1 EXEC PGM=OUT1
//DATA1 DD DSN=FILE1,
// DISP=SHR
//STEP2 EXEC PGM=OUT2
//DATA2 DD DSN=FILE2,
// DISP=SHR

NOTE : A cataloged procedure should never contain a PEND


statement

229
Execution Of The Procedure :

//JOB1 JOB A123,‘JAI’


//PROCLIB DD DSN=USER.TEST.PROCLIB,
// DISP=SHR
//JOBLIB DD DSN=USER.TEST.JOBLIB,
// DISP=SHR
//STEP10 EXEC CATPRO

The PROCLIB DD statement defines the location of the


cataloged procedure.

The EXEC executes the cataloged procedure.

230
OVERRIDING PARAMETERS IN
PROCEDURES
• Used to override the parameters of a Procedure for the duration of
a job, without actually changing the contents of the original
procedure.

SYNTAX

//name Exec procedure-name


//procstep.ddname DD modified-parameter

231
EXAMPLE
//PROC1 PROC
//STEP1 EXEC PGM=PROGRAM1
//DD1 DD DSN=FILE1,DISP=SHR
// STEP2 EXEC PGM=PROGRAM2
//DD2 DD DSN=FILE2,DISP=SHR

To execute this procedure with a modification in the disposition of


FILE1 from SHR to OLD, and the data set name FILE2 to
NEWFILE, It is done as:

//JOB1 JOB A123,‘VENU’


//PROCLIB DD DSN=USER.TEST.LIB1
// DISP=SHR
//EXEC1 EXEC PROC1
//STEP1.DD1 DD DSN=FILE1,DISP=OLD
// STEP2.DD2 DD DSN=NEWFILE,DISP=SHR

232
SYMBOLIC PARAMETERS

• Symbolic parameters are used to create procedures for


generalized use .

• Symbolic parameters provide a convenient means of assigning


different values to parameters in commonly used JCL procedures.

• To code a symbolic parameter in a procedure, you code an


ampersand(&) followed by a name.
For e.g.
DISP=&STAT or SYSOUT=&DEVICE

233
SPECIFYING SYMBOLIC PARAMETER VALUES

To supply values to symbolic parameters, you code them on the


EXEC statement that invokes the procedure.
For e.g.
//STEP10 EXEC CATPRO,DEVICE=A
Here the &DEVICE symbolic parameter is given a value of A.
EXAMPLE :
//NEWPRO PROC
//STEP1 EXEC PGM=CALC
//DATA1 DD DSN=TRNG.NTP.COB(&FILE1),
// DISP=SHR
To supply a value to the &FILE1 symbolic parameter,you invoke
the procedure as
//STEP20 EXEC NEWPRO,FILE1=ASH7

234
ASSIGNING DEFAULT VALUES TO SYMBOLIC
PARAMETERS
To assign a default value to a symbolic parameter , you define it on
the procedure’s PROC statement.

EXAMPLE :
//NEWPRO PROC STAT=SHR
//STEP1 EXEC PGM=UVW
//DATA1 DD DSN=TRNG.NTP.COB(DATFILE),
DISP=&STAT

If the programmer doesn't code STAT on the EXEC statement that


invokes this procedure, the default STAT=SHR will be used .

235
EXAMPLE :

Suppose you have a procedure as follows :

//NEWPRO PROC FILE1=NEWFILE,STAT=SHR,


// DEVICE=CYL,FORMAT=FB
//STEP10 EXEC PGM=CALC
//DATA1 DD DSN=&FILE1,
// DISP=&STAT,UNIT=3380,
// SPACE=(&DEVICE,(5,10)),
// DCB=(RECFM=&FORMAT)

Contd...

236
If you invoke the previous procedure as

//STEP1 EXEC NEWPRO

The parameters on the DATA1 DD statement will take the


following default values :

//DATA1 DD DSN=NEWFILE1,
// DISP=SHR,UNIT=3380,
// SPACE=(CYL(5,10)),
// DCB=(RECFM=FB)

Contd..

237
Similarly in the previous procedure,if you want to supply different
values to the DSN and DISP parameters and want the other
parameters to take the default values,then you invoke the
procedure as :

//STEP1 EXEC NEWPRO,FILE1=MYFILE,STAT=OLD

The parameters on the DATA1 DD statement will take the


following values :

//DATA1 DD DSN=MYFILE,
// DISP=OLD,UNIT=3390,
// SPACE=(CYL,(5,10)),
// DCB=(RECFM=FB)

238
239
THE CONCEPT OF GENERATION DATA
GROUPS (GDGs)

• Generation Data Groups are a group of data sets which are


related to each other chronologically and functionally.

• Data processing applications are cyclical in nature. They


consist of new input which is stored inside a file. At a later stage
this existing data is updated with new data , to produce a new file.
The original file is considered as the older generation, and the new
one as a new generation.

Contd...

240
THE CONCEPT OF GENERATION DATA
GROUPS (Contd..)

• Generations can continue until a specified limit is reached.


This specifies the total number of generations that can exist at
one time. Once this limit is reached, the oldest generation is
deleted.

241
SESSION -- VIII

242
OBJECTIVES

To understand
• The necessity of Utilities
• Usage of following IBM Utilities
IEBGENER IEBCOPY
IEHPROGM IEBCOMPR
IEFBR14 SORT
MERGE

243
244
IBM UTILITIES

• A utility is a useful tool that helps in expediting a task.

• MVS provides a number of prewritten utility programs that


can be used by the analysts, system programmers and
application programmers to assist them in organizing data.

• A UTILITY program performs a basic function, i.e., it does a


routine job which is required repeatedly in an installation.

245
CLASSES OF IBM UTILITIES

SYSTEM UTILITY PROGRAMS

• System Utility Programs can be used to maintain and manipulate


system and user data sets.

• These programs must reside in an authorized library.

• They can be executed as jobs or be invoked as subroutines of an


authorized program.

246
CLASSES OF IBM UTILITIES

DATA SET UTILITY PROGRAMS:

• Data set utility programs can be used to reorganize, change or


compare data at the data set or record level.

• Can be executed as jobs or be invoked as subroutines of a calling


program.

247
CLASSES OF IBM UTILITIES

INDEPENDENT UTILITY PROGRAMS :

• Independent utility programs can be used to prepare devices for


system use when the operating system is not available.

248
FREQUENTLY REQUIRED FUNCTIONS

• Copy sequential files.


• Copy partitioned data sets.
• Catalog data sets.
• Un catalog data sets.
• Rename data sets.
• Compress partitioned data sets.
• Include members to partitioned data sets when a
Copy transaction is implemented.
• Exclude members to partitioned data sets when
A copy transaction is implemented.
• Compare sequential and partitioned data sets.

249
• Generate generation data groups

• Create /delete data sets allocate / de allocate space on data sets


or code other functions on the DD statement, without having to
execute a program.

250
JCL REQUIRED TO EXECUTE THE UTILITIES

The JCL statements, which are required to execute the utility


program, follow a general pattern.
//jobname JOB (accounting-information,)
programmer-name
//stepname EXEC PGM=utility-name, PARM=value
//printname DD SYSOUT=print- device-class
// inputfile DD input-file-features
// outputfile DD output-file-features
// workfile DD work-file-features
// inputdata DD *
< --- data statements specific to utility follow --- >
/*
//

251
SOME IMPORTANT UTILITIES

• IEBGENER
• IEBCOPY
• IEHPROGM
• IEBCOMPR
• IEFBR14
• DFSORT
• MERGE

252
IEBGENER

• Most commonly used utility program.

• Used to copy one sequential file to another.

• The original data set and the destination names must be


specified.

• Attributes of both the data sets such as RECFM, LRECL


must be the same.

253
CORRESPONDING JCL

//jobname JOB accounting-info,programmer-name,


// keyword parameters
//stepname EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=print- device-class
//SYSUT1 DD DSN=source-file-features
//SYSUT2 DD DSN=destination-file-features
//SYSIN DD DUMMY
//

254
IEBCOPY
• Copy Partitioned Data Sets

• A PDS can be copied to another PDS, or a sequential data set


( on a Tape Drive) , which is known as UNLOADING.

• Used to restore PDS to direct access devices from a Tape


Drive, which is known as LOADING.

• Compress Partitioned Data Sets

• Include members of a PDS within a copy transaction.

• Exclude members of a PDS within a copy transaction

255
CORRESPONDING JCL

//jobname JOB accounting-info,programmer-name,


// keyword parameters
//stepname EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=print- device-class
//SYSUT1 DD DSN=source-file-features
//SYSUT2 DD DSN=destination-file-features
//SYSIN DD *
COPY INDD=SYSUT1,
OUTDD=SYSUT2
/*
//

256
• For loading and unloading the following have to be coded :

//SYSIN DD *
COPY INDD=SYSUT1,
OUTDD=SYSUT2
/*
//

• For compressing a data set, the SYSUT2 statement is not


required and the following have to be coded :

//SYSIN DD *
COPY INDD=SYSUT1,
OUTDD=SYSUT1
/*
//

257
• To include the members to a PDS the input (SYSUT1) and
output (SYSUT2) data set names will be the same and the
following have to be coded :

//SYSIN DD *
COPY INDD=SYSUT1,
OUTDD=SYSUT2
SELECT MEMBER = ( mem1, mem2,...)
/*
//

258
IEHPROGM

• Catalog a Data Set.

• Un catalog a Data Set.

• Rename Data Sets.

• Create an index of a GDG

• Delete the index of an existing GDG.

259
CORRESPONDING JCL

//jobname JOB accounting-information,programmer-name,


// key-word parameters
//stepname EXEC PGM=IEHPROGM
//SYSPRINT DD SYSOUT=print-device-class
//SYSUT1 DD UNIT=unitname,
// VOL=SER=vol-no
// SYSUT2 DD UNIT=unitname,
// VOL=SER=vol-no
//SYSIN DD *
<- parameters for above functions ->
/*
//

260
CATALOGING A DATA SET

• A data set can be cataloged using the CATLG statement.

SYNTAX :
CATLG DSN=data-set-name
VOL=device-name=volume-number.

The above is coded in the SYSIN DD statement.


//SYSIN DD *
CATLG DSN=data-set-name
VOL=device-name=vol.no
/*
//

261
UNCATALOGING A DATA SET

• A data set can be uncataloged using the UNCATLG


statement.

//SYSIN DD *
UNCATLG DSN=data-set-name
/*
//

SYSUT2 is not coded.

262
RENAMING THE DATA SET

• A data set can be renamed using the RENAME command.

//SYSIN DD *
RENAME DSN=data-set-name,
VOL=device-name=volume=number
NEWNAME=new-name
/*
//

263
IEBCOMPR

• Used to Compare two sequential data sets.

• Compare two partitioned data sets.

• If the two data sets are identical then zero will be returned upon
successful completion of the job.

• If the data sets are not identical then a condition code of 8 will be
returned.

• The data sets that are compared must have same record length
and format, however block size need not be the same.

264
CORRESPONDING JCL

//jobname JOB accounting-inform...,programmer-name,


// keyword-parameters
//stepname EXEC PGM=IEBCOMPR
//SYSPRINT DD SYSOUT=print-device-class
//SYSUT1 DD DSN=data-set-1-features
//SYSUT2 DD DSN=data-set-2- features
//SYSIN DD *
COMPARE TYPORG=data-set-type
/*
//

265
IEFBR14

• T his program is a Null Program. It executes a single statement


which specifies the end of the program.

• This program is used to code functions that are commonly


available on the DD statement, such as the creation, deletion and
updation of data sets, without having to execute any explicit
program.

• Since this program does nothing it can be used to check the


syntax of JCL code without affecting any data sets.

266
EXAMPLE 1:

//UNCATLOG JOB A123,‘ASHRAF’


//STEP1 EXEC PGM=IEFBR14
//DD1 DD DSN=COBOL.FILE1,
// DISP=(OLD,UNCATLG)
IEFBR14 Program is used to uncatalog the data set called
COBOL.FILE1.

267
EXAMPLE 2:

//DELETE1 JOB A123,‘ASHRAF’


//STEP1 EXEC PGM=IEFBR14
//DD1 DD DSN=COBOL.FILE1,
// DISP=(OLD,DELETE)
IEFBR14 Program is used to DELETE the data set called
COBOL.FILE1.

268
DFSORT

• Used to sort records in ascending or descending order within a


file

• Merge two or more sorted files into a single file.

269
CORRESPONDING JCL
//JOB1 JOB Accounting-inform..., programmer-name,
// Keyword-parameters
//STEPNAME EXEC PGM=DFSORT
//STEPLIB DD
//* Defines the library containing the SORT program. If it is in a
//* system library, this statement may be omitted.
//SYSPRINT DD
//* Defines the message data set
//SORTIN DD
//* Defines the INPUT data set

(contd...)

270
//SORTWKNN DD

//* Defines a WORK storage data set

//* In most cases one data set is sufficient.

//SORTOUT DD

//* Defines the OUTPUT data set

//SYSIN DD *

//* contains SORT program control statements.

271
EXAMPLE 1 :
//JOB1 JOB (A123).‘JAI’
//STEP1 EXEC PGM=DFSORT
//SYSOUT DD SYSOUT=A
//SORTIN DD DSN=PROJECT1.JCL, DISP=SHR
//SORTWK01 DD UNIT=SYSDA,
// SPACE=(CYL,(2,1),RLSE)
//SORTOUT DD DSN=PROJECT1.JCL,
// DISP=(NEW,CATLG,DELETE),
// UNIT=UNIT1,
// SPACE=(CYL,(2,1),RLSE)
// DCB=(RECFM=FB,
// LRECL=80,BLKSIZE=800)
//SYSIN DD *
SORT FIELDS=(2,6,D,CH)
/*
//

272
EXAMPLE 2 :
//JOB1 JOB (A123),‘JAI’
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=A
//SORTIN1 DD DSN=PROJECT.DATA1, DISP=SHR
//SORTIN2 DD DSN=PROJECT.DATA2, DISP=SHR
//SORTIN3 DD DSN=PROJECT.DATA3, DISP=SHR
//OUTFILE DD DSN=PROJECT1.MRGFILE,
// DISP=(NEW,CATLG,DELETE),
// UNIT=UNIT1,SPACE=(CYL,(2,1),RLSE)
// DCB=(RECFM=FB,LRECL=80)
//SYSIN DD *
MERGE FIELDS=(2,6,A,CH)
/*
//

273

You might also like