Using GDG in JCL
Using GDG in JCL
To reference a GDG generation in a JCL, we use its name along with a generation number or a relative generation number.
- Absolute Generation Reference - MATEPK.TESTPS.GDG.G0001V00
- Relative Generation Reference - MATEPK.TESTPS.GDG(0)
Examples -
Scenario1 - Let us assume the GDG has two generations, as shown below. Copy the current GDG version to the new version using the absolute generation number.
MATEPK.TEST.GDG
MATEPK.TEST.GDG.G0001V00
Code -
----+----1----+----2----+----3----+----4----+----5----+----6
//MATEPKCG JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//*
//STEP10 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATEPK.TEST.GDG.G0001V00,DISP=SHR
//SYSUT2 DD DSN=MATEPK.TEST.GDG.G0002V00,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(10,10),RLSE),
// UNIT=3390,VOL=SER=DEVHD4,
// DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//SYSIN DD DUMMY
SYSPRINT in Spool -

Output -

We can use the absolute generation number to refer to the generations in the JCL.
Scenario2 - Let us assume the GDG has three generations, as shown below. Copy the current GDG version to the new version using the relative generation number.
MATEPK.TEST.GDG
MATEPK.TEST.GDG.G0001V00
MATEPK.TEST.GDG.G0002V00
Code -
----+----1----+----2----+----3----+----4----+----5----+----6
//MATEPKCG JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//*
//STEP10 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATEPK.TEST.GDG(0),DISP=SHR
//SYSUT2 DD DSN=MATEPK.TEST.GDG(+1),
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(10,10),RLSE),
// UNIT=3390,VOL=SER=DEVHD4,
// DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//SYSIN DD DUMMY
SYSPRINT in Spool -

Output -

We can use the relative generation number to refer to the generations in the JCL.