JCL: GDG Create, Delete, Alter, GDGs all Examples

GDG also called Generation Data Group. I have explained the life cycle of GDG in the following steps:

6 Top GDG Prime Points

  1. Create GDG
  2. GDG Template
  3. Create first GDG
  4. Create new generation GDG
  5. Delete GDG

1.Create a GDG File

Create a GDG file. This JCL calling IDCAMS will do it. In this example LIMIT(15) is the number of generations you wish to create and keep. Of course, change the GDG file name to your requirements:

//STEP1 EXEC PGM=IDCAMS  
//SYSPRINT DD SYSOUT=*  
//SYSIN DD *   
DEFINE GDG(NAME(STEWART.APPLY.LOG.GDGROUP1) -   
LIMIT(15) -   
NOEMPTY -   
SCRATCH)
  /*

2. Create a GDG Model

Create a model or template for the individual generations of data sets. Here the default DCB attributes for the Apply or Capture log were used. Note that the space is rather small (5 tracks) in this example so you might want to increase it.

//STEP020 EXEC PGM=IEFBR14 
//GDGMODEL DD DSN=STEWART.APPLY.LOG.GDMODEL1, 
// DISP=(NEW,KEEP,DELETE), 
// UNIT=SYSDA, 
// SPACE=(TRK,5), 
// DCB=(LRECL=1024,RECFM=VB,BLKSIZE=6144,DSORG=PS)

Hard skills get you the interview, soft skills get you the job.

Anonymous

3. Generate GDG

Advertisements

As a test, you can create your first generation of data sets by running this JCL example. Each time you run this step a new generation of data set will be created in your group.

//STEP010 EXEC PGM=IEBGENER 
//SYSPRINT DD SYSOUT=* 
//SYSIN DD DUMMY 
//SYSUT1 DD *  
TEST DATA LINE 1  TEST DATA LINE 2 
/* 
//SYSUT2 DD DSN=STEWART.APPLY.LOG.GDGROUP1(+1),
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,5), 
// DCB=STEWART.APPLY.LOG.GDMODEL1

After you have created several generations of log files an ISPF 3.4 display of your GDG would look like this:

STEWART.APPLY.LOG.GDGROUP1
STEWART.APPLY.LOG.GDGROUP1.G0003V00
STEWART.APPLY.LOG.GDGROUP1.G0004V00
STEWART.APPLY.LOG.GDGROUP1.G0005V00
.
.
.
STEWART.APPLY.LOG.GDMODEL1

The ISPF 3.4 screen header also tells you how many generations of datasets you have.

For example, Data Sets Matching STEWART.APPLY.LOG.GDGROUP1.G* Row 1 of 15. There are 15 generations of the dataset.

4. New Generation GDG

Because the Apply or Capture log file is not referenced by a DD statement you must use IEBGENER to copy your app.log or cap.log file to the GDG. Place this step ahead of your Apply or Capture JCL.

This step creates a new generation of data in your group. Consider using the LOGREUSE=N parm when you start Capture or Apply so that each generation of the log is unique to the specific instance when Capture or Apply was run.

//COPYLOG EXEC PGM=IEBGENER 
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=STEWART.DSN9.STEVE1.APP.LOG,
// DISP=SHR
//SYSUT2 DD DSN=STEWART.APPLY.LOG.GDGROUP1(+1),
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,5),
// DCB=STEWART.APPLY.LOG.GDMODEL1
//SYSIN DD DUMMY //SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*

5. Delete GDG

Advertisements

If you need to delete your GDG, delete the individual data sets (G0003V00, G0004V00, etc.) and then run this IDCAM job to delete the GDG.

//STEP010 EXEC PGM=IDCAMS 
//SYSPRINT DD SYSOUT=*
//SYSIN DD * DELETE (STEWART.APPLY.LOG.GDGROUP1) GDG FORCE
/*

Finally, this example of a GDG was created with 15 generations of data sets using the LIMIT(15) parameter. If you wish to change the number of generations run this IDCAMS alter example where the number of generations is increased to 50. Use the GDG name in the ALTER statement that you created from Step 1.

//STEP010 EXEC PGM=IDCAMS 
//SYSPRINT DD SYSOUT=*
//SYSIN DD * ALTER STEWART.APPLY.LOG.GDGROUP1 LIMIT(50)
/*

The maximum value for LIMIT is 255.

Ref:IBM

LATEST POSTS

Tony Robbins Vocabulary: 50 Powerful Words and Phrases to Improve Your English

Learn 50 powerful Tony Robbins vocabulary words and phrases with simple meanings and example sentences to improve your English speaking skills

Migrating JSON Files from AWS S3 to PostgreSQL Using AWS Glue and PySpark

Migrating JSON files from AWS S3 to PostgreSQL using AWS Glue and PySpark is one of the most common data engineering challenges teams face today. In this guide, you will learn exactly how to build a production-grade AWS Glue JSON to PostgreSQL migration pipeline — from reading raw JSON files in S3 to writing clean,…

5 PySpark Performance Anti-Patterns on Databricks (And How to Fix Them)

Databricks makes scaling big data processing feel almost effortless. Under the hood, however, writing PySpark without understanding how Apache Spark and Delta Lake execute your code can quietly ruin performance, spike DBU costs, and cause out-of-memory (OOM) crashes. Below are 5 common PySpark anti-patterns seen in production, along with exact code fixes to keep your…

Databricks Lakebase vs. Lakehouse vs. Data Warehouse: What’s the Difference?

Confused by Databricks Lakebase, Lakehouse, and traditional Data Warehouses? Here is a complete comparison of OLTP vs. OLAP architectures, key use cases, and when to use each.

Something went wrong. Please refresh the page and/or try again.

Discover more from Srinimf

Subscribe now to keep reading and get access to the full archive.

Continue reading