1) Create a GDG file. This JCL calling IDCAMS will do it. In this example LIMIT(15) is the number of generations you wish to create and keep. Of course, change the GDG file name to your requirements:
//STEP1 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DEFINE GDG(NAME(STEWART.APPLY.LOG.GDGROUP1) - LIMIT(15) - NOEMPTY - SCRATCH) /*
2) Create a model or template for the individual generations of data sets. Here the default DCB attributes for the Apply or Capture log were used. Note that the space is rather small (5 tracks) in this example so you might want to increase it.
//STEP020 EXEC PGM=IEFBR14 //GDGMODEL DD DSN=STEWART.APPLY.LOG.GDMODEL1, // DISP=(NEW,KEEP,DELETE), // UNIT=SYSDA, // SPACE=(TRK,5), // DCB=(LRECL=1024,RECFM=VB,BLKSIZE=6144,DSORG=PS)
3) As a test you can create your first generation of data sets by running this JCL example. Each time you run this step a new generation of data set will be created in your group.
//STEP010 EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY //SYSUT1 DD * TEST DATA LINE 1 TEST DATA LINE 2 /* //SYSUT2 DD DSN=STEWART.APPLY.LOG.GDGROUP1(+1), // DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,5), // DCB=STEWART.APPLY.LOG.GDMODEL1
After you have created several generations of log files an ISPF 3.4 display of your GDG would look like this:
STEWART.APPLY.LOG.GDGROUP1 STEWART.APPLY.LOG.GDGROUP1.G0003V00 STEWART.APPLY.LOG.GDGROUP1.G0004V00 STEWART.APPLY.LOG.GDGROUP1.G0005V00 . . . STEWART.APPLY.LOG.GDMODEL1
The ISPF 3.4 screen header also tell you how many generations of datasets you have.
Data Sets Matching STEWART.APPLY.LOG.GDGROUP1.G* Row 1 of 15
There are 15 generations of the dataset.
4) Because the Apply or Capture log file is not referenced by a DD statement you must use IEBGENER to copy your app.log or cap.log file to the GDG. Place this step ahead of your Apply or Capture JCL. This step creates a new generation of data in your group. Consider using the LOGREUSE=N parm when you start Capture or Apply so that each generation of the log is unique to the specific instance when Capture or Apply was run.
//COPYLOG EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=STEWART.DSN9.STEVE1.APP.LOG, // DISP=SHR //SYSUT2 DD DSN=STEWART.APPLY.LOG.GDGROUP1(+1), // DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,5), // DCB=STEWART.APPLY.LOG.GDMODEL1 //SYSIN DD DUMMY //SYSOUT DD SYSOUT=* //SYSUDUMP DD SYSOUT=*
5) If you need to delete your GDG, delete the individual data sets (G0003V00, G0004V00, etc.) and then run this IDCAM job to delete the GDG.
//STEP010 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DELETE (STEWART.APPLY.LOG.GDGROUP1) GDG FORCE /*
Finally, this example of a GDG was created with 15 generations of data sets using the LIMIT(15) parameter. If you wish to change the number of generations run this IDCAMS alter example where the number of generation is increased to 50. Use the GDG name in the ALTER statement that you created from Step 1.
//STEP010 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * ALTER STEWART.APPLY.LOG.GDGROUP1 LIMIT(50) /*
The maximum value for LIMIT is 255.