Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REXX GDG outtrap loop 1

Status
Not open for further replies.

ratso

Programmer
Nov 5, 2002
3
GB
Also, is there a better way of pulling in a gdg family using the base than outtrapping (and stripping out extraneous data) the output from listcat;
such as ;
GETDATA = OUTTRAP("RAWOUT.","*")
"LISTCAT ENTRIES("INDSN")" /* where indsn = base gdg */
STOPGETDATA = OUTTRAP('OFF')
IF WORD(RAWOUT.1,1) <> &quot;GDG&quot; THEN DO
SAY 'NOT GDG BASE'
EXIT
END
GDGLISTINDEX = 0
DO LOOP = 1 TO RAWOUT.0
IF WORD(RAWOUT.LOOP,1) <> &quot;NONVSAM&quot; THEN ITERATE
GDGLISTINDEX = GDGLISTINDEX + 1
GDGLIST.GDGLISTINDEX = WORD(RAWOUT.LOOP,3)
/*SAY GDGLIST.GDGLISTINDEX*/
END
GDGLIST.0=GDGLISTINDEX
/*SAY 'GDGLISTINDEX=' GDGLISTINDEX*/
/*SAY GDGLIST.0*/
 
As luck would have it, I have just had to do the very same thing myself. I needed to convert a relative generation number (eg. -1) to the actual dataset name and I used a similar method (outtrapping a LISTC). That was all I could come up with off the top of my head, but it works really well and pretty quickly too.

The only other option I could think of was to write my own REXX command (and filling STEM variavbles) to do it and that seemed like a lot of hard work for little gain.
 
If you're going to use the datasets in JCL just reference the basename without a generation specification. That allows you to read ALL generations LIFO.

If you need them in a different order or you need fewer than all generations, LISTA to an outtrap etc....
 
This will give the next generation nbr for any root - ( base)

NEXTGEN: PROCEDURE
PARSE ARG ROOT
LAST = 0;
CALL OUTTRAP 'LINES.' ,, 'NOCONCAT';
ADDRESS TSO &quot;LISTCAT LEVEL(&quot;||ROOT||&quot;)&quot;;

DO I = 1 TO LINES.0
PARSE VAR LINES.I '-- ' JUNK '.G0' NBR 'V00' ;
IF (NBR > '') & (NBR > LAST) & (JUNK = ROOT)
THEN LAST = NBR ;
END;

RETURN ROOT'.G'RIGHT(LAST + 1, 4, '0')'V00';
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top