Generation Data Group-VSAM


GDGs are a group of datasets related to each other chronologically and functionally.


1.       All datasets within a GDG will have the same name.

2.       The generation number of a dataset within the GDG is automatically assigned by the OS when it is created. GnnnnVnn

3.       Datasets within a GDG can be referenced by the absolute generation names or by their relative generation number. Generation 0 always references the current generation.

4.       2 GDD versions(GDSs) can exist in different formats.

5.       No more than 255 datasets can exist within one GDG

6.       GDGs must reside on a tape or DASD

7.       The DSN and UNIT parameters must be coded for all new generation datasets.

8.       GDGs must be cataloged. The DISP parameter must be set to CATLG for all new generation datasets.

Creating GDGs

Step 1: Create an Index for a GDG or creating a GDG base

Before a GDS is created, an index or GDG base is created. The IDCAMS utility is used to create an index which uses the DEFINE GDG control statement.

DEFINE GDG (NAME(datasetname)       -
LIMIT(n)                -

NAME – This is the parameter that contains the actual dataset name minus the generation and version number part.

LIMIT – this indicates how many generations you wish to maintain within the GDG.

SCRATCH – This is the default and it specifies that if the entry of a dataset from a GDG is removed from the index, then it should also be physically deleted from the volume it resides. NOSCRATCH indicates that the dataset should only be uncataloged and not physically deleted.

EMPTY – This is the default and specifies that all the existing generations of the GDG are to be uncataloged  once the limit of possible generations has reached. NOEMPTY specifies that only the oldest generation is to be uncataloged.

Step 2: Create an GDG Model

The model prototype will contain the specifications for the DCB subparameters for all the datasets that will belong to that GDG. The model should reside in the same volume as its index entry. Each time a dataset is created, it will use the DCB parameters from the model.

Step 3: Creating a GDS


Generations are created at the end of the JOB and not at the end of each job step.

Note: You can omit the MODEL.DCB for SMS managed datasets.

Will result in JCL error.

Modifying Features of a GDG

ALTER gdg-name

Deleting GDG Index/GDG base

DELETE gdg-name GDG

Deleting a GDS

Individual GDS can be deleted coding a DELETE on DISP parameter in the DD statement for that GDS. Or it can be deleted directly from the 3.4(DSLIST) panel by specifying a ‘d’ against the GDS. Or it can deleted using the IDCAMS DELETE command itself.

GDGs and SMS

When you create a SMS managed GDS and do not catalog it, SMS does catalog it even if you don’t, but it will NOT place the GDS within the GDG structure. Such a state for a GDS is called as DEFERRED state. The Deferred state can be found from the allocation messages as “RETAINED” and not “CATALOGED”.

The GDS needs to be ROLLED IN to the GDG to make it usable. It can be done in 2 ways:
  • To force a GDS to be added to the GDG structure use the ALTER IDCAMS command.
ALTER generation-dataset-name ROLLIN
  • The second method is to reuse it with the DISP=(NEW,CATLG)

How to access GDSs

You can access a GDS using either the:

a.       Absolute Path Name – COMPANY.EMPLOYEE.G0005V00

b.       Relative Path Name – COMPANY.EMPLOYEE(0)

c.       Entire GDG – When the GDG base is provided then the system will concatenate all the active generations. (most recent to oldest fashiom). If 2 different generations have different attributes then concatenation is not possible. 


Computers TopOfBlogs Technology Blogs Mainframe interview question and answers,mainframe jobs,cobol,vsam,jcl,cics,db2,rdbms,mvs,tso,ispf,ibm,hcl,tcs,cts,wibro Blog Directory