Question:Is there a parameter in IDCAMS that will allow you to specify a expiration date on the versions of a generation dataset group (GDG) when you define it.
Answer:Yes there is. The parameters for the IDCAMS to define a generation data group are:
[EMPTY or NOEMPTY]
[SCRATCH or NOSCRATCH]
[TO(date) or FOR(days)] )
 indicates optional sections, uppercase must appear as shown, substitute your values for the lowercase.
As you can see the last optional parameter allows you to either specify that the file expires after a given number of days or on a given date.
Now to how it works in relation to the limit parameter (which specifies the number of generations to keep).
Let's use a simple example. If limit is set to 5 and you have 5 generations then one or more of those generations may be past its expiry date. The GDG will always retain the number of generations specified by the limit regardless of the expiry date.
If we then create a new sixth generation then what happens depends on whether the earliest generation has reached its expiry date. If it has then that generation is deleted and the new generation is added leaving us with 5 generations. Relative generation numbers change to reflect the creation order. If the oldest generation has not yet reached its expiry date then it is not deleted yet but is retained as part of the GDG until the expiry date is reached. Everything else happens exactly the same so we now have six generations in our GDG even though the limit is five.
Note that if you set the expiry to a number of days that this may not take effect until after the dataset "falls out" of the GDG.
This article written by Stephen Chapman, Felgall Pty Ltd.