Wednesday, May 27, 2009

9. Generation DataSets

Although there are many different uses for sequential datasets, many sequential files have one characteristics in common : they are used in cyclical application for example, sequential dataset that contains transaction posted daily against a master file is cyclical; each days transactions, along with the processing required to post them, from one cycle. Similarly a sequential dataset used to hold the backup copy of a master file is cyclical too; each time a new backup copy is made, new cycle is begun.

In most of the cyclical applications, it’s good idea to maintain versions of the files used for several cycles. That way if something goes wrong, you can recreate the processing that occurred during previous cycles to restore the affected files to a known point. Then the processing can continue from that point

For this MVS provides a facility called generation data group, GDG is a collection of two or more chronologically related versions of the same file. Each version of the file or member of the GDG, is called a generation dataset. A generation dataset may reside on tape or DASD. It is generally sequential (QSAM) or direct(BDAM) file. ISAM and VSAM files can’t be used in GDGs.

As each processing cycle occurs a new generation of dataset is added to the generation data group. The new version becomes the current generation; it replaces the old current generation, which becomes a previous generation.

file.c1(+1) Next Generation
file.c1(0) Current Generation
file.c1(-1) Previous Generations
file.c1(-2)
file.c1(-3)


Figure above is the structure of a generation data group. There are 3 previous generations, note that generations are numbered relative to the current generation, file.c1(0).

Relative generation numbers are adjusted when each processing cycle completes, so that the current generation is always referred to as relative generation 0.
MVS uses the generation data group’s catalog entry to keep track of relative generation numbers. As a result, GDGs must be cataloged and each generation dataset that’s a part of the group must be cataloged too.

When you create a generation data group’s catalog entry, you specify how many generations should be maintained Example: You might specify that five generations including the current generation should be maintained. Then during each processing cycle, the new version of the file becomes the current version.


Although MVS lets you use relative generation numbers to simplify cyclical processing, MVS uses “Absolute Generation Numbers” in the form GnnnnV00 to identify each generation dataset uniquely. GnnnnV00 represents the chronological sequence number of the sequence number of the generation, beginning with G0000.

V00 is a version number, which lets you maintain more than one version of a generation. Each time a new generation dataset is created, mvs adds one the sequence number. The sequence and version numbers are stored as a part of the file’s dataset name, like this:

filename.GnnnnV00

35 chars 9 chars



// IN DD DSN=DA0002T.MASTER, DISP=SHR

// OUT DD DSN=DA0002T.MASTER.DAY(+1),
DISP= (NEW,CATLG,DELETE),
UNIT=3390, VOL=SER=BP0031,
SPACE= (CYL,(10,5),RLSE),
DCB=(PROD.GDGMOD,
BLKSIZE=23440,LRECL=80,RECFM=FB)\

Example 9.1 Using a GDG


Relative Name and Absolute Name

DA0002T.MASTER.DAY90) ---> Relative Name
DA0002T.MASTER.DAY.G00001V00 -->Absolute Name



// Step1 EXEC PGM=IDCAMS
// SYSPRINT DD SYSOUT = *
// SYSIN DD *
DEFINE GDG
(NAME(DA0002T.MASTER.DAY)
LIMIT(5)
SCRACH
EMPTY)
/*
Example 9.2 Defining a GDG Index



Following code contains 1 job with 2 steps....


//DA0003TA JOB
//UPDATE EXEC PGM=PAY3200
//OLDMAST DD DSN=MMA2.PAY.MAST(0),DISP=OLD
//NEWMAST DD DSN=MMA2.PAY.MAST(+1),
DISP= (NEW,CATLG),UNIT=3300,
VOL=SER=BS3001,
DCB=(LRECL=80,BLKSIZE=1600)
//PAYTRAN DD DSN=MMA2.PAY.TRAN,DISP=OLD
//PAYLIST DD SYSOUT=*
//REPORT EXEC PGM=PAY3300
//PAYMAST DD DSN=MMA2.PAY.MAST(+1),DISP=OLD
//PAYRPT DD SYSOUT=*

Example 9.3a Adding datasets to a GDG

Following code contains 2 jobs.........

//JOB1 JOB
//UPDATE EXEC PGM=PAY3200
//OLDMAST DD DSN=MMA2.PAY.MAST(0),DISP=OLD
//NEWMAST DSN=MMA2.PAY.MAST(+1),
DISP=(NEW, CATLG), UNIT=3300,
VOL=SER=BS3001,
DCB=(LRECL=80, BLKSIZE=1600)
//PAYTRAN DD DSN=MMA2.PAY.TRAN,DISP=OLD
//PAYLIST DD SYSOUT =*
//JOB2 JOB ...........
//REPORT EXEC PGM=PAY3300
//PAYMAST DD DSN=MMA2.PAY.MAST(0),DISP=OLD
//PAYRPT DD SYSOUT=*

Example 9.3b Adding datasets to a GDG

GDG’s are a group of datasets which are related to each other chronologically and functionally. Generations can continue until a specified limit is reached. The LIMIT parameter specifies total number of generations that can exist at any one time. Once limit is reached the oldest generation is deleted.

GDG Index have to be created using the IDCAMS command ‘DEFINE GDG’ before datasets that are to be included in them can be made a part of them.
Model containing parameter information of the datasets to be included in the GDG has to be specified. All datasets within a GDG will have the same name. Generation number of a dataset, within a GDG is automatically assigned by OS when created. Datasets within a GDG can be referenced by their relative generation number. Generation 0 always references current generation

Creation of GDGs

Create and catalog the index
Use IDCAMS statement DEFINE GDG for creating Index
Parameters for creating index
Specification

Name of GDG
Number of generations
Limit …. maximum no of datasets in a GDG.
Action to be taken when limit is reached

• Uncataloging oldest generation once limit reached
• Uncataloging all generations when limit reached
Physical deletion of entry
Uncataloging entry without physical deletion

Defining a model for the GDG.

NAME …… refers to the name of the GDG Index
LIMIT ….. refers to the maximum no of datasets in a GDG.

NOEMPTY…
EMPTY …
SCRATCH ….
NOSCRATCH …


Modifying Features of GDG

You can modify a GDG only with the ALTER command


//STEP1 EXEC PGM=IDCAMS
//SYSIN DD
ALTER DA0001T.ACCOUNTS.MONTHLY -
NOSCRATCH -
EMPTY
/*
//

Example 9.4 Modifying a GDG
Deleting GDG Index

Can be deleted by the DELETE parameter of IDCAMS
Will result in an error on reference to any generation datasets of the GDG


/STEP1 EXEC PGM=IDCAMS
//SYSIN DD
DELETE DA0001T.ACCOUNTS.MONTHLY GDG
/*
//

Example 9.5 Deleting GDG Index
Adding a Dataset to a GDG

Name of the model containing the GDG DCB parameter’s is coded in the DCB parameter of the DD statement


//STEP1 EXEC PGM=GDG1
//FILE1 DD
// DSN=DA0001T.ACCOUNTS.MONTHLY (+1),
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(TRK,(30,10),RLSE),
// DCB=(MODEL.DCB,
// RECFM=FB,LRECL=80,
// BLKSIZE=800)
Example 9.6 Adding a Dataset to a GDG



Deleting GDG Index and Datasets

FORCE parameter in the DELETE statement of IDCAMS can be used

Example :


/STEP1 EXEC PGM=IDCAMS
//SYSIN DD
DELETE DA0001T.ACCOUNTS.MONTHLY` -
GDG -
FORCE
/*
//
Example 9.7 Deleting GDG Index and Datasets

Back to VSAM index

No comments: