Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 7: JCL GDG


Creating Generation Data Set (GDS)

Note:- In order to understand how we can create generation data set, make sure you have gone through “Characteristics of GDG” article

  • Below example illustrates the creation of Generation data set.
    //DEPTJOB JOB A123,’STEVE’ //STEPNAME EXEC PGM=IDCAMS //SYSPRINT DD * //SYSUT1 DD DSN=PAYROLL.SALARY, //SYSUT2 DD DSN=PAYROLL.SALARY.MONTHLY(+1), // DISP=(NEW,CATLG,DELETE), // UNIT=PROD,SPACE=(CYL(2,2),RLSE), // DCB=(MODEL.GDG,LRECL=80, // BLKSIZE=0,RECFM=FB) //SYSIN DD * REPRO INFILE(SYSUT1) OUTFILE(SYSUT2) /* //
  • For all new generation data set, disposition must be cataloged and thus DISP parameter will always be :- DISP=(NEW,CATLG,DELETE)
  • While coding DCB parameter in above code snippet, system is instructed to reference the DCB sub parameter specified for the data set called MODEL.DCB, thus DCB parameter specified above results in creation of new generation data set
  • Data set mentioned in SYSUT2 above follows format GDGBASENAME(+1).
  • The syntax (+1) creates new generation relative to current generation. GDGBASENAME(0) can be used to reference current generation.
  • The earlier generation can be referenced by using GDGBASENAME(-1) and the second oldest generation can be references by using GDGBASENAME(-2) and so on.
  • Generations are updated only at the end of the job, meaning:-
    • JOB STEP1 creates one generation, code it as GDGBASENAME(+1)
    • JOB STEP2 creates one more generation, then you have to code it as GDGBASENAME(+2) because the (+1) is not yet promoted to current generation.
    • For any executing job the current generation remains same until it ends. So in above case GDGBASENAME(+2) will get promoted to current generation only after execution of job
  • Below illustration can help in better understanding

Deleting Generation Data Set (GDS)

//DEPTJOB JOB A123,’STEVE’ //STEPNAME EXEC PGM=IEFBR14 //DDNAME2 DD DSN=PAYROLL.SALARY.MONTHLY(0), // DISP=(OLD,DELETE,DELETE) //






© copyright mainframebug.com
Privacy Policy