Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Query in GDG to delete the first 199 versions

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Query in GDG to delete the first 199 versions
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

Site Director


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

PostPosted: Tue Feb 10, 2009 8:44 am    Post subject:
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    Post subject: Reply to: Query in GDG
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

Site Director


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

PostPosted: Tue Feb 10, 2009 9:06 am    Post subject:
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    Post subject: Reply to: Query in GDG
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    Post subject:
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: 1703
Location: Australia

PostPosted: Tue Feb 10, 2009 9:28 am    Post subject:
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

Site Director


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

PostPosted: Tue Feb 10, 2009 10:04 am    Post subject:
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    Post subject: Reply to: Query in GDG to delete the first 199 versions
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: 1703
Location: Australia

PostPosted: Tue Feb 10, 2009 1:56 pm    Post subject:
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    Post subject: Reply to: Query in GDG to delete the first 199 versions
Reply with quote

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

Senior Member


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

PostPosted: Tue Feb 10, 2009 4:30 pm    Post subject:
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: 785
Location: Chennai, India

PostPosted: Tue Feb 10, 2009 4:43 pm    Post subject:
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

Senior Member


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

PostPosted: Tue Feb 10, 2009 5:06 pm    Post subject:
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: 785
Location: Chennai, India

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

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

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Feb 10, 2009 5:16 pm    Post subject:
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

Senior Member


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

PostPosted: Tue Feb 10, 2009 5:36 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts JCL to delete component in a package sundaram.naveen Compuware & Other Tools 14 Tue Nov 29, 2016 6:21 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us