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

 What happens if this job has to be rerun

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)

Any single GDG dataset can be referenced by 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

Relative dataset name format is:

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

Programming Advice:

       Since it is easier to change JCL than programs, use the fewest statements possible within your COBOL programs regarding DCB information.



Model DCB -

        a template to use for GDG dataset being created



DCB Formats: 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


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
 

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.



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:
 

Correct assignments will only have return codes of 0000.