Many companies running mainframes these days have an online interactive product such as Fileaid that can be used to create a GDG base. If your company has this (or another product that allows GDG bases to be created interactively) then using that product is usually the simplest way to create your GDG base.
If you don't have an interactive product that allows you to create a GDG base or you have a need to create a GDG base during batch processing then you can use Idcams. The two main pieces of information that you need to supply in creating a GDG base are the name of the GDG and the number of generations of the GDG that you want the GDG to hold. For example, the following JCL will create a GDG base called MY.GDG.BASE to hold three generations:
//STEPX EXEC PGM=IDCAMS
//SYSIN DD *
DEFINE GDG (NAME(MY.GDG.BASE) LIMIT(3) SCRATCH)
One thing that you can do using Idcams that you can't do as easily with the interactive products is to alter the number of generations of an existing GDG that are to be kept. This can be done relatively easily using Idcams. If we want to change the number of generations of MY.GDG.BASE from three to four we would execute the following JCL:
//STEPY EXEC PGM=IDCAMS
//SYSIN DD *
ALTER MY.GDG.BASE LIMIT(4)
This article written by Stephen Chapman, Felgall Pty Ltd.