IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Diff between a GDG and a dataset


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
akshathan

New User


Joined: 18 Aug 2006
Posts: 45

PostPosted: Thu Aug 31, 2006 4:04 pm
Reply with quote

Hi all,

I want to know the major difference between the dataset and GDG.


reagrds
akshatha
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Thu Aug 31, 2006 6:16 pm
Reply with quote

A GDG is a dataset, however, a dataset if not necessarily a GDG.

When you create a dataset in a job, you give that dataset a name and you may also give it a retention period or expiration date to specify when the dataset will be deleted from the catalog.

A GDG is a "generation data group". When you define a GDG to the system using the IDCAMS utility, you specify a limit. This limit indicates how many versions of the dataset to keep.

For example:
Code:

//DEFINE EXEC PGM=IDCAMS                                   
//SYSPRINT DD SYSOUT=*                                     
//SYSIN    DD *                                           
  DEF GDG  (NAME(HLQ.DATASET.NAME.FILE) LIMIT(7) SCRATCH) 
  ALTER 'HLQ.DATASET.NAME.FILE'  LIMIT(4)
  DEL 'HLQ.DATASET.NAME.FILE' GDG
/*                     


The 1st example is a DEFINE. You are creating a GDG by the name of HLQ.DATASET.NAME.FILE. The limit is set to 7.

The 2nd example is a ALTER. This would change the limit to 4.

The 3rd example is a DELETE. This would delete the GDG definition on the system.

Once a GDG is defined, you can then start creating GDG datasets. When you run your job to create this dataset, you specify:
//TAPEOA DD DSN=HLQ.DATASET.NAME.FILE(+1),UNIT=SYSDA...etc.

This would create a file called:
HLQ.DATASET.NAME.FILE.G0001V00

The next time you create the dataset it would be called:
HLQ.DATASET.NAME.FILE.G0002V00

The next time:
HLQ.DATASET.NAME.FILE.G0003V00

Each time the version goes up 1.

When you create the 8th version with the limit set to 7. The system will delete the 1st version (G0001V00). That way you always keep 7 versions of the dataset.

If you want to read the last created version of the dataset, You would code:
HLQ.DATASET.NAME.FILE(0)

If you wanted to read the last 5 versions into a sort, you would code:
//SORTIN DD DSN=HLQ.DATASET.NAME.FILE(0),DISP=SHR
// DD DSN=HLQ.DATASET.NAME.FILE(-1)DISP=SHR
// DD DSN=HLQ.DATASET.NAME.FILE(-2),DISP=SHR
// DD DSN=HLQ.DATASET.NAME.FILE(-3),DISP=SHR
// DD DSN=HLQ.DATASET.NAME.FILE(-4),DISP=SHR

Note that the versions are not created until a job ends, so if you write a GDG with:
//TAPEOA DD DSN=HLQ.DATASET.NAME.FILE(+1),UNIT=SYSDA...etc.
and you want to read the GDG in a later step, you must code:
//TAPEIA DD DSN=HLQ.DATASET.NAME.FILE(+1),DISP=SHR

However, if you want to READ it into another job, you must code:
//TAPEIA DD DSN=HLQ.DATASET.NAME.FILE(0),DISP=SHR

Also, you can always reading a specific version by coding:
//TAPEIA DD DSN=HLQ.DATASET.NAME.FILE.G0003V00,DISP=SHR
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Allocated cylinders of a dataset DB2 12
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
Search our Forums:

Back to Top