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

Relative version to Absolute version


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
op

New User


Joined: 31 Oct 2006
Posts: 48
Location: Chennai

PostPosted: Thu Oct 22, 2009 4:18 pm
Reply with quote

Hello,

I need to find the absolute GDG name when given the relative GDG name.
Is this possible by REXX?

If yes, can you please provide me the syntax for that.

Thanks,
OP
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Oct 22, 2009 4:20 pm
Reply with quote

op wrote:
If yes, can you please provide me the syntax for that.

Yes it is possible using REXX.
What have you tried so far and what problems have you encountered.
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Thu Oct 22, 2009 5:08 pm
Reply with quote

There is a TSO command LISTCAT that will give you what you want.
Back to top
View user's profile Send private message
op

New User


Joined: 31 Oct 2006
Posts: 48
Location: Chennai

PostPosted: Thu Oct 22, 2009 6:38 pm
Reply with quote

I was trying to do this using LISTDSI.
But thanks for the hint. I used LISTCAT and it did work.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Oct 22, 2009 6:49 pm
Reply with quote

search the manuals for bpxwdyn
or google for Doug Nadel realname rexx function
( in a good mood I searched for You )
www.sillysot.com/mvs/
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Oct 22, 2009 7:15 pm
Reply with quote

The post subject, by the way, is wrong -- there is no relative version nor absolute version concept in a GDG. There is a relative generation and absolute generation, but versions are not generations. The terms version and generation mean very different things for a GDG, they are both valid terms, and you can really confuse issues by mixing up the two concepts.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Sat Oct 24, 2009 3:03 pm
Reply with quote

op wrote:
I was trying to do this using LISTDSI.
But thanks for the hint. I used LISTCAT and it did work.

Post your code and I will post mine that does the same thing so
a) It may help others with the same requirement
b) Allow you to see how others do the same thing which may teach you or others new tricks.
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Sat Oct 24, 2009 8:53 pm
Reply with quote

The easiest way to do this is to allocate generation using BPXWDYN (search for that) and use the RTDSN() parameter to get the real name as shown in this post. Don't forget to free the file after you allocate it.

This technique assumes that you can allocate it and no one else has it disp=old. If that is not going to be true, you'll have to do something else, like using a program that does a LOCATE macro as suggested by Enrico or some ISPF service. As a last resort, you could use that awful technique of parsing LISTCAT output. Awful because LISTCAT (and most other commands) output is not guaranteed to remain the same and IBM recommends that you don't parse LISTCAT output.
Back to top
View user's profile Send private message
op

New User


Joined: 31 Oct 2006
Posts: 48
Location: Chennai

PostPosted: Thu Nov 19, 2009 4:09 am
Reply with quote

Hello Expat,

Sorry for the late reponse, I was gone from work for some days.

The code using LISTCAT (Forgive me if this is a stupid way of coding, I was made to code this in a single day):

Code:
X = OUTTRAP("LISTC.")                     
"LISTCAT ENTRIES('"STRIP(CHKPDS1)"') NAME"
X = OUTTRAP("OFF")                       
                                         
DO AA = 1 TO LISTC.0                     
  IF WORD(LISTC.AA,1) = "NONVSAM" THEN DO
    RELNAME = WORD(LISTC.AA,3)           
  END                                     
END                                       


But, your suggestion is most welcome.

Thanks,
OP
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Nov 19, 2009 12:48 pm
Reply with quote

This has been set up to run in batch, and to deal with a single request. To make it a terminal based execution and/or multiple requests should be easy enough.

The JCL -
Your REXX library - You need to put in the library where you saved the REXX code
Member - The member name where you saved the REXX code
GDG-Base - The GDG base that you want to interrogate
Lvl - The level you want -n, 0, +n
Code:
/STEP0020 EXEC PGM=IKJEFT01,PARM='Member GDG-Base Lvl' 
/SYSEXEC  DD DSN=Your REXX library,DISP=SHR                             
/SYSOUT   DD SYSOUT=*
/SYSTSPRT DD SYSOUT=*
/SYSTSIN  DD DUMMY


The REXX code
Code:
/* REXX *** FIND ABSOLUTE GENERATION FROM RELATIVE GENERATION        *
ARG GBASE RGEN .
G = 0                                       
X=OUTTRAP(LIST.)                                 
" LISTC ENT('"STRIP(GBASE)"')"                           
RCX = RC                                       
X=OUTTRAP(OFF)                                                       
IF RCX = 4 THEN DO                                                   
  SAY "GDG BASE DOES NOT EXIST"                                       
  EXIT 16                                                             
END                                                                   
DO A = 1 TO LIST.0                                                   
  PARSE VAR LIST.A W1 W2 W3                                           
  IF W1 = "NONVSAM" THEN DO                                           
    G = G + 1                                                         
    GDS.G = W3                                                       
  END                                                                 
END                                                                   
GDS.0 = G                                                             
IF RGEN = 0                                                           
   THEN REQGEN = 0                                               
   ELSE REQGEN = RGEN * -1                                       
IF REQGEN > GDS.0 | (GDS.0 = 0 & LEFT(RGEN,1) <> "+") THEN DO     
  SAY "RELATIVE GENERATION "GBASE RGEN" DOES NOT EXIST"           
  SAY "EXIT RETURN CODE 16"                                       
  EXIT 16                                                         
END                                                               
IF LEFT(RGEN,1) = '-' | LEFT(RGEN,1) = '0' THEN DO               
  REQGEN = GDS.0 + RGEN                                           
  INTERPRET "ABSVAL = GDS."REQGEN                                 
  SAY "ABSOLUTE GENERATION FOR "RGEN" IS "ABSVAL                 
END                                                               
ELSE DO                                                           
  IF GDS.0 <> 0                                                   
     THEN INTERPRET "DSN = GDS."GDS.0                             
     ELSE DSN = STRIP(GBASE)||".G0000V00"                         
  VX = LENGTH(STRIP(DSN)) - 6                                     
  NG = STRIP(OVERLAY(RIGHT(RGEN+SUBSTR(DSN,VX,4),4,'0'),DSN,VX,4))
  SAY "ABSOLUTE GENERATION FOR "RGEN" IS "NG                     
END
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts How to copy the -1 version of a membe... TSO/ISPF 4
No new posts Copying GDG version(all/few) from pro... CLIST & REXX 13
No new posts XMITIP Latest Version JCL & VSAM 2
No new posts How to determine TLS/SSL version in m... TSO/ISPF 2
Search our Forums:

Back to Top