What is GDG?

GDG stands for "Generation Data Group", a concept in the mainframe that allows organizing and managing datasets or files over the time. These are a group of datasets that are logically related (with the same attributes like format and record length) to each other from the process and usage point of view.

Generation data sets (GDSs) can be sequential (PS), direct, or partitioned data sets (PDS).

Naming of GDG?

All datasets (generation) within GDG share the common name except the last qualifier, which is a combination of the generation number and version number. The common name is called as "GDG Base", and the remaining datasets with a different qualifier at the end are called as "GDG Files or GDG Generations". At any point in time, a GDG can have a maximum of 255 generations.

GDG naming

Absolute (full) Generation & Version Numbers -

The generation and version numbers are used to identify a specific generation of GDG. The format is -


In the above -

  • MATEPK.TEST.GDG is the GDG base name.
  • GmmmmVnn is the generation and version numbers form, where mmmm is a 4-digit generation number (ranges from 0001 to 9999) and nn is a 2-digit version number (ranges from 00 to 99).

Relative Version Numbers -

We can also use relative generation numbers to refer the GDG datasets based on their position from the latest GDG file. —for example, X.Y.Z(-1). X.Y.Z(+1), or X.Y.Z(0).


In the above -

  • MATEPK.TEST.GDG is the GDG base name.
  • nnn is the relative number of the GDG generation from the latest. nnn is a 3-digit generation number (ranges from 001 to 255).

Example - Let us assume we have a GDG like the one below, and we will discuss how the relative number is used on it.

  • MATEPK.TEST.GDG(0) refers to the latest generation. From the above example, it refers to MATEPK.TEST.GDG.G0002V00.
  • MATEPK.TEST.GDG(-nnn) refers to the previous generation from the latest. From the example, MATEPK.TEST.GDG(-1) refers MATEPK.TEST.GDG.G0001V00.
  • MATEPK.TEST.GDG(+nnn) refers to the newly created generation on top of the latest generation. From the example, MATEPK.TEST.GDG(+1) refers MATEPK.TEST.GDG.G0003V00.

    +nnn (positive relative number) is only used when creating a new generation in the JCL. For example, +1 is the first new generation, +2 is the second generation, and so on.
Note! All generations and their relative numbers are updated only at the successful run of the job, i.e., For any executing job, the relative numbers coded are the same until it ends. Once the job runs successfully, the generations and relative numbers are updated. If the job abends, then the next version won't get created.

Rules to Remember -

  • All the generations of a GDG should have the same attributes (DCB parameters such as record length, record format, and so on).
  • A maximum of 255 generations can exist within a GDG.
  • GDGs should be cataloged.
  • Generations of GDG should be sequential and reside on disk.
  • While creating a new generation, the DISP parameter should be set to (NEW, CATLG,...).
  • DSN and UNIT parameters are mandatory for creating a new generation.
  • Generation data sets cannot be VSAM data sets.


The major benefits are -

  • Organized Data Management: GDG datasets are used to take periodic backups (daily, weekly, or monthly) of critical data for future reference.
  • Version Control: GDGs can be referenced using relative numbers. So, it makes the JOB run successfully every time without modifying its file names (because of relative numbers).
  • Memory Limit: We can set a limit for the generations to save the memory.
  • Simplified Referencing: We can easily track all generations by just referring to the base name. Any specific generation can be referred to easily.
  • Automatic Cleanup: The older generations automatically get deleted based on the options coded while creating the base.
  • Consistency in Processing: Ensures that the correct version of data is used in batch processing.


  • Complexity: For new users, the concept and syntax of GDGs can be complex to understand. Managing GDGs can become complex as the number of generations increases.
  • Limited Flexibility: The rigid structure of GDGs might only fit some data management needs.
  • Space Management: GDGs can consume excessive disk space if not managed properly.
  • Limited Scope: GDGs are specific to mainframe environments and might not integrate with other data management systems.
  • Storage Overhead: Keeping multiple generations of datasets can consume significant storage resources if not managed properly.