View previous topic :: View next topic
|
Author |
Message |
S0C7
New User
Joined: 19 May 2006 Posts: 26
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10879 Location: italy
|
|
|
|
BPXWDYN |
|
Back to top |
|
|
Pete Wilson
Active Member
Joined: 31 Dec 2009 Posts: 585 Location: London
|
|
|
|
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 |
|
|
Ed Goodman
Active Member
Joined: 08 Jun 2011 Posts: 556 Location: USA
|
|
|
|
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 |
|
|
Pete Wilson
Active Member
Joined: 31 Dec 2009 Posts: 585 Location: London
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10879 Location: italy
|
|
|
|
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 |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
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. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10879 Location: italy
|
|
|
|
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 |
|
|
Ed Goodman
Active Member
Joined: 08 Jun 2011 Posts: 556 Location: USA
|
|
|
|
Now that I've seen how it works...I'll switch to BPXWDYN. |
|
Back to top |
|
|
|