GDG ( Generation Data Group ) : Complete Tutorial with examples

GDG is basically a collection of files. Mainframe has a facility to keep track of multiple files and to keep data in consolidated format.If there are multiple files with n number of records, we can keep data with the different versions having 1 base.

For example : If you have output files that you produce every day, and you need to consolidate these every week, one approach is to produce a file each day with different naming convention but MVS has given the facility to produce a files in consolidated format through GDG.

GDG ( Generation Data Group )

Lets discuss How the things are easier in GDG ?

We just need to create one base and the files will be created automatically with that base,  so there will be no need of creating a different files daily according to our requirement.

Each created file is added as a generation to the GDG(Base). So if you created seven files, there will be seven generations to the GDG. In this case, if you defined limit as seven then there will be seven generations as the maximum, you will always have seven generations. Generally, the generation number is incremented by one every time a file is created. So the first time a file is created, it will have generation one.

Utilities used GDG ( Generation Data Group )

1) To create a base : IDCAMS
2) To create a files in that particular base : IEFBR14


Parameters used for creation of GDG Base :

1) Limit
2) Empty/ No Empty
3) Scratch/ No Scratch


Creating GDG base :

The below example shows how the GDG base is created :

FSP.SNEHA1.GDG : base name for which the different versions of file will be created.

LIMIT : parameter is 5 means Number of files that will be created will be 5. 

NOEMPTY : when the limit is reached the oldest generation will be uncatalogued.  

SCRATCH : It will physically delete the entry if limit is reached.

SCRATCH and NOEMPTY are default parameters.

GDG


ALTER GDG

ALTER keyword is basically used to change the attributes of GDG base, Such as LIMIT, SCRATCH/NOSCRATCH, EMPTY/NOEMPTY.  Once the GDG is created with the attributes and after few days we realize that we want to increase the limit or want to change from scratch to noscratch or empty to noempty we can alter those attributes with ALTER keyword and change the attributes even if those were defined during the creation of base.So basically ALTER can change the attributes even if GDG base is created.

Below is the example for the same :

GDG


Creating versions in GDG

Below is the example to show the versions/ Files created for GDG base :

FSP.SNEHA1.GDG(+1) shows the creations of files on that particular base.
Current version will always be (0)
Next will be (+1) , (+2) similarly…

GDG


DELETION of any particular file in GDG base

Suppose there are 4 files created and there is a requirement of deleting any 1 from from the same GDG base. We can do it via IEFBR14 utility. We just need to mention the file version name with the correct DISP parameters. Below example clearly shows the deletion of particular file from base.

GDG


Hope you find this article useful and GDG concepts got cleared from this article. If you like this article please share to help others and subscribe with us for latest updates.
This post is contributed by purvi nagdev . For more details contact – purvin58@gmail.com

Leave a Comment

Your email address will not be published. Required fields are marked *