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
 

 

BPXWDYN to get the current generation of s GDG

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 189
Location: INDIA

PostPosted: Fri Aug 31, 2012 9:01 pm    Post subject: BPXWDYN to get the current generation of s GDG
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: 1746
Location: Bloomington, IL

PostPosted: Fri Aug 31, 2012 9:07 pm    Post subject:
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

Moderator Team Head


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

PostPosted: Fri Aug 31, 2012 9:36 pm    Post subject: Reply to: BPXWDYN to get the current generation of s GDG
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm
No new posts alphanumeric sequence generation sivaprasad.gadhi COBOL Programming 6 Wed Mar 30, 2016 3:03 am
No new posts alphanumeric sequence generation sivaprasad.gadhi DFSORT/ICETOOL 8 Mon Mar 21, 2016 1:09 am
No new posts Retrieve current year or month using ... vnktrrd DFSORT/ICETOOL 15 Tue Mar 15, 2016 4:14 pm


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