searching a string in members of a pds via rexx

Ask/Clarify the questions on TSO, CLIST & REXX

Moderators: Veera, Moderator Group

Post Reply
User avatar
sagar
Member
Posts: 3
Joined: Tue Sep 06, 2011 2:59 pm

searching a string in members of a pds via rexx

Post by sagar » Tue Sep 06, 2011 4:59 pm

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.

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Tue Sep 06, 2011 5:48 pm

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
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

User avatar
sagar
Member
Posts: 3
Joined: Tue Sep 06, 2011 2:59 pm

Post by sagar » Tue Sep 06, 2011 6:06 pm

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.

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Tue Sep 06, 2011 6:58 pm

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.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

User avatar
sagar
Member
Posts: 3
Joined: Tue Sep 06, 2011 2:59 pm

Post by sagar » Tue Sep 06, 2011 7:29 pm

Any help on coding searchfor operation in rexx for searching a string in members of a pds and then storing the results?

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Tue Sep 06, 2011 7:45 pm

then invoke superc with your rexx scripts after allocating the files necessary,
then parse the ouptut.

try google.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

kiran.vits
Member
Posts: 8
Joined: Wed Jan 25, 2012 6:55 pm

Post by kiran.vits » Mon Jan 30, 2012 2:33 pm

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... :)
Gaining Knowledge

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others