Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
This topic is locked: you cannot edit posts or make replies. Rexx to execute spool commands upendrasri CLIST & REXX 5 Wed Oct 04, 2017 6:54 am
This topic is locked: you cannot edit posts or make replies. Rexx to execute spool commands upendrasri CLIST & REXX 47 Fri Sep 29, 2017 1:08 pm
No new posts ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us