Mainframe Path Start learning free
CoreDataset

Defining and managing a GDG

Creating the group, and what the options actually do.

DEFINE GDG
//DEFGDG   EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  DEFINE GDG ( -
     NAME(PROD.PAY.BAL) -
     LIMIT(14) -            keep 14 generations
     SCRATCH -             physically delete when rolled off
     NOEMPTY )              roll off only the oldest, not all
/*
OptionEffect
LIMIT(n)How many generations are kept, 1 to 255
SCRATCHDelete the data when a generation rolls off
NOSCRATCHUncatalog only; the data stays on the volume
EMPTYWhen the limit is reached, uncatalog ALL generations
NOEMPTYUncatalog only the oldest — almost always what you want

Working with generations

ReferenceMeans
(0)The current generation
(-1), (-2)Previous generations
(+1)A new generation created by this job; stays (+1) for the whole job
No reference at allEvery generation, concatenated newest first

Stuck on something else?
Ask the community or search the full course.

Ask a question