Skip to main content

Introduction

A GDG is a group of related datasets that are chronologically ordered by generation numbers (e.g., DATA.GDG.G0001V00, DATA.GDG.G0002V00, etc.).

With IDCAMS, you can:

  • Create a GDG base (a catalog entry that manages the group)
  • Delete a GDG base
  • List GDG base and generations

IBM Docs - Define GDG

You can also refer to General IDCAMS for more details.

Exercise: Create IDCAMS SYSIN for GDG

  • Create an IDCAMS SYSIN to define a GDG base named TSG.DATA.REPORT that allows up to 5 generations. When the limit is reached and a new generation is created, all existing generations must be deleted from both catalog and disk.

  • Define a GDG base called TSG.AUDIT.LOG with a limit of 10 generations. When the limit is reached, only the oldest generation should be removed and it should remain on disk after uncataloging.

  • Write IDCAMS SYSIN to create GDG base TSG.APP.HISTORY that allows 7 generations, retains all data sets on disk even when removed from the catalog and removes all existing generations when the limit is reached.

  • Create a GDG base named TSG.BACKUP.DATA that Supports 4 generations, deletes only the oldest generation from catalog when the limit is reached and a new one is added, physically deletes the removed data sets from disk.

  • You are asked to define a GDG base named TSG.ARCHIVE.MASTER that can hold up to 999 generations. The data sets should be scratched when removed due to limit overflow, and only the oldest generation should be removed at that time.

  • Write IDCAMS SYSIN to delete the GDG base TSG.DAILY.REPORT and all its associated generation data sets, assuming they are SMS-managed.

  • Create IDCAMS SYSIN to delete only the GDG base TSG.AUDIT.LOG, leaving all its generation data sets intact on disk.

Exercise: GDG Referencing

  • You are asked to create a new GDG base named TSG.REPORT.DAILY. After that, define a new generation using relative reference (+1).

  • You generated one single generation. Now you are given the following DD statements used in a copy job. Identify which data sets are referenced.
//DD1 DD DSN=TSG.REPORT.DAILY(0),DISP=OLD
//DD2 DD DSN=TSG.REPORT.DAILY.G0002V00,DISP=OLD

What will happens if you change DD2 to DSN=TSG.REPORT.DAILY(+1),DISP=OLD?


  • A GDG base TSG.SKIP.TEST is defined with LIMIT(3) EMPTY SCRATCH. The first job creates the following generations:

  • (+1) → G0001V00

  • (+10) → G0011V00

  • (+11) → G0012V00

A second job then allocates a generation using (+1). List the dataset that will exists after each job and how should the user reference them.


  • You have a GDG base TSG.LOGFILE with 3 generations created over time. You run a job with:
//IN1 DD DSN=TSG.LOGFILE(-1),DISP=SHR

What is being referenced?


Exercise: GDG and DISP combination.

Preparation

You are asked to create a job with 2 steps for freshely created GDG Base.

  • Step 1: Allocate generation using (+1) with DISP=(NEW,DELETE,DELETE)
  • Step 2: Allocate generation using (+1) with DISP=(NEW,CATLG,DELETE)

Q1. Which generation is cataloged after the first job?

Q2. What happens when (0) is referenced in a new job using DISP=OLD?

Q3. If the steps are swapped (catalog first, delete later), what changes?


Exercise: GDG Manual Catalog Deletion

Steps:

  • Create three properly cataloged generations: (+1), (+2), and (+3).

  • In a new job, read the following DD statements:

    //PROBE  EXEC PGM=IEFBR14
    //L0 DD DSN=YOUR.GDG.BASE(0),DISP=OLD
    //L1 DD DSN=YOUR.GDG.BASE(-1),DISP=OLD
    //L2 DD DSN=YOUR.GDG.BASE(-2),DISP=OLD
  • Manually delete the second generation and then re-run the same job.

Questions (answer both before and after the manual deletion):

  1. What does L0 read?
  2. What does L1 read?
  3. What does L2 do or read?