JCL Session 10
CATALOGUED
DATASET NAMES MUST BE UNIQUE
(no duplicate dataset names)
When running production jobs,
it may be necessary to delete
and catalogue the same
dataset name within a single job step.
This will ordinarily
be adequate
if the program was good
and
if the input data was good.
What happens if this job
has to be rerun
because of bad data
or an error in the program?
JCL Example 1:
(on a system that permits delete/catalogue of same
dataset name within a single step.)
//STEP1 EXEC
PGM=UPDATE
//OLDMAST DD DISP=(OLD,DELETE,KEEP),DSN=CSC.MASTFILE
<- deleted
//NEWMAST DD DISP=(NEW,CATLG,DELETE),DSN=CSC.MASTFILE,
<- cataloged
//
UNIT=SYSDA,SPACE=(TRK,(10,5),RLSE),
//
DCB=(RECFM=FB,LRECL=80,BLKSIZE=4800)
//TRANS DD DISP=OLD,DSN=CSCTRANS.FILE
JCL Example 2:
(workaround on a system that does not permit delete/catalogue of
same dataset name within a single step.)
//STEP1 EXEC
PGM=UPDATE
//OLDMAST DD DISP=(OLD,DELETE,KEEP),DSN=CSC.MASTFILE
<- deleted
//NEWMAST DD DISP=(NEW,CATLG,DELETE),DSN=CSC.MASTFILE.NEW,
<- cataloged
//
UNIT=SYSDA,SPACE=(TRK,(10,5),RLSE),
//
DCB=(RECFM=FB,LRECL=80,BLKSIZE=4800)
//TRANS DD
DISP=OLD,DSN=CSCTRANS.FILE
//*
//RENAME EXEC PGM=IDCAMS,COND=(4,LT,STEP1)
//SYSPRINT DD SYSOUT=*
//DD1
DD DISP=OLD,DSN=CSC.MASTFILE.NEW
//SYSIN
DD *
ALTER
CSC.MASTFILE.NEW NEWNAME
(CSC.MASTFILE) FILE
(DD1)
GENERATION
DATA GROUPS
(GDG)
a method of generating unique
dataset names by adding a number to the datasets.
Any single
GDG dataset can be referenced
by
-
the dataset name and an absolute
number or
-
the dataset name and its relative
(+, 0, -) number
The entire
series of GDG datasets can be referenced by
GDG's become an automatic method
of providing backup files.
Absolute dataset name |
Relative dataset name |
CSC.MASTFILE.G00001V00 |
CSC.MASTFILE(-3) |
CSC.MASTFILE.G00002V00 |
CSC.MASTFILE(-2) |
CSC.MASTFILE.G00003V00 |
CSC.MASTFILE(-1) |
CSC.MASTFILE.G00004V00 |
CSC.MASTFILE(0) |
GDG Absolute Number name format
is: XXXXXXXX.XXXXXXXX.GnnnnnV00
The count increases for every
new dataset created.
Relative dataset name format is:
Current file is always
(0)
Creating a new GDG dataset requires
using a (+N)
Typically the JCL format is
gdg.dataset.name(+1)
The relative dataset (+1) becomes
(0) when the job finishes.
Generation data sets may also
be used for Transaction file accumulation
Absolute dataset name |
Relative dataset name |
CSC.TRANS.FILE.G00001V00 |
CSC.TRANS.FILE(-3) |
CSC.TRANS.FILE.G00003V00 |
CSC.TRANS.FILE(-2) |
CSC.TRANS.FILE.G00007V00 |
CSC.TRANS.FILE(-1) |
CSC.TRANS.FILE.G00009V00 |
CSC.TRANS.FILE(0) |
GDG Relative number example:
//OLDMAST DD DISP=OLD,DSN=CSC.MASTFILE(0)
<- current master not deleted
//NEWMAST DD DISP=(NEW,CATLG,DELETE),DSN=CSC.MASTFILE(+1),
<- new master
//
UNIT=SYSDA,SPACE=(TRK,(10,5)),DCB=(MODELDSCB)
//TRANS DD DISP=OLD,DSN=CSC.TRANS.FILE(0)
//*
//* What happens if you
have to rerun this job because
//* of bad data or an error
in the program?
GDG Absolute number example:
//OLDMAST DD DISP=OLD,DSN=CSC.MASTFILE.G00003V00
<- absolute
//NEWMAST DD DISP=(NEW,CATLG,DELETE),DSN=CSC.MASTFILE(+1),
<- relative
//
UNIT=SYSDA,SPACE=(TRK,(10,5)),DCB=(CSC.MODELDSCB)
//TRANS DD DISP=OLD,DSN=CSC.TRANS.FILE(0)
Example of GDG reference
that retrieves 'all' generations currently in the group:
//OLDMAST DD DISP=OLD,DSN=CSC.MASTFILE(0)
//NEWMAST DD DISP=(NEW,CATLG,DELETE),DSN=CSC.MASTFILE(+1),
//
UNIT=SYSDA,SPACE=(TRK,(10,5),RLSE),DCB=(CSC.MODELDSCB)
//TRANS DD DISP=OLD,DSN=CSC.TRANS.FILE
//*
//* How many files are used
for input?
Data Control Block information
is available from
-
Program,
-
JCL and
-
Dataset label
Programming Advice:
Since it is easier to change JCL than programs, use the fewest statements
possible within your COBOL programs regarding DCB information.
i.e. ( BLOCK CONTAINS 0
RECORDS )
Model DCB -
a template to use for GDG dataset being created
DCB Formats:
-
The first parameter of the DCB must
be the model DCB.
-
Other DCB information is
needed if it differs from
the model DCB.
DCB=(modeldcb.dsn,RECFM=record_format,BLKSIZE=block_size,LRECL=record_length)
If the model DCB adequately
describes the DCB attributes of the new dataset, then the DCB parameter
could just refer to the model. ie.
DCB=(modeldcb.dsn)
To Create a GDG group:
1) Create a model DCB.
(Not necessary
if there is an existing DCB model)
2) Define a GDG group name.
(this step
is only done once)
To Create a GDG
dataset:
Write to a file with a
-
dataset name the
same as the GDG
group name
-
(+n) appended
to the dataset name
(Use with relative number
(+1) or higher)
-
modeldcb.dsn is
the first DCB parameter.
1) Create
a model DCB by using IEFBR14 and catalogue
an empty dataset
with the DCB parameters. i.e.
//MODEL EXEC PGM=IEFBR14
//STDDCB DD DSN=CCP%##.CSC.MODLDSCB,
<- arbitrary name
// DISP=(NEW,CATLG),UNIT=SYSDA,
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=4000),
// SPACE=(TRK,0) <-
no space needed since dataset is empty
//*
the VTOC records contain the DCB attributes
2) Define
a GDG base by using IDCAMS
DEFINE GDG ( NAME(CCP%##.CSC.MASTFILE)
-
LIMIT(number_of_generations_GDG_base_contains)
-
NOEMPTY [remove
oldest generation from base]
Or EMPTY [remove
all generations] -
SCRATCH [ uncatalog
and delete removed generation ]
Or NOSCRATCH [ uncatalogs
but does not delete] )
Example of defining a GDG base
//DEFINE EXEC
PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN
DD *
DELETE CCPF00.CSC.MASTFILE
GDG
DEFINE GDG ( NAME(CCPF00.CSC.MASTFILE)
-
LIMIT(3)NOEMPTY SCRATCH)
GDG & PROC -- EXERCISE (Value
30 points)
Preparation work
that should be done but not handed in to instructor.
-
Build a generation data group CCP%##.GDG.FILE
that will hold three cycles of data. (Use IDCAMS)
-
Modify your PGMWPARM PROC of Exercise
9 so that it sends the IEBGENER output to
a GENERATION DATA SET
Work that should be handed in
to instructor.
One Job with two successful executions
of the procedure
from CCP%##.CSC.PROCLIB and
produce two generation
data sets within the same JOB
The minium JCL handed in includes:
-
Job statement
-
jcllib statement
-
2 exec PROC= statements
Correct assignments will only have
return codes of 0000.