View previous topic :: View next topic
|
Author |
Message |
prodigy
New User
Joined: 15 May 2006 Posts: 28
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
|
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
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 |
|
|
cpuhawg
Active User
Joined: 14 Jun 2006 Posts: 331 Location: Jacksonville, FL
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
|
prodigy
New User
Joined: 15 May 2006 Posts: 28
|
|
|
|
Thanks ppl. i will try out and revert back if needed... thx a lot |
|
Back to top |
|
|
|