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

BPXWDYN to get the current generation of s GDG


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Fri Aug 31, 2012 9:01 pm
Reply with quote

Hi,

I am using below rexx piece of code to get the current generation of a GDG.

BPXWDYN("ALLOC DSN('"gdg"') SHR REUSE",
"RTDSN(thedsn)")

'thedsn' should have the fully qualified GDG along with the corresponding generation.

I did the below experiment which is not returning proper result.

1.The current generation of my gdg is '1'. When I executed that piece of code it is successfully retrieving the gdg.g0001v00.

2.Now executed a batch job that creates a new generation of the above GDG. The job ended successfully. so now the current generation is g0002v00.

3. Now I have executed the above code, but it is returning g0001v00. I have logged of my complete TSO session and relogged in. Then it is working properly.


Can someone please correct me if I am doing something wrong?
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri Aug 31, 2012 9:07 pm
Reply with quote

Realize that a TSO session is effectively a job. Then you will see that what is happening is entirely expected.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Aug 31, 2012 9:36 pm
Reply with quote

This is from a similar topic and does work:

don.leahy wrote:
I know this is an old topic, but I did a search for the GDGNT keyword and didn't find anything. So, here is my 2 cents:

An easy way around this is to add the "GDGNT" parameter to the ALLOC statement. This causes BPXWYDN to scan for the latest generation of the data set before determining the generation associated with (+1).

Code:
 do 5                                                                 
  x = BPXWDYN("ALLOC DD(XXX) DA('xxxx.aaaaaa.testGDG(+1)') " ,       
      "NEW SPACE(1,1)  RECFM(F,B) LRECL(80) DSORG(PS) CATALOG REUSE" ,
      "GDGNT")
 end                                                         
This fragment will create 5 generations of XXXX.AAAAAA.TESTGDG
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts Changeman - how can we know the curr... Compuware & Other Tools 2
No new posts Fetch data from programs execute (dat... DB2 3
No new posts DFHPI1008 JSON generation failed COBOL Programming 0
No new posts replace word 'MONTH' with current mon... SYNCSORT 11
Search our Forums:

Back to Top