Vous êtes sur la page 1sur 45

JCL

JCL (JOB CONTROL LANGUAGE)

DEFINITION:
JCL is an interface between application program and operating system
1.
2.
3.
4.

JCL is an 80 byte record structure


By using JCL we can execute or bypass any no of steps ion a job
By using JCL we can use any no of data sets required for job execution
By using JCL we can also define status of the used data sets

The 80 byte record structure is as follows

1-2

3-10

11

Identifie Name
r field
field

Space

12-15

16

Operati Space
on field

17-71

72-80

Paramet Comme
er field nt Field

JCL Statements:
In JCL we have 3 statements. They are..
1. Job Statement
2. EXEC Statement
3. DD Statement
1. JOB STATEMENT:
a) Specifies the starting of the job
b) We can write only one job statement in one JCL
c) In job statement we have both positional and keyword parameters

i.

Positional Parameters:
In job statement we have two positional parameters. They are..
a. ACCOUNTING INFORMATION
b. PROGRAMMER NAME

1) These two are mainly used for the billing purpose to include the
bill amount and billers name
2) These two are also used in job statement for writing job related
description
1. Positional parameters always follow the order
2. If any one of the above parameter is absent we have to separate with
comma(,)
3. If two parameters are absent ignore the field
4. Positional parameters in job statement are optional
ii. Keyword Parameters:
The list of keyword parameters existed in a job statement are as
follows
1. CLASS
2. PRTY
3. MSG CLASS
4. MSG LEVEL
5. TIME
6. REGION
7. RESTART
8. ADDRSPC
9. TYPRUN
10.NOTIFY
1. CLASS:
1.
2.
3.
4.

It is mainly used for categorizing the input jobs


Based on CLASS value we can create or bypass the steps
Possible values are a-z, 0-9
Syntax: CLASS =
VALUE

CLASS parameter is optional because by default the value is CLASS = A

2. PRTY:
When two jobs CLASS names are same based on given priority the is
executed

The priority value ranges from 0-15


Priority is optional for individual jobs
3. MSGCLASS:
It is mainly used for routing the output messages of a job
Possible values are a-z
MSGCLASS is optional
Syntax: MSGCLASS

VALUE

4. MSGLEVEL:
It is used to print the level of output description
Syntax: MSGLEVEL

(N, M)

Where N = JCL messages & M = Allocation messages


The possible values for N are
a. 0
b. 1
c. 2

it prints only job card


it prints user coded JCL and procedure messages
it prints only the user coded JCL messages

The possible values for M are


a. 0
b. 1

if job terminated abnormally then only it prints messages


irrespective of job execution it prints the messages

MSGLEVEL is optional because the default value is MSGLEVEL = (1,1)


5. TIME:
1. Time specifies the maximum amount of time required for job execution
2. In time we have various values as follows
i. TIME = (M,S)
M = Minutes , S = Seconds
ii. TIME = MAXIMUM. It takes the maximum time of a server
I.e.357912 minutes approximately 8.25 months
iii. TIME = NO LIMIT or 1440.It takes infinite time for job
execution. 1440 is logical value which specifies no limit

6. REGION:
Specifies maximum amount of memory require for job execution
Syntax: K or

where K = Kilobytes, M = Megabytes

M
The Maximum memory for REGION is 4M
7. RESTART:
1. Using RESTART parameter we can bypass any no of steps only from
beginning
2. Using RESTART we cant bypass the steps randomly
EX: s1, s2, s3, s4, s5, s6 are the steps
RESTART =s2
In the above example execution start from step2 onwards
8. TYPRUN:
1. It specifies the execution status of a job
2. Using TYPRUN we can also check the JCL code i.e. Syntax check
3. TYPRUN having different values as follows
SYNTAX:
TYPRUN = SCAN It checks only syntax errors and wont execute the job
TYPRUN = COPY It copies the use code and JCL on to the spool
TYPRUN = HOLD It checks only syntax errors and execute the job
TYPRUN = HOLD is default

9. ADDRSPC:
a. It specifies where the job is executing

b. EX: ADDRSPC = VIRTUAL


Or
REAL
10. NOTIFY:
a. It notifies the execution status of the job to the specific User ID or
default login ID
b. Syntax: NOTIFY = &SYSUID OR
USER ID
c. In job statement NOTIFY parameter is mandatory.

2. EXEC STATEMENT:
EXEC statement specifies starting of a step. Max 255 EXEC statements can
be written in one JCL
a. Positional Parameters:
1. PGM - Specifies the program name or load module
2. PROC Specifies the procedure
Any one of the above parameters is required for the job execution
b. Keyword Parameters:
1. TIME
2. REGION
3. PARM
4. COND
1. PARM:
By using PARM parameter we can pass max 100 characters of data to the
program
PARM is available character which contain both text & length fields
2. COND:
By using COND parameter we can execute or bypass any no of steps in a
job
In COND parameter it always take previous step return code only i.e.
MAXCC

If the given condition is satisfied it bypass the current step from execution if
not the current step is executed
COND is opposite to the IF statement
Syntax: COND = (Status Code, Operands, Step Name)
S TATU S C O D E

0 - 4059
0 S u c ce ssfu l
Exe cu tio n
4 Wa rn in g s
8 - E rror
1 2 - S e v ere
Erro r
1 6 - Fata l
Erro r

O P E RA N D S

Example:

G re a te r
T ha n (> )
Le ss
T ha n (< )
G re a te r
T ha n E q u a l
To (> = )
Le ss Th a n
Equal
To (< = )
Equal
To (= )
Not Equal
To (!= )

S1

MAXXCC = 4

S2

COND = (4, EQ)

STEP NAM E

S p e cifi e s
the n a m e
o f th e ste p

S3
S4
S5
Because of given condition step 2 will be bypassed from execution.
In COND we have 2 special values. They are.
a. COND = ONLY If it is coded then the current step is executed if and
only if the previous step is abended
b. COND = EVEN If it is coded then irrespective of previous step
execution it process the current step

3. DD STATEMENT:
DD statement specifies the data sets using in a JCL
MAX 3273 DD statements can be written in one JCL
1. Positional Parameters:
a. * (ALL) It is used in control statement and also used in various DD
statements
EX: //SYSIN DD *
b. Dummy it is mainly used to bypass the input data
EX: //SYSIN DD DUMMY
c. Data It is mainly used to pass the JCL lines
EX: //SYSIN DD DATA
2. Keyword Parameters:
a. DSN
b. DISP
c. SPACE
d. DCB
e. VOL=SER
f. UNIT
a. DSN (Data Set Name):
The max length of DSN is 44 characters and for every 8 characters there will
be a qualifier and max 5 qualifiers are allowed
1st qualifier should be USER ID. Possible values are a-z, 0-9, national
characters like #, @, $.
b. DISP (Disposition):
Used to specify status for the data sets
Syntax: (Status, Normal Disposition, Abnormal Disposition)

NORMAL
D IS P O S IT IO N

S TAT U S
N E W - S p e c ifi e s
n e w ly c re a tin g
d a ta s e t
O L D - S p e c ifi e s
a n e x is tin g d a ta
set
M O D (M o d ify ) a ls o s p e c ifi e s a n
e x is tin g d a ta s e t
S H R (S H A R E ) th e d a ta s e t is
s h a ra b le in
e n v iro n m e n t

C ATA LO G S p e c ifi e s th e
s to rin g th e d a ta
set nam e
p e rm a n e n tly in
th e v o lu m e
U N C ATA LO G U s e d to h id e th e
d a ta s e t
DELETE D e le te s th e d a ta
s e t fro m D A S D
K E E P - C re a tin g
te m p o ra ry d a ta
s e ts .
PA SS - C re a tin g
te m p o ra ry d a ta
s e ts . T h e d a ta
c a n b e u s e d in
n e x t le v e ls a ls o

ABNORM AL
D IS P O S IT IO N

C ATA LO G
U N C ATA LO G
D ELETE
KEEP

c. SPACE:
SPACE= (space unit, (primary, secondary, directory block), rlse)
Directory Block is required only for PDS. For PS its 0.
RLSE (RELEASE) It releases the unused secondary quantity from the
resource
D. DCB (Data Control Block) It specifies attributes of a data set
Syntax: DCB = (recfm = fb, lrecl = value, Belsize = multiples of lrecl only)
RECFM

: specifies record format

LRECL

: Logical Record Length

BLKSIZE : Block Size must be multiples of LRECL only


e. VOL = SER (VOLUME SERIAL) Specifies the name of volume in DASD
EX: VOL = SER = DEVMA0
f. UNIT Specifies the device type
EX: UNIT = 3390
3390: Specifies a logical value for device type

SPECIAL DD STATEMENTS:
1.
2.
3.
4.
5.
6.

SYSOUT
SYSPRINT
SYSIN
STEPLIB
JOBLIB
JCLLIB

Specifies the output of JCl


Used to Print the program messages
Used to accept the input data
Used to include user defined libraries
It is also used to include user defined libraries
It is mainly used to call or invoke catalog procedures

UTILITIES
Utilities are IBM supplied programs which are already coded, compiled and
executed to perform a specific functionality
All utilities are pre-defined programs
Utilities are mainly divided into two types. They are..
1. Data Set Utilities
2. System Utilities
The list of utilities available in JCL are as follows
1. IEBCOPY
2. IEBCOMPR
3. IEBGENER
4. IEBEDIT
5. IEBUPDTE
6. IEBPTPCH
7. IEHLIST
8. IEHPROGM
9. IEFBR14
10.IDCAMS
11.ICEMAN
12.SORT
All data set utilities always start with prefix IEB
All system utilities always start with prefix IEH

1. IEFBR14
IEFBR14 is called a dummy utility, mainly used for creation of non-vsam data
sets
We can also delete the non-vsam data sets using this utility

EX1. Creation of PS file using IEFBR14


//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=MATE05.GRP.PS,DISP=(NEW,CATLG,DELETE),
//

SPACE=(TRK,(10,10),RLSE),

//

DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),

//

VOL=SER=DEVMA0,UNIT=3390

//SYSOUT DD SYSOUT=*
//SYSIN DD *
/*
EX2. Creation of PDS file using IEFBR14
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=MATE05.GRP.PDS,DISP=(NEW,CATLG,DELETE),
//

SPACE=(TRK,(10,10,1),RLSE),

//

DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),

//

VOL=SER=DEVMA0,UNIT=3390

//SYSOUT DD SYSOUT=*

//SYSIN DD *
/*
EX3. Deletion of PDS file using IEFBR14
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=MATE05.GRP.PDS,DISP=(OLD,DELETE,DELETE),
//

SPACE=(TRK,(10,10,1),RLSE),

//

DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),

//

VOL=SER=DEVMA0,UNIT=3390

//SYSOUT DD SYSOUT=*
//SYSIN DD *
/*
EX4. Deletion of PS file using IEFBR14
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=MATE05.GRP.PS,DISP=(NEW,CATLG,DELETE),
//

SPACE=(TRK,(10,10),RLSE),

//

DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),

//

VOL=SER=DEVMA0,UNIT=3390

//SYSOUT DD SYSOUT=*
//SYSIN DD *
/*

2. IDCAMS
IDCAMS is a VSAM utility it also creates non-vsam files
EX1. Creation of PS file using IDCAMS
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=MATE05.GRP.PS,DISP=(NEW,CATLG,DELETE),
//

SPACE=(TRK,(10,10),RLSE),

//

DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),

//

VOL=SER=DEVMA0,UNIT=3390

//SYSOUT DD SYSOUT=*
//SYSIN DD *
/*
EX. Creation of PDS file using IDCAMS
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=MATE05.GRP.PDS,DISP=(NEW,CATLG,DELETE),
//

SPACE=(TRK,(10,10,1),RLSE),

//

DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),

//

VOL=SER=DEVMA0,UNIT=3390

//SYSOUT DD SYSOUT=*
//SYSIN DD *
/*

3. IEBCOPY
IEBCOPY works on the PDS file
By using IEBCOPY we can copy the members from one PDS to another PDS
Using IEBCOBY we can also bypass or exclude the members from copy and
also we can rename the existing members
EX1. Copy all members from PDS to PDS
//MATE05AB JOB NOTIFY=&SYSUID

M1

M1

//STEP1 EXEC PGM=IEBCOPY

M2

M2

//SYSPRINT DD SYSOUT=*

M3

M3

//DD1 DD DSN=MATE05.GRP.PDS,DISP=SHR
//DD2 DD DSN=MATE05.GRP.PDS1,DISP=SHR
//SYSIN DD *
COPY INDD=DD1,OUTDD=DD2
//SYSOUT DD SYSOUT=*
/*

M1

EX2. Copying selected members


//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=MATE05.GRP.PDS,DISP=SHR
//DD2 DD DSN=MATE05.GRP.PDS1,DISP=SHR
//SYSIN DD *
COPY INDD=DD1,OUTDD=DD2
SELECT MEMBER=(M1,M2)
//SYSOUT DD SYSOUT=*
/*

M2
M3

M1

EX3. Renaming members while copying


//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=MATE05.GRP.PDS,DISP=SHR

M1

A1

M2

A2

M3

X1

//DD2 DD DSN=MATE05.GRP.PDS1,DISP=SHR
//SYSIN DD *
COPY INDD=DD1,OUTDD=DD2
SELECT MEMBER=((M1,A1,R),(M2,A2,R))
//SYSOUT DD SYSOUT=*
/*
EX4. Exclude the members
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=MATE05.GRP.PDS,DISP=SHR
//DD2 DD DSN=MATE05.GRP.PDS1,DISP=SHR
//SYSIN DD *
COPY INDD=DD1,OUTDD=DD2
EXCLUDE MEMBER=(M1,M2)
//SYSOUT DD SYSOUT=*
/*

M1
M2

M3

M3

M4

EX5. Compressing a PDS file


//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=MATE05.GRP.PDS,DISP=SHR
//SYSIN DD *
COPY INDD=DD1,OUTDD=DD1
//SYSOUT DD SYSOUT=*
/*
4. IEBCOMPR
By using IEBCOMPR utility we can compare the data in two PS files and any
two PDS files
We cant compare PS with PDS and PDS with PS
Organization for PDS is PO
Organization of PS is PS
Syntax: COMPARE TYPORG =PS
or
PO
If two comparing files data is equal then MAXCC = 0 if not it gives more than
4
EX1. Comparing PS files
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBCOMPR
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PDS,DISP=SHR
//SYSUT2 DD DSN=MATE05.GRP.PDS1,DISP=SHR
//SYSIN DD *
COMPARE TYPORG=PS

//SYSOUT DD SYSOUT=*
/*
EX2. Comparing PDS files
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBCOMPR
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PDS,DISP=SHR
//SYSUT2 DD DSN=MATE05.GRP.PDS1,DISP=SHR
//SYSIN DD *
COMPARE TYPORG=PO
//SYSOUT DD SYSOUT=*
/*
5. IEBGENER
Mainly used for taking the backup of data
IEBGENER works only on PS files
The possibilities in IEBGENER are as follows
PS

PS
PS

PDS (MEMBER)
PDS (MEMBER)
PS
PDS (MEMBER)
PDS (MEMBER)
EX1. PS PS
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PS1,DISP=SHR
//SYSUT2 DD DSN=MATE05.GRP.PS2,DISP=SHR
//SYSIN DD *

//SYSOUT DD SYSOUT=*
/*
EX2. PS PDS (MEMBER)
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PS,DISP=SHR
//SYSUT2 DD DSN=MATE05.GRP.PDS(M1),DISP=SHR
//SYSIN DD *
//SYSOUT DD SYSOUT=*
/*
EX3. PDS (MEMBER) PS
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PDS(M1),DISP=SHR
//SYSUT2 DD DSN=MATE05.GRP.PS2,DISP=SHR
//SYSIN DD *
//SYSOUT DD SYSOUT=*
/*
EX4. PDS (MEMBER) - PDS (MEMBER)
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PDS(M1),DISP=SHR

//SYSUT2 DD DSN=MATE05.GRP.PDS(M2),DISP=SHR
//SYSIN DD *
//SYSOUT DD SYSOUT=*
/*

M3

EX5. Copying Data


//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PS1,DISP=SHR
//SYSUT2 DD DSN=MATE05.GRP.PDS1,DISP=SHR
//SYSIN DD *
GENERATE MAXNAME=2
MEMBER NAME=(M3,M4)
//SYSOUT DD SYSOUT=*
/*
Using GENERATE we can copy data from one PS to any no of members in a
PDS
MAXNAME specifies max no of members require in a PDS you may use less
than that also
Using IEBGENER utility we can copy the required columns data from the input
file by using RECORD FIELD
SYNTAX: RECORD FIELD = (LENGTH,LOCATION
INPUT,FORMAT,LOCATION OUTPUT)
Using MAXFLDS we can write any no of required fields into an output file
EX6.
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*

//SYSUT1 DD DSN=MATE05.GRP.PDS1(M2),DISP=SHR
//SYSUT2 DD DSN=MATE05.GRP.PS2,DISP=SHR
//SYSIN DD *
GENERATE MAXFLDS=2
RECORD FIELD=(4,1,,1),FIELD=(5,6,,6)
//SYSOUT DD SYSOUT=*
/*
INPUT:
1001 RAMU
1002 KUMA
R
1003 RAVI

2500
0
3200
0
4200
0

0010
0100
1000

OUTPUT:
1001 RAMU
1002 KUMAR
1003 RAVI
EX7. Inserting literals using MAXLITS MAX LITERALS
Using MAXLITS we can insert any no of literals in output file
EX6.
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PDS1(M2),DISP=SHR
//SYSUT2 DD DSN=MATE05.GRP.PS2,DISP=SHR

//SYSIN DD *
GENERATE MAXFLDS=3,MAXLITS=1
RECORD FIELD=(4,1,,1),FIELD=(1,*,,5), FIELD=(5,6,,6)
//SYSOUT DD SYSOUT=*
/*
PS3

EX8. Concatenation of data sets


//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBGENER

PS
1

PS
2

//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PS1,DISP=SHR
//

DD DSN=MATE05.GRP.PS2,DISP=SHR

//SYSUT2 DD DSN=MATE05.GRP.PS3,DISP=SHR
//SYSIN DD *
//SYSOUT DD SYSOUT=*
/*
6. IEBEDIT
Using IEBEDIT utility we can process any steps existed in a job
In IEBEDIT we have two possibilities. They are.
1. INCLUDE
2. EXCLUDE
By using INTRDR Internal Reader, we can process any required steps in a job
EX1.
In one PDS member
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*

//DD1 DD DSN=MATE05.GRP.PS,DISP=(NEW,CATLG,DELETE),
//

SPACE=(TRK,(10,10),RLSE),

//

DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),

//

VOL=SER=DEVMA0,UNIT=3390

//SYSOUT DD SYSOUT=*
//SYSIN DD *
//STEP2 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=MATE05.GRP.PS,DISP=(NEW,CATLG,DELETE),
//

SPACE=(TRK,(10,10),RLSE),

//

DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),

//

VOL=SER=DEVMA0,UNIT=3390

//SYSOUT DD SYSOUT=*
//SYSIN DD *
//STEP3 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PDS(M1),DISP=SHR
//SYSUT2 DD DSN=MATE05.GRP.PS2,DISP=SHR
//SYSIN DD *
//SYSOUT DD SYSOUT=*
//STEP4 EXEC PGM=IEBCOMPR
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PDS,DISP=SHR
//SYSUT2 DD DSN=MATE05.GRP.PDS1,DISP=SHR
//SYSIN DD *

COMPARE TYPORG=PS
//SYSOUT DD SYSOUT=*
Now in a member of your JCL
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBEDIT
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PDS(M2),DISP=SHR
//SYSUT2 DD SYSOUT=(*,INTRDR)
//SYSIN DD *
EDIT TYPE=EXCLUDE,STEPNAME=(STEP1,STEP3)
//SYSOUT DD SYSOUT=*
/*
EX2.
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBEDIT
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PDS(M2),DISP=SHR
//SYSUT2 DD SYSOUT=(*,INTRDR)
//SYSIN DD *
EDIT TYPE=INCLUDE,STEPNAME=(STEP1,STEP3)
//SYSOUT DD SYSOUT=*
/*
7. IEBUPDTE
By using IEBUPDTE we can change any record data existed in a member of
PDS by copying the address of the particular record

SYNTAX: ./ CHANGE NAME = MEMBER NAME,UPDATE = INPLACE


./ ENDUP
Inplace will update the existing data by new data
EX
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBUPDTE
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PDS1,DISP=SHR
//SYSUT2 DD SYSOUT=*
//SYSIN DD *
./ CHANGE NAME=M2,UPDATE=INPLACE
THIS IS MY LAST PROGRAM FOR TODAY
./ END UP
//SYSOUT DD SYSOUT=*
/*
EXECUTION PROCEDURE:
STEP1:
Open input PDS member. Copy the required record address by using the
command NUM ON. Press F11 and copy the required record address
STEP2:
Open currently running JCL and type the command NUM OFF and press
F11 and paste the copied address on the input record address
STEP3:
Submit the JCL and verify the updations in output file
8. IEBPTPCH

By using IEBPTPCH IEBPUNCH utility we can add max two title items to
the output fields
Using record field we can select any column data from the input file
SYNTAX:
PRINT TYPORG = PS, MAXFLDS = VALUE
TITLE ITEM = (INPUT TEXT,LOCATION IN OUTPUT)
TITLE ITEM = (INPUT TEXT,LOCATION IN OUTPUT)
EX
CASE1. Printing the output on to the spool
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBPTPCH
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PS1,DISP=SHR
//SYSUT2 DD SYSOUT=*
//SYSIN DD *
PRINT TYPORG=PS,MAXFLDS=2
TITLE ITEM=('EMPLOYEE DETAILS',30)
TITLE ITEM=('ENUM ENAME ',1)
RECORD FIELD=(4,1,,25),FIELD=(5,6,,30)
//SYSOUT DD SYSOUT=*
/*
CASE2. Printing data into an output file
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBPTPCH
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PS1,DISP=SHR
//SYSUT2 DD DSN=MATE05.GRP.PS2,DISP=SHR

//SYSIN DD *
PRINT TYPORG=PS,MAXFLDS=2
TITLE ITEM=('EMPLOYEE DETAILS',30)
TITLE ITEM=('ENUM ENAME ',1)
RECORD FIELD=(4,1,,25),FIELD=(5,6,,30)
//SYSOUT DD SYSOUT=*
/*
SORT AND ICEMAN
By using SORT we can perform only sort operation but by using ICEMAN
we can perform sort and merge
SYNTAX:
SORTFIELDS=(LOCATIONINPUT,LENGTH,FORMAT,SORTSE
QUENCE)
Sort sequence = A Ascending
D Descending
EX1. SIMPLE SORT
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SORTIN DD DSN=MATE05.GRP.PS1,DISP=SHR
//SORTOUT DD DSN=MATE05.GRP.PS2,DISP=SHR
//SYSIN DD *
SORT FIELDS=(1,5,CH,D)
//SYSOUT DD SYSOUT=*
/*
EX2. Eliminating the duplications existing in SORT field

//MATE05AB JOB NOTIFY=&SYSUID


//STEP1 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SORTIN DD DSN=MATE05.GRP.PS1,DISP=SHR
//SORTOUT DD DSN=MATE05.GRP.PS2,DISP=SHR
//SYSIN DD *
SORT FIELDS=(1,5,CH,D)
SUM FIELDS=NONE
//SYSOUT DD SYSOUT=*
/*
EX. SKIPREC, STOPAFT
By using SKIPREC we can bypass any no of records from the beginning
Using STOPAFT we can stop the process of sort operation
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SORTIN DD DSN=MATE05.GRP.PS1,DISP=SHR
//SORTOUT DD DSN=MATE05.GRP.PS2,DISP=SHR
//SYSIN DD *
SORT FIELDS=(1,5,CH,D)
SKIPREC = 4,STOPAFT = 4
//SYSOUT DD SYSOUT=*
/*
EX4. INREC, OUTREC
By using INREC fields we can bypass any no of columns from sort field
Using OUTREC after successful sort we can print any required field data from
the output file

SYNTAX1.

INREC FIELDS = (LOCATION OUTPUT:LOCATIONINPUT,LENGTH)


SYNTAX2.
OUTREC FIELDS = (LOCATION OUTPUT:LOCATIONINPUT,LENGTH)
EX1.
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SORTIN DD DSN=MATE05.GRP.PS1,DISP=SHR
//SORTOUT DD DSN=MATE05.GRP.PS2,DISP=SHR
//SYSIN DD *
INREC FIELDS=(10:1,3)
SORT FIELDS=(1,5,CH,D)
//SYSOUT DD SYSOUT=*
/*
EX2.
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SORTIN DD DSN=MATE05.GRP.PS1,DISP=SHR
//SORTOUT DD DSN=MATE05.GRP.PS2,DISP=SHR
//SYSIN DD *
SORT FIELDS=(1,5,CH,D)
OUTREC FIELDS=(10:6,15)
//SYSOUT DD SYSOUT=*
/*
EX5. MERGE
By using ICEMAN utility we can perform merge operation
Before you perform merge all input data sets must be in specific order
SYNTAX:
MERGE FIELDS =(LOCATIONINPUT,LENGTH,FORMAT,SORTSE
QUENCE)
//MATE05AB JOB NOTIFY=&SYSUID

//STEP1 EXEC PGM=ICEMAN


//SYSPRINT DD SYSOUT=*
//SORTIN1 DD DSN=MATE05.GRP.PS1,DISP=SHR
//SORTIN2 DD DSN=MATE05.GRP.PS2,DISP=SHR
//SORTOUT DD DSN=MATE05.GRP.PS,DISP=SHR
//SYSIN DD *
MERGE FIELDS=(1,5,CH,A)
//SYSOUT DD SYSOUT=*
/*
SYSTEM UTILITIES
All system utilities always starts with a prefix IEH
The list of system utilities are
1. IEHLIST
2. IEHPROGM
1. IEHLIST
By using this utility we can print an information regarding data set
In IEHLIST we have two possibilities. They are..
a. LISTPDS
b. LISTVTOC
LISTVTOC (Volume Table Of Contents) prints only catalog information of a
data set whereas LISTPDS will print all members information along with the
catalog entry
a. LISTVTOC
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEHLIST
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DISP=OLD,VOL=SER=DEVMA0,UNIT=3390
//SYSIN DD *

LISTVTOC DSNAME=MATE05.GRP.PDS,VOL=SYSDA=DEVMA0
//SYSOUT DD SYSOUT=*
/*
b. LISTPDS
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEHLIST
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DISP=OLD,VOL=SER=DEVMA0,UNIT=3390
//SYSIN DD *
LISTPDC DSNAME=MATE05.GRP.PDS,VOL=SYSDA=DEVMA0
//SYSOUT DD SYSOUT=*
/*

2. IEHPROGM
Using this utility we can DELETE the member of a PDS and also we can
RENAME the existing member of a PDS
Using this we can also CATALOG and UNCATALOG the data set
EX1. DELETE MEMBER
PDSOUTPUT
//MATE05AB JOB NOTIFY=&SYSUID

PDS INPUT
A1

A1

G1

//STEP1 EXEC PGM=IEHPROGM


//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DISP=OLD,VOL=SER=DEVMA0,UNIT=3390
//SYSIN DD *
SCRATCHMEMBER=M1,DSNAME=MATE05.GRP.PDS,VOL=SYSDA=
DEVMA0

//SYSOUT DD SYSOUT=*
/*
EX1. RENAMING THE MEMBER
PDSOUTPUT

PDS INPUT
A1

A1

//MATE05AB JOB NOTIFY=&SYSUID


//STEP1 EXEC PGM=IEHPROGM
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DISP=OLD,VOL=SER=DEVMA0,UNIT=3390
//SYSIN DD *
SCRATCHMEMBER=M1,DSNAME=MATE05.GRP.PDS,VOL=SYSDA=
DEVMA0
//SYSOUT DD SYSOUT=*
/*

PROCEDURES
PROCEDURE:
Is a step of JCL statements Using procedure we can reduce the program code
Using procedures we can write step in one procedure and we can execute them
anytime whenever we require
Each and every procedure will be identified with the prefix
//PROCNAME PROC
//STEP1

//PEND
PROC specifies the procedure where PEND specifies the end of procedure

We have two types of procedures. They are.


1. INSTREAM PROCEDURE
2. CATALOG PROCEDURE
1. INSTREAM PROCEDURE

We can write all INSTREAM procedures within a job


Max 15 INSTREAM procedures we can write
In INSTREAM procedure PEND is mandatory
We can execute the required procedure as follows
//STEPNAME EXEC PROC=PROCNAME

EX
//MATE02AB JOB NOTIFY=&SYSUID
//PROC1 PROC
//STEP1 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PDS1(M2),DISP=SHR
//SYSUT2 DD DSN=MATE05.GRP.PS2,DISP=SHR
GENERATE MAXFLDS=3
RECORD FIELD=(4,6,,1),FIELD=(5,11,,6),FIELD=(4,1,,12)
// PEND
//PROC2 PROC
//STEP2 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PDS(M1),DISP=SHR
//SYSUT2 DD DSN=MATE05.GRP.PS1,DISP=SHR
// PEND
//PROC3 PROC

//STEP3 EXEC PGM=IEBCOPY


//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=MATE05.GRP.PDS,DISP=SHR
//DD2 DD DSN=MATE05.GRP.PDS1,DISP=SHR
COPY INDD=DD1,OUTDD=DD2
// PEND
//PROC4 PROC
//STEP4 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PDS(M1),DISP=SHR
//SYSUT2 DD DSN=MATE05.GRP.PDS1(M2),DISP=SHR
// PEND
//STEP5 EXEC PROC=PROC1
//SYSOUT DD SYSOUT=*
/*
2. CATALOG PROCEDURE
By using catalog procedure we can make any procedure by using JCLLIB
ORDER
We can write maximum of 255 catalog procedures
Using catalog procedure we can invoke any required step existed in procedure
While writing catalog procedure in a member, procedure name and member
name must be same
In catalog procedures PEND statement is optional
Using catalog procedure we can reduce the code because it is mainly used for
code reusability
CODE IN MATE02.GRP.PDS(M1)
//M1 PROC

//STEP1 EXEC PGM=IEFBR14


//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=MATE05.GRP.PS4,DISP=(NEW,CATLG,DELETE),
//

SPACE=(TRK,(10,10),RLSE),

//

DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),

//

VOL=SER=DEVMA0,UNIT=3390

//SYSOUT DD SYSOUT=*
//SYSIN DD *
/*
CODE IN MATE02.GRP.PDS(M2)
//M2 PROC
//STEP2 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=MATE05.GRP.PDS,DISP=(NEW,CATLG,DELETE),
//

SPACE=(TRK,(10,10,1),RLSE),

//

DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),

//

VOL=SER=DEVMA0,UNIT=3390

//SYSOUT DD SYSOUT=*
//SYSIN DD *
/*
CODE IN MATE02.GRP.PDS(M3)
//M3 PROC
//STEP3 EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=MATE05.GRP.PDS,DISP=SHR

//DD2 DD DSN=MATE05.GRP.PDS1,DISP=SHR
//SYSIN DD *
COPY INDD=DD1,OUTDD=DD2
SELECT MEMBER=(M1,M2)
//SYSOUT DD SYSOUT=*
/*
CODE IN MATE02.GRP.PDS(M4)
//M4 PROC
//STEP4 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PDS1(M2),DISP=SHR
//SYSUT2 DD DSN=MATE05.GRP.PS2,DISP=SHR
//SYSIN DD *
GENERATE MAXFLDS=2
RECORD FIELD=(4,1,,1),FIELD=(5,6,,6)
//SYSOUT DD SYSOUT=*
/*
CODE IN MATE02.GRP.PDS(M5)
//M5 PROC
//STEP5 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PS1,DISP=SHR
//

DD DSN=MATE05.GRP.PS2,DISP=SHR

//SYSUT2 DD DSN=MATE05.GRP.PS3,DISP=SHR
//SYSIN DD *

//SYSOUT DD SYSOUT=*
/*
CODE IN MATE02.GRP.PDS(M6)
//M6 PROC
//STEP1 EXEC PGM=IEBPTPCH
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PS1,DISP=SHR
//SYSUT2 DD SYSOUT=*
//SYSIN DD *
PRINT TYPORG=PS,MAXFLDS=2
TITLE ITEM=('EMPLOYEE DETAILS',30)
TITLE ITEM=('ENUM ENAME ',1)
RECORD FIELD=(4,1,,25),FIELD=(5,6,,30)
//SYSOUT DD SYSOUT=*
/*
CODE IN MATE02.GRP.JCL(CATPRO)
//MATE05AB JOB NOTIFY=&SYSUID
//JCLLIB ORDER=(MATE05.GRP.PDS1)
//STEP1 EXEC PROC=M1
/*

PROCEDURE OVERRIDING
Using Procedure Overriding we can change the parameters values at the time of
execution of a procedure
We can override both EXEC and DD statement parameters
To override the EXEC statement parameter values

PARAMETER.STEPNAME=VALUE
To override DD statement parameter values
//STEPNAME.DDNAME DD PARAMETER=VALUE

EX
//MATE05AB JOB NOTIFY=&SYSUID
//PROC3 PROC
//STEP1 EXEC PGM=IEFBR14,TIME=(5,50)
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=MATE05.GRP.PS5,DISP=(NEW,CATLG,DELETE),
//

SPACE=(TRK,(10,10),RLSE),

//

DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),

//

VOL=SER=DEVMA0,UNIT=3390

// PEND
//STEP2 EXEC PROC=PROC3,TIME.STEP1=(2,20)
//STEP1.DD1 DD DSN=MATE05.GRP.PS6
//SYSOUT DD SYSOUT=*
/*
In the above example time value will be override by time=(2,20) at the same
time DSN value also override by PS6.

SYMBOLIC PARAMETERS
Symbolic parameters are the variables which can hold some values in it and the
value of symbolic parameters will be applied to the parameters whenever the
procedure is executed
Symbolic parameters are represented with a prefix &

The max length is 7 to 8 characters


EX
CASE1.
//MATE05AB JOB NOTIFY=&SYSUID
//PROC2 PROC
//STEP1 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=&A,DISP=(NEW,CATLG,DELETE),
//

SPACE=(TRK,(10,10),RLSE),

//

DCB=&B

//

VOL=SER=&C,UNIT=3390

//PEND
//STEP2 EXEC PROC=PROC2,A=MATE05.GRP2.PS3
//B=(RECFM=FB,LRECL=70,BLKSIZE=700),
//C=DEVMA0
//SYSOUT DD SYSOUT=*
/*
CASE2.
//MATE05AB JOB NOTIFY=&SYSUID
//PROC3 PROC
//STEP1 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=&A,DISP=(NEW,CATLG,DELETE),
//

SPACE=(TRK,(10,10),RLSE),

//

DCB=&B

//

VOL=SER=&C,UNIT=3390

//PEND
//STEP2 EXEC PROC=PROC3
//VAL1 SET A=MATE05.GRP2.PS3
// VAL2 SET B=(RECFM=FB,LRECL=70,BLKSIZE=700),
// VAL3 SET C=DEVMA0
//SYSOUT DD SYSOUT=*
/*
REFERBACK OPERATOR
By using REFERBACK OPERATOR * we can use any previous step
parameters value into the currently running step
We cant use REFERBACK in 1st step because REFERBACK always takes
the previous step values
SYNTAX: PARAMETER=*.STEPNAME.DDNAME
EX
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=MATE05.GRP.PS7,DISP=SHR
//

SPACE=(TRK,(10,10),RLSE),

//

DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)

//

VOL=SER=DEVMA0,UNIT=3390

//SYSOUT DD SYSOUT=*
//STEP2 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATE05.GRP.PS1,DISP=SHR

//SYSUT2 DD DSN=*.STEP1.DD1,DISP=SHR
//SYSIN DD *
//SYSOUT DD SYSOUT=*
/*

GENERATION DATA GROUP (GDG)


GDGs are liked named data sets which are internally and chronologically
related
In general we cant create a data set with same name but by using GDG we can
create max 255 liked named data sets. These are also called as Generations
All Generations are like PS files which we can edit and store some data in it
Generations are two types. They are..
1. Absolute Generations
2. Relative Generations
Absolute Generations are cataloged names which can view in catalog area
Relative Generations are not permanent names they may vary every time
The Generations will be represented as follows..
GnnnnVnn
G Generations
Max Value of nnnn 9999
V Version
Max Value of nn 99
While creating GDG we have to follow 3 steps. They are.
1. Creation of GDG base cluster
2. Creation of Modal data set
3. Generating the Generations

Step1. Creation of GDG base cluster


While creating GDG base cluster we are having some required parameters as
follows

1. NAME Specifies the name of a GDG which is mandatory. For every GDG
base cluster, Max length of GDG name is 35 characters
2. LIMIT(n) where n specifies the no of Generations require by the user. Max
value of n is 255
3. EMPTY or NOEMPTY
In case of EMPTY, when LIMIT is exceeded it uncatalogs all Generations and
create a New generation
In case of NOEMPTY, when LIMIT is exceeded it uncatalogs the oldest
Generation and New Generation is created.
NOEMPTY is default

4. SCRATCH or NOSCRATCH
SCRATCH will delete all uncataloged Generations
In case of NOSCRATCH , it wont delete the uncataloged Generations
NOSCRATCH is default
Step2. Creation of Modal data set
Modal data set is a PS file which is mainly used to set the properties for the
newly creating Generations
Step3. Generating Generations
Whenever user wants to generate the Generations according to the user
requirement
GDG(+2)
Day by Day Generations

EX1. GDG creation


//MATE05AB JOB NOTIFY=&SYSUID

GDG(+1)
Daily Generations

//STEP1 EXEC PGM=IDCAMS


//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DEFINE GENERATIONDATAGROUP(NAME(MATE05.GRP.GDG)LIMIT(2)EMPTYNOSCRATCH)
//SYSOUT DD SYSOUT=*
/*
In the above example using IDCAMS we create the GDG
Using Define command we can define a cluster
- is a continuation character in VSAM

EX2. Creation of Modal data set


//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=MATE05.GRP.MODAL,DISP=(NEW,CATLG,DELETE),
//

SPACE=(TRK,(10,10),RLSE),

//

DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),

//

VOL=SER=DEVMA0,UNIT=3390

//SYSOUT DD SYSOUT=*
/*
EX3. Generating Generations
//MATE05AB JOB NOTIFY=&SYSUID

//STEP1 EXEC PGM=IDCAMS


//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=MATE05.GRP.GDG(+1),DISP=(NEW,CATLG,DELETE),
//

SPACE=(TRK,(10,10),RLSE),

//

DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),

//

VOL=SER=DEVMA0,UNIT=3390

//SYSOUT DD SYSOUT=*
//SYSIN DD *
/*
Description:
In GDG + specifies newly creating GDGs
specifies an existing Generations
0 specifies Current Generations
Altering the GDG
By using ALTER command we can change the properties of GDG base
cluster
By using ALTER
1.
2.
3.
4.

We can change the LIMIT


We can change from EMPTY to NOEMPTY
We can change from SCRATCH to NOSCRATCH
Using ALTER we can also rename the GDG

EX.
//MATE05AB JOB NOTIFY=&SYSUID

//STEP1 EXEC PGM=IDCAMS


//SYSPRINT DD SYSOUT=*
//SYSIN DD *
ALTER MATE05.GRP.GDGLIMIT(3)NOEMPTYSCRATCH)
//SYSOUT DD SYSOUT=*
/*

DELETE GDG
By using DELETE command we can delete the GDG from catalog, while
deleting GDG we have two possible ways. They are.
1. Force
2. Purge
Force will delete all generations along with GDG base cluster
In case of Purge, it deletes all the Generations

NOTE:
It overrides the retention period and deletes the GDG
EX.
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *

DELETE MATE05.GRP.GDG FORCE


Or
PURGE
//SYSOUT DD SYSOUT=*
/*

Vous aimerez peut-être aussi