JCL · 2026-10-11

GDG Basics in JCL: Generation Data Groups Explained with Examples

Understand GDG datasets, relative generations, and common JCL usage patterns for daily batch processing.

A Generation Data Group, or GDG, is a group of related datasets arranged by generation. GDGs are widely used in daily batch processing because they make it easy to refer to today’s file, yesterday’s file, or a newly created file.

Why GDGs are used

Many jobs process files by business date. For example:

Instead of hardcoding a new dataset name every day, a GDG allows relative references.

Relative generation numbers

Common references are:

Example:

//INFILE DD DSN=DBALA.SALES.DAILY(0),DISP=SHR
//OUTFILE DD DSN=DBALA.SALES.DAILY(+1),DISP=(NEW,CATLG,DELETE)

Creating a GDG base

GDG bases are often created with IDCAMS:

//STEP01 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
  DEFINE GDG(NAME(DBALA.SALES.DAILY) LIMIT(7) SCRATCH)
/*

LIMIT(7) keeps seven generations. SCRATCH means old generations are deleted when they roll off.

Practical use case

A daily billing job might do this:

1. Read CUSTOMER.INPUT(0).
2. Create BILLING.REPORT(+1).
3. Compare current report with BILLING.REPORT(-1).
4. Archive output for audit.

GDGs keep this flow simple and consistent.

Common mistakes

Conclusion

GDGs are a clean way to manage time-based datasets. Once you understand relative generations, many batch jobs become easier to read and safer to operate.

← Back to all articles