Page 1 of 1

searching a string in members of a pds via rexx

Posted: Tue Sep 06, 2011 4:59 pm
by sagar
Hi..I am new to the forum.Can anyone guide me to get a code in rexx that would search for a string in members of a pds and write the results (not the member name but the line where it occured along with member name) in a seperate ps.

Posted: Tue Sep 06, 2011 5:48 pm
by dbzTHEdinosauer
look in the rexx reference for the example ISRMBRS macro.

you need to 'PUT' your target (search string) to the variable pool,
then you MACRO (see isrmbrs) can 'GET' the string and perform FINDs.
each find will provide you with the line number (isredit edit macro LINENUM)
and the isredit edit macro member will tell you the member name.

REXX Reference
EDIT and EDIT MACROS

Posted: Tue Sep 06, 2011 6:06 pm
by sagar
Thnx dbz for replying.But I want to do a srchfor operation in rexx for a string in members of a pds.It would be good if I am able to do so.This MACRO isnt that clear to me.I mean I wasnt able to comprehend this macro and your idea of putting and getting that well.

Posted: Tue Sep 06, 2011 6:58 pm
by dbzTHEdinosauer
then invoke superc with your rexx scripts after allocating the files necessary,
then parse the ouptut.

and yes, it will probably take more that 12 minutes to understand the concepts of invoking a pds member in VIEW with an initial edit macro.
the only advantage to learning this is then you could use it when you wanted to make global changes to a PDS and the other utilities are not built for the task.
i.e. replacing one or more lines with more than one line.

sorry about the get and put, should have been VGET and VPUT which are explained here.

short of actually exerting any effort on your part,
you could submit (or interactive) a search, using the parm IDPFX, which will print the member name on the left side of each hit displayed.

Code: Select all

  ISRSUPC   -   MVS/PDF FILE/L
 MEMBER   LINE-#  SOURCE LINE
that way you have all the info you need in the superc output.

Posted: Tue Sep 06, 2011 7:29 pm
by sagar
Any help on coding searchfor operation in rexx for searching a string in members of a pds and then storing the results?

Posted: Tue Sep 06, 2011 7:45 pm
by dbzTHEdinosauer
then invoke superc with your rexx scripts after allocating the files necessary,
then parse the ouptut.

try google.

Posted: Mon Jan 30, 2012 2:33 pm
by kiran.vits
Hi Sagar,

I hope the following way wil give solution ( if i untersatnd correctly)

1. Provide PDS name and Search string
2. Using ListDS command get all the members under that PDS.
3. Read each meber data using EXECIO read operation.
4. search for the word in the line.
5. If finds , write the line content and the PDS member name in a PS file.

Hope this is useful... :)