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

how to code for GDG in Rexx


IBM Mainframe Forums -> CLIST & REXX
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
cvnlynn

New User


Joined: 14 Jun 2017
Posts: 31
Location: US

PostPosted: Wed Aug 09, 2017 9:13 pm
Reply with quote

Hi,
please tell me how to code a variable to refer to latest GDG file (ie ...G022V00) in Rexx. My Rexx exec submits the skeleton that have GDG file. Thanks.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2145
Location: USA

PostPosted: Wed Aug 09, 2017 10:06 pm
Reply with quote

1) No-one except yourself would be able to understand your requirements as described.
2) At this forum people usually help others in solving the encountered problems, but not in doing your job from scratch instead of you.

First of all: try to do something yourself, and then show us what exactly is not working properly? At least demonstrate the code itself: where you need to incorporate the GDG version?
Back to top
View user's profile Send private message
cvnlynn

New User


Joined: 14 Jun 2017
Posts: 31
Location: US

PostPosted: Wed Aug 09, 2017 10:46 pm
Reply with quote

Code:
DSNAME1 = TRANSLATE(,       
          ENVPREF  || '.' ||,
          ENVSYST1 || '.' ||,
          ENVPROG1 || '.' ||,
          ENVIRON  || '.' ||,
         'FR8DET'  || '.' ||,

I used TRANSLATE to setup the dataset name, how do I code for the last part of the dataset name which is GDG version (ie GxxxV00). Thanks.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Wed Aug 09, 2017 10:51 pm
Reply with quote

BPXWDYN invoked with the proper parameters will return the REALNAME of a gdg generation
casually the snippet posted returns the real name for generation 0
BPXWDYN can/will return the real name of ane generation number


Code:
 ****** ***************************** Top of Data ******************************
 - - -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  <some> 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
 - - -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - <some>  Line(s) not Displayed
 ****** **************************** Bottom of Data ****************************


the result

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

Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2145
Location: USA

PostPosted: Wed Aug 09, 2017 11:09 pm
Reply with quote

There was a similar topic back in 2005
Back to top
View user's profile Send private message
cvnlynn

New User


Joined: 14 Jun 2017
Posts: 31
Location: US

PostPosted: Thu Aug 10, 2017 12:04 am
Reply with quote

Thanks everyone.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Thu Aug 10, 2017 5:42 am
Reply with quote

And you have not come back about some of your other queries - are they resolved, if so how?
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Thu Aug 10, 2017 8:46 am
Reply with quote

Unless you really know what you're doing, you're better off staying away from GDGs in the TSO (or FTP server, for that matter) environment.

Prime example: Mr. Sorichetti's example. It's fine, as far as it goes. But: once the BPXWDYN goes through, the TSO session effectively "owns" the GDG base: no other job or TSO session can use it until the TSO session terminates.
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 734
Location: Denmark

PostPosted: Thu Aug 10, 2017 3:44 pm
Reply with quote

Quote:
once the BPXWDYN goes through, the TSO session effectively "owns" the GDG base: no other job or TSO session can use it until the TSO session terminates.

is not quite accurate. The limitation seems to be that you cannot create a new generation till the allocation is FREEd. You don't have to logoff.

You can use BPXWDYN to obtain the latest generation like this:
Code:
 cc=bpxwdyn('alloc dd(gdg0) da(z.test.gdg(0)) shr reuse')
 cc=bpxwdyn('info dd(gdg0) inrtdsn(ds)')                   
 cc=bpxwdyn('free dd(gdg0)')                               
 lq=substr(ds,lastpos('.',ds)+1)                           
 say lq

However, the OP says that he is submitting a skeleton, which I take to mean JCL, so I wonder why he isn't just using the relative generation in the datasetname in the JCL like DS.NAME(0) ?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2145
Location: USA

PostPosted: Thu Aug 10, 2017 7:49 pm
Reply with quote

The original question was "how to get the latest GDG DSNAME" (out of those already existed by that time!).
Besides of the problem with ENQueuing DSNAME, the BPXWDYN solution will allocate the new version of GDG. It's not clear from the topic starter: is that what is needed?
For instance, if we inquired about the latest GDG via BPXWDYN 100 times then we would loose all previously prepared GDG datasets, and create 100 empty datasets instead!
Back to top
View user's profile Send private message
don.leahy

Active Member


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

PostPosted: Thu Aug 10, 2017 8:38 pm
Reply with quote

steve-myers wrote:
Unless you really know what you're doing, you're better off staying away from GDGs in the TSO (or FTP server, for that matter) environment.

Prime example: Mr. Sorichetti's example. It's fine, as far as it goes. But: once the BPXWDYN goes through, the TSO session effectively "owns" the GDG base: no other job or TSO session can use it until the TSO session terminates.

Unless you use the GDGNT parameter. See ibmmainframes.com/viewtopic.php?t=24474&start=0&postdays=0&postorder=asc&highlight=gdgnt
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 734
Location: Denmark

PostPosted: Fri Aug 11, 2017 12:50 am
Reply with quote

Quote:
if we inquired about the latest GDG via BPXWDYN 100 times then we would loose all previously prepared GDG datasets, and create 100 empty datasets instead

I beg to differ. BPXWDYN INFO will not create a new dataset.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2145
Location: USA

PostPosted: Fri Aug 11, 2017 2:02 am
Reply with quote

Willy Jensen wrote:
Quote:
if we inquired about the latest GDG via BPXWDYN 100 times then we would loose all previously prepared GDG datasets, and create 100 empty datasets instead

I beg to differ. BPXWDYN INFO will not create a new dataset.

All previous recommendations only suggested to BPXWDYN ALLOCATE the new DSN...
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Fri Aug 11, 2017 2:20 am
Reply with quote

topic locked
the TS posted
Quote:
Thanks everyone.


the posts after that one are just a waste of resources
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts purge jobs with return code 0 and ret... JCL & VSAM 4
No new posts Run rexx with JCL Job CLIST & REXX 1
No new posts Run rexx in batch job CLIST & REXX 7
No new posts Does anyone know rexx for VSE CLIST & REXX 3
No new posts TSO ALLOC In REXX Needs Improvement JCL & VSAM 3
Search our Forums:

Back to Top