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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find a value in a GDG

Status
Not open for further replies.

rickvbvb

Programmer
Jan 20, 2004
2
US
Hello all,

I am starting simple...I have a file which is a member of a GDG index. It looks like it was the destination of a formatted report -- the data is formatted nicely. It is obviously a flat file.

I have a value that is input from the terminal operator, that I want to find in one of the columns using REXX.

Thanks for your help!
Rick
 
Investigate POS and WORDPOS in your REXX manual. You may also need PARSE if you will want to extract related data.


Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
Thanks for the info, Frank.

Pardon my ignorance, but can you point me in the right direction about how to get information out of the GDG? At any one point in time when the REXX executes, I don't know which index member is the (0) version, and I would want to find that in the REXX Exec. Nor do I know the steps necessary to read a record out of the file, or to just search for the string in the file, as I would in ISPF using a FIND.

I wish I had the time to RTFM from cover to cover...and the FINE manual I do have has no real examples!

Thanks again,
Rick
 
OK. Pop on over to and get a copy of the code there. This is callable as a subroutine, or you can just hijack the technique. Now you know the full dataset name of the current generation.

Several of the routines on illustrate the use of EXECIO which you can use to read and write the contents of the dataset. SPACERPT might be a good one.

PARSE is almost a language in itself, but it's very easy to get it to work even if it works klunky. When you develop fluency with PARSE you can do nearly anything.

Trace your test runs and watch how your code actually operates. This is the second-best teaching method for REXX.


Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
What about this version:

/* REXX */
/* */
/* BROWSE 'PROD.HRS.HRS305W.XHRISS(0)' */
/* */

$DSN = "PROD.HRS.HRS305W.XHRISS"

/*-- 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


I've used this for years and it seems to get me the (0) version of the GDG dataset name just fine.

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top