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
 

 

Searching GDG using REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
prodigy

New User


Joined: 15 May 2006
Posts: 28

PostPosted: Thu Mar 15, 2007 11:30 am    Post subject: Searching GDG using REXX
Reply with quote

Is there any way to search for a particluar value inside each GDG versions starting from the latest version?

for ex:
i have a GDG say XXX.YYY.ZZZ as base. This GDG is having versions starting from

XXX.YYY.ZZZ.V01 to XXX.YYY.ZZZ.V22.

The Rexx should start the search from V22 to V01 for a value i give as input and stop if any match occurs.

Please somebody help me out.
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 Mar 15, 2007 1:43 pm    Post subject: Re: Searching GDG using REXX
Reply with quote

Think that the default processing when a gdg base is defined as an input DD is last to first.

Have you tried it ?
Back to top
View user's profile Send private message
diwa_thilak

Active User


Joined: 13 Jul 2006
Posts: 205
Location: At my desk

PostPosted: Thu Mar 15, 2007 2:48 pm    Post subject:
Reply with quote

Hi prodigy,

May be the below code will give you some idea.

Code:
$DSN = "TTT.YYY.ZZZ"                             
 $SKU = <your value to be searched>
                                                             
 /*-- LIST ALL GDG ENTRIES FOR THIS DATASET.  --*/           
 Q = OUTTRAP(DATA.)                                         
 "LISTC ENT('"||$DSN||"')"                                   
 Q = OUTTRAP(OFF)                                           
                                                             
 /*-- DETERMINE THE CURRENT GDG DATASET NAME --*/           
 $REC = DATA.0 -1                                           
 PARSE VAR DATA.$REC . . $NAME                               
 SAY 'NAME==>' $NAME

This one will list the latest version of the GDG. From here you have to write search routine to search the GDG and traverse back till first.

If you have any queries rever back to me.

---------------------------
Diwakar
-----------------------------------

Nobody is perfect . I am Nobody
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Thu Mar 15, 2007 6:13 pm    Post subject: Re: Searching GDG using REXX
Reply with quote

Here is some REXX code. GDGSET should be equal to the GDG base. GDGDSN that is produced at the end will be the most current version of the GDG.

Code:

/* THIS IS USED TO FIND A GDG VERSION */                             
GDG_LEVEL = 0                                                       
GDGSET = "PUT.GDG.BASE.FILE.HERE"                                     
X = OUTTRAP('LISTCAT.')                                             
"LISTCAT LEVEL('"GDGSET"')"                                         
X = OUTTRAP('OFF')                                                   
WORK_LEVEL = 1                                                       
GDGDSN = ""                                                         
DO SUBSCRIPT = LISTCAT.0 - 1 BY -2,                                 
   UNTIL SUBSCRIPT  <  1  |  GDGDSN  <>  ""                         
IF POS("NONVSAM ------- ",LISTCAT.SUBSCRIPT)  >  0  THEN DO         
    PARSE VAR LISTCAT.SUBSCRIPT "NONVSAM ------- " CATDSN " " .     
    CATREV = REVERSE(CATDSN)                                         
    PARSE VAR CATREV  LASTNODE "." GDG_BASE                         
    LASTNODE = REVERSE(LASTNODE)                                     
    GDG_BASE = REVERSE(GDG_BASE)                                     
    PARSE VAR LASTNODE 1 LASTNODE_POS1 2 GEN 6 LASTNODE_POS6 7 LVL   
    IF LASTNODE_POS1 = "G"  &  LASTNODE_POS6 = "V"  THEN DO         
        IF GDG_LEVEL = '+1' THEN DO 
        GEN = GEN + 1                                           
        GEN = RIGHT(GEN,4,"0")                                 
        GDGDSN = GDG_BASE".G"GEN"V"LVL                         
    END                                                         
    ELSE DO                                                     
        WORK_LEVEL = WORK_LEVEL - 1                             
        IF WORK_LEVEL  =  GDG_LEVEL  THEN GDGDSN = CATDSN       
    END                                                         
    END                                                         
    END                                                         
    END                                                         
DATASET = GDGDSN                                               
                               
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 Mar 15, 2007 6:47 pm    Post subject:
Reply with quote

As I have pointed out above, using the GDG base will process the entries from last to first.

You DO NOT need to know the absolute generation numbers to process the gdg in this manner.

Please feel free to try this yourselves.

Code:

//MYREXX   EXEC PGM=IKJEFT01,PARM='execname'
//SYSEXEC  DD DSN=where.my.rexx.lives,DISP=SHR
//GDGIN    DD gdg.base.name,DISP=SHR
//SYSTSIN  DD DUMMY
//SYSTSPRT  DD SYSOUT=*
Back to top
View user's profile Send private message
prodigy

New User


Joined: 15 May 2006
Posts: 28

PostPosted: Thu Mar 22, 2007 9:59 pm    Post subject: Re: Searching GDG using REXX
Reply with quote

Thanks ppl. i will try out and revert back if needed... thx a lot
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 REXX cdoe to purge a JOB from spool a... Sulabh Agrawal CLIST & REXX 11 Thu Mar 09, 2017 11:36 am
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm
No new posts REXX compiled via RXTCOMP sergeyken CLIST & REXX 7 Tue Feb 07, 2017 9:41 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm


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