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
 

 

Reading 0th Generation of GDG in REX

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

New User


Joined: 19 May 2006
Posts: 26

PostPosted: Sat May 31, 2014 3:29 am    Post subject: Reading 0th Generation of GDG in REX
Reply with quote

Hi,

I have the below code in my REXX which works fine if I hard code the generation of the GDG. But I need to read the 0th generation of the GDG in my REXX.

So when I have my code as below, it works fine:
Code:

ADDRESS TSO
"ALLOC FI(Flfi) DSN('MYGDG.GDG1.G0001V00') SHR REU"
"EXECIO 10 DISKR Flfi 100 (STEM rec1. FINIS"
"Free FI(Flfi)

But When IU use the below it fails.
Code:

ADDRESS TSO
"ALLOC FI(Flfi) DSN('MYGDG.GDG1(0)') SHR REU"
"EXECIO 10 DISKR Flfi 100 (STEM rec1. FINIS"
"Free FI(Flfi)


The error I get is:
IKJ56709I INVALID DATA SET NAME, 'MYGDG.GDG1(0)'
IKJ56709I MISSING DATA SET NAME OR *+
IKJ56709I MISSING NAME OF DATA SET TO BE ALLOCATED
IRX0555E The input or output file FLFI is not allocated. It cannot be opened for I/O.
IRX0555E EXECIO error while trying to GET or PUT a record.
IKJ56247I FILE FLFI NOT FREED, IS NOT ALLOCATED


Can you please help me out here? How can I read in the 0th generation in my Rexx instead of using the hard-coded generation number.
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Sat May 31, 2014 4:18 am    Post subject: Reply to: Reading 0th Generation of GDG in REX
Reply with quote

BPXWDYN
Back to top
View user's profile Send private message
Pete Wilson

Active User


Joined: 31 Dec 2009
Posts: 437
Location: London

PostPosted: Mon Jun 09, 2014 4:33 pm    Post subject:
Reply with quote

You may need to call IDCAMS to get the latest generation. Check the creation dates to confirm which is the latest generation and also check the STATUS field indicates 'ACTIVE' to make sure it is a valid rolled-in generation as well.

Another way could be to specify it in the JCL if the REXX is running in Batch.
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Mon Jun 09, 2014 6:18 pm    Post subject:
Reply with quote

If you want to move into using ISPF routines, you can use something like:
"ISPEXEC LMDINIT LISTID(DSLIST) LEVEL(&QUAL)"

Where QUAL contains 'MYGDG.GDG1.G*'

Then, you walk the list to the end to get the current generation with something like:
DO WHILE RC=0
"ISPEXEC LMDLIST LISTID(&DSLIST)",
"DATASET(DSNVAR) OPTION(LIST) STATS(YES)"

This may be bad advice for several reasons, like needing ISPF in batch, or the complexity of the LMDLIST code. I like it because it handles it all inside the rexx.
Back to top
View user's profile Send private message
Pete Wilson

Active User


Joined: 31 Dec 2009
Posts: 437
Location: London

PostPosted: Mon Jun 09, 2014 6:34 pm    Post subject:
Reply with quote

I suggested the IDCAMS approach because of the issue of wrapping GDG numbers (going from G9999V00 to G0001V00) and also deferred or rolled-off GDG's which may have the highest number but are not the (0) generation. Checking the creation date along with the status field together mean you're going to have a lower risk of getting the wrong file.

Of course there's probably other query tools beside IDCAMS (FDREPORT for example, maybe Naviquest, or DCOLLECT) that would provide some or all of the same information.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon Jun 09, 2014 7:25 pm    Post subject: Reply to: Reading 0th Generation of GDG in REX
Reply with quote

again what is wrong using BPXWDYN ...

the snippet ...

Code:

 ****** ***************************** Top of Data ******************************
 - - -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  7 Line(s) not Displayed
 000008 /* Rexx  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 000009 Trace "O"
 000010 ddn  = "DDN"
 000011 gdg  = "ENRICO.TEST.GDG"
 000012 gen  = "0"
 000013 rtrc = BPXWDYN("ALLOC FI(DDN) DA('ENRICO.TEST.GDG("gen")')" ,
 000014                " SHR REUSE  RTDSN(RTDSN) ")
 000015
 000016 say "myrc " RTRC
 000017 say "realname" RTDSN
 000018 exit
 - - -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - 11 Line(s) not Displayed
 ****** **************************** Bottom of Data ****************************


the result
Code:

********************************* TOP OF DATA **********************************
myrc  0
realname ENRICO.TEST.GDG.G0003V00
******************************** BOTTOM OF DATA ********************************


why complicate things when a simpler solution is there ???

PS.
the snippet shows how to allocate and retrieve the REAL dsname
the RTDSN part can be dropped for a plain allocation
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 641
Location: Whitby, ON, Canada

PostPosted: Mon Jun 09, 2014 8:52 pm    Post subject:
Reply with quote

I'm with you Enrico. I've been using BPXWDYN exclusively for this task ever since I first learned about it.

IMO, all of those other tricks that we formerly used to obtain the absolute generation are obsolete. icon_cool.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon Jun 09, 2014 9:56 pm    Post subject: Reply to: Reading 0th Generation of GDG in REX
Reply with quote

Quote:
IMO, all of those other tricks that we formerly used to obtain the absolute generation are obsolete.


I used REALNAME by Doug Nadel

and/or FULLDSN the equivalent from GFS
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Tue Jun 10, 2014 7:12 pm    Post subject:
Reply with quote

Now that I've seen how it works...I'll switch to BPXWDYN.
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
No new posts Reading data from PS file and send it... rajatbagga All Other Mainframe Topics 18 Fri Sep 23, 2016 12:51 pm
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm
No new posts Reading selected volumes of a multi-v... RickBig JCL & VSAM 6 Wed Jul 13, 2016 7:26 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


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