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

Query in GDG to delete the first 199 versions


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

New User


Joined: 15 Sep 2008
Posts: 22
Location: Mumbai

PostPosted: Tue Feb 10, 2009 8:23 am
Reply with quote

Hi All,

I have a GDG with 200 versions. There is a requirement in my project to delete the first 199 versions and to retain only the latest version. Kindly let me know the command to delete all the versions and to retain only the latest version alone.

Thanks in advance!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Feb 10, 2009 8:44 am
Reply with quote

Hello,

Generations not versions. . .

There is no such command. . .

You could copy the one generation you want to keep to some other dataset name, delete all of the cataloged generations (that can be done with one dd statement), then copy the saved generation back to the proper dataset name.

I've never tried to rename a dataset into a gdg, so i'd use copy . . .
Back to top
View user's profile Send private message
nithivenkat

New User


Joined: 15 Sep 2008
Posts: 22
Location: Mumbai

PostPosted: Tue Feb 10, 2009 9:01 am
Reply with quote

Hi Dick,

Can you pls let me know how delete all the cataloged generations with one dd statement.

Thanks.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Feb 10, 2009 9:06 am
Reply with quote

Hello,

You could use
Code:

//DD1   DD  DSN=the.gdg,DISP=(OLD,DELETE)

Make sure you have copied the one you want to keep first. . .
Back to top
View user's profile Send private message
nithivenkat

New User


Joined: 15 Sep 2008
Posts: 22
Location: Mumbai

PostPosted: Tue Feb 10, 2009 9:13 am
Reply with quote

Hi Dick,

Just one more doubt,,

Should I mention the base name in the DSN parameter or any generation?
Back to top
View user's profile Send private message
abhishek dadhichi

New User


Joined: 19 Apr 2007
Posts: 37
Location: Bangalore

PostPosted: Tue Feb 10, 2009 9:17 am
Reply with quote

Hi nithivenkat,

Yes..according to the code given by Dick..the DSN parameter should have the GDG base name ,that's what is specified in his code 'the.gdg'.




Thanks,
Abhishek
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Feb 10, 2009 9:28 am
Reply with quote

Hi Dick,

if any are migrated, they will be recalled, it might be best to use IDCAMS,
or alternatively change the limit to 1, this will roll off and delete all except the lastest GDG.


Gerry
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Feb 10, 2009 10:04 am
Reply with quote

Hi Gerry,

Quote:
it might be best to use IDCAMS
Yup, might be. I was remembering a situation where we creasted a flock of +1's during the day, processed them all in a batch job and deleted the lot as they were all still online. . .

If these are older and migrated, the recall could be a pain. . .
Back to top
View user's profile Send private message
nithivenkat

New User


Joined: 15 Sep 2008
Posts: 22
Location: Mumbai

PostPosted: Tue Feb 10, 2009 1:43 pm
Reply with quote

Hi gcicchet,

Pls let me know how to set the limit to 1 using IDCAMS.

Thanks.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Feb 10, 2009 1:56 pm
Reply with quote

Hi,

here is an example
Code:
//STEP0001 EXEC PGM=IDCAMS           
//SYSPRINT DD SYSOUT=*               
//SYSIN    DD *                       
  ALTER  gdgname LIMIT(01)
/*   


You may want to set it back to the original limit after this.

Gerry
Back to top
View user's profile Send private message
nithivenkat

New User


Joined: 15 Sep 2008
Posts: 22
Location: Mumbai

PostPosted: Tue Feb 10, 2009 2:17 pm
Reply with quote

Thank you Dick and gcicchet icon_smile.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Feb 10, 2009 4:30 pm
Reply with quote

I wonder what about the data in those 199 generations once limit is set to 1?
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Tue Feb 10, 2009 4:43 pm
Reply with quote

Those 199 generations would be recataloged or uncataloged or deleted...
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Feb 10, 2009 5:06 pm
Reply with quote

Hi Gnanas,
Gnanas N wrote:
Those 199 generations would be recataloged or uncataloged or deleted...
'am sorry, didn't get you - was it for me?
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Tue Feb 10, 2009 5:12 pm
Reply with quote

Yes, Anuj!
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Feb 10, 2009 5:16 pm
Reply with quote

Anuj D. wrote:
I wonder what about the data in those 199 generations once limit is set to 1?

Try it and see icon_lol.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Feb 10, 2009 5:36 pm
Reply with quote

Well, my concern was - were those GDGs never needed? is it a production scenario? why did not they had a simple QSAM DSN instead of choosing GDGs at first place then? What benefit would they get "rolling" the GDGs on a later date..?

Quote:
Try it and see
Tried, only "latest" was left others were "lost" and their data as well.. icon_biggrin.gif
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 DELETE SPUFI DB2 1
No new posts DSNTIAUL driven delete IBM Tools 0
No new posts RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts How to delete a user's alias from the... JCL & VSAM 11
Search our Forums:

Back to Top