Ansible for IBM Z

Ansible for IBM Z

Ansible for IBM Z

Facilitate communication, user interaction and feedback for Red Hat Ansible Certified Content for IBM Z

 View Only

ZOAU 1.3.1 makes managing GDGs easier than ever!

By Oscar Fernando Flores Garcia posted Fri June 21, 2024 04:58 PM

  

Generation Data Groups (GDGs) on z/OS are a popular way to organize and manage versions of data sets because GDGs act like a mini version control system. In this blog, we’ll cover the latest GDG enhancements in ZOAU 1.3.1 as we walk through a GDG workflow. Specifically, we’ll show you how to use commands that now support GDS relative names.

A GDG is a collection of non-VSAM data sets that are stored and managed by z/OS in chronological order. Each data set within the group is called a generation data set (GDS). The most recent GDS that gets added to a group becomes the latest generation. You specify how many generations to keep, and z/OS automatically disposes of outdated generations.

GDGs are convenient because you can use a common name to refer to all the data sets in the group. To refer to the different generations in the group, you can use GDS relative name syntax. A GDS absolute name is a standard non-VSAM name in the form GDG.GxxxxVxx, but a GDS relative name is simply the base name plus a signed integer: (0) refers to the latest generation, (-1) is next to latest, and so forth. To add a new generation, just use (+1).

To learn more about GDGs, see Processing generation data groups.

z/OS provides a few ways to interact with GDGs. For example, you could write some JCL that uses IDCAMS to define GDG bases, allocate data sets within GDGs, delete GDGs, and manage generations. Or you could use ISPF to achieve the same result.

ZOAU gives you two news ways to interact with GDGs. In ZOAU 1.3.1, you can use GDGs with dcp, dgrep, dmod, drm, dsed, dtouch, jsub, mls, mmv, mrm, and mvscmd. Some ZOAU utilities support operations over a complete group, whereas others use GDS relative names. To learn more, see What's new with ZOAU.

GDGs in ZOAU, step by step

Let's start by creating our first GDG with ZOAU. A GDG entry, often called the base, describes the characteristics of the group and must define a limit that represents the maximum number of active generations in the group.

Create a Generation Data Group

First, we use dtouch to create the GDG base. The string ```dtouch -tGDG -L<GDG limit> <generation data group name>``` is required. The options [-dEPSXYv] are available to define additional GDG attributes. To learn more about the options, see DGP Optional Parameters.

For example, to create a GDG base name with a generation limit of 20, use the following command:

dtouch -tGDG -L20 USER.GDG.TEST

et voila! We have created the base upon which we will create the new generations.

Create data sets with the GDS relative name syntax

Once the GDG is created, we can create a data set with the GDS relative name syntax:

dtouch -tseq "USER.GDG.TEST(+1)"

We use dls to view our newly created data set. Because GDGs do not display by default, we use option -tGDG.

dls -tGDG -tGDS USER.GDG.TEST* 
USER.GDG.TEST 
USER.GDG.TEST.G0001V00

The -t option also allows us to filter generation datasets in a rolled-off state by substituting the GDS type with the non-VSAM tag. A rolled-off generation is an SMS-managed dataset that no longer belongs to a GDG index. A data set in this situation preserves the absolute name but is re-cataloged as a simple non-VSAM dataset.

dls -tGDG -tNONVSAM USER.GDG.TEST.G????V??

Submit a job in GDG

Of course this sequential data set we just created is like any other, we can store data in it or even some JCL. If you store multiple versions of a JCL in a GDG, you can use jsub to submit the latest version.

jsub USER.GDG.JCL(0)

Delete a GDG

Use drm to delete a GDG base. If no generations in the GDG are active, we can simply call drm with no options. However, because our workflow example contains at least one GDS, we have to use the `-F` option to delete everything.

drm -F USER.GDG.TEST

You can delete multiple GDGs by using a pattern with drm, but exercise caution—a pattern deletes all the GDGs, GDSs, non-VSAM, and VSAM datasets that match.

Use Python for automation

To automate your work with GDGs, you can use the new gdgs python module. Start by creating a new GDG with the gdgs.create() function. This creates a GenerationDataGroupView object that we can use to handle the GDG as a whole:

gdg = gdgs.create(name=USER.GDG,limit=30)

We can now list its active generations with gdg.generations(). Because we’re in Python, the GenerationDataGroupView instances support the iterator protocol.

for generation in gdg:
        print(generation.name)

To delete all the data sets associated with gdg and part of the active generations, use gdg.clear(). To delete the GDG and all of its active GDSs, issue gdg.delete().

# Delete all GDG generations. This remove all GDSs associated to the GDG.

gdg.clear()

# Delete all GDG generations and the GDG base itself.

gdg.delete()

GDGs are a great tool to manage historically related data sets, and with ZOAU 1.3.1, you can easily integrate GDGs into your ZOAU workflows. To stay up-to-date with the latest ZOAU news, visit What’s new with ZOAU.

About the Authors

Oscar Fernando Flores Garcia is an IBM z/OS Ansible Core software engineer designing and developing many of the collections modules and responsible for many of the product releases. 

Daniel Alejandro Rodriguez Castro is an IBM ZOAU software engineer developing many of the core capabilities of the product, responsible for the GDG implementation.


Text edited by Nate Myers. 

0 comments
31 views

Permalink