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
 

 

Relative version to Absolute version

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: Relative version to Absolute version
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: 8593
Location: Back in jolly old England

PostPosted: Thu Oct 22, 2009 4:20 pm    Post subject: Re: Relative version to Absolute version
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

Moderator Team Head


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

PostPosted: Thu Oct 22, 2009 5:08 pm    Post subject: Reply to: Relative version to Absolute version
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    Post subject: Reply to: Relative version to Absolute version
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Thu Oct 22, 2009 6:49 pm    Post subject: Reply to: Relative version to Absolute version
Reply with quote

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

Global Moderator


Joined: 06 Jun 2008
Posts: 8055
Location: East Dubuque, Illinois, USA

PostPosted: Thu Oct 22, 2009 7:15 pm    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Sat Oct 24, 2009 3:03 pm    Post subject: Re: Reply to: Relative version to Absolute version
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: 401
Location: Mumbai

PostPosted: Sat Oct 24, 2009 8:53 pm    Post subject:
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    Post subject: Reply to: Relative version to Absolute version
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: 8593
Location: Back in jolly old England

PostPosted: Thu Nov 19, 2009 12:48 pm    Post subject:
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    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 GDG version number PANDU1 JCL & VSAM 4 Sat Mar 04, 2017 8:28 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 15 Tue Nov 01, 2016 11:24 am
No new posts Is there a time Version of DATEDIFF ? Bill Woodger DFSORT/ICETOOL 1 Wed Aug 17, 2016 7:06 pm
No new posts Syncsort version supporting FINDREP c... juares castro SYNCSORT 9 Tue Aug 09, 2016 6:54 pm
No new posts Faccing issues while creating a GDG V... sravindra_s JCL & VSAM 5 Thu Jun 23, 2016 11:26 am


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