View previous topic :: View next topic |
Author |
Message |
Mukunda Beginner
Joined: 11 Dec 2002 Posts: 46 Topics: 15
|
Posted: Fri Apr 30, 2004 5:27 pm Post subject: Can I create a +1 version (relative #) of GDG with Rexx? |
|
|
When I tried allocating a fresh GDG version with relative number (+1), it did not seem to work. So I tried with absolute number, MY.DATASET.GnnnnVnn - and it worked.
For getting absolute number, I'm doing a LISTCAT on GDG and trapping its output. Then I'm manipulating the version number for new version from the latest version.
Is there a simpler method?
The problem I'm having here is, whenever nothing is written into the new version dataset just created (say G0002V00), LISTCAT tends to ignore it.
So when the Rexx routine is invoked the next time, it tries to allocate G0002V00 again and fails. |
|
Back to top |
|
|
superk Advanced
Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Sat May 01, 2004 12:10 am Post subject: |
|
|
Seems like you're doing pretty much all you can within the confines of the TSO environment.
I have to test the second part of your message - doesn't sound right, but maybe there's somehing about LISTCAT. |
|
Back to top |
|
|
Mukunda Beginner
Joined: 11 Dec 2002 Posts: 46 Topics: 15
|
Posted: Mon May 03, 2004 8:20 am Post subject: |
|
|
Thanks Superk.
Here is the piece of code that I'm using. It assumes that first version of GDG is already exists.
Code: | /* REXX*/
trace r
gdg_name = 'MY.GDG.BASE'
Call outtrap dslist.
address "TSO"
"listcat ent('"gdg_name"') all"
Call Get_gdg_ver
/* Allocate +1 version of the GDG */
If rc=0 Then do
/* Display the full name of +1 version */
say 'new_dataset ' new_dataset
/* Call routine to allocate +1 version */
Call Alloc_new_Gdgver
end
exit 1
Get_gdg_ver:
/* This routine gets the +1 - GOOVOO version for the GDG base*/
/* Read the trapped output of LISTCAT backwards*/
Do l = dslist.0 To 1 by -1
/* If you hit verbiage NONVSAM ---- as 12 bytes from POS 4, do process */
if substr(dslist.l,4,12) = 'NONVSAM ----' Then do
/* Extract the GOOOVOO portion of the latest version*/
gdggen = substr(dslist.l,40,4)
/* If you hit 255 as version number, start from G0001 */
if gdggen = '0255' then gdggen = '0001'
else gdggen = gdggen + 1
/* If you do not hit the GDG max limit then continue*/
length_ver = length(gdggen)
/* Make the number (n) to fit Gnnnn format by concatenating zeroes*/
if length_ver = 1 Then gdggen = '000'||gdggen
if length_ver = 2 Then gdggen = '00'||gdggen
if length_ver = 3 Then gdggen = '0'||gdggen
GOOVOO = 'G'||gdggen||'V00'
GOOVOO = strip(GOOVOO)
/* Make the dataset name GDG base name + GnnnnVnn */
new_dataset = gdg_name||'.'||GOOVOO
new_dataset = strip(new_dataset)
return
End
End
Alloc_new_Gdgver :
/* Routine to allocate +1 version of GDG */
Address TSO
"ALLOC F(SYSREC00) NEW UNIT(SYSDA) SPACE(8,2) RECFM(F B) LRECL(80)",
"TRACKS REUSE DSNAME('"new_dataset"')"
Return |
|
|
Back to top |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 700 Topics: 63 Location: USA
|
Posted: Tue May 04, 2004 12:53 am Post subject: |
|
|
Mukunda,
Probably I would have done the same way as you did, but it's very easy to find flaw in somebody else's code. I don't know if these relate to your problem but I will put some observation -
1: The strip commands look unnecessary, there is nothing to strip from any end.
2: gdggen will always have length 4, unless you strip it. So concatenating with zeroes will not happen. What you can do use - Code: | gdggen = substr(dslist.l,40,4,'0') |
3: GnnnnVnn would be more meaningful then GOOVOO.
Regards |
|
Back to top |
|
|
Mukunda Beginner
Joined: 11 Dec 2002 Posts: 46 Topics: 15
|
Posted: Tue May 04, 2004 8:45 am Post subject: |
|
|
Dibakar
Thanks for your suggestions. But this still does not solve my problem. Whenever I dont write anything on to the GDG version just created, the REXX fails when it is invoked next time. In other words, if I dont write anything to +1 (say G0003V00), next run would not create +2. It tries to create +1 (G0003V00) again and fails. Any idea on how to handle this one? |
|
Back to top |
|
|
superk Advanced
Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Tue May 04, 2004 8:54 am Post subject: |
|
|
When you allocate the new generation with this code:
ALLOC F(SYSREC00) NEW ....
I noticed that you never issue a FREE command, such as:
FREE F(SYSREC00)
The file needs to be freed before the LISTCAT command can see it, which is why it takes two cycles before the next generation is allocated. |
|
Back to top |
|
|
Mukunda Beginner
Joined: 11 Dec 2002 Posts: 46 Topics: 15
|
Posted: Tue May 04, 2004 12:10 pm Post subject: |
|
|
superk
That would solve the problem. Thanks. |
|
Back to top |
|
|
|
|