Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to search a set of strings in PS file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
snpavithra

New User


Joined: 22 Sep 2006
Posts: 9

PostPosted: Fri Oct 06, 2006 5:27 pm    Post subject: How to search a set of strings in PS file
Reply with quote

CAN ANYBODY OF U CAN TELL ME HOW TO SEARCH A SET OF STRINGS (WHICH IS PRESENT IN A PS ) IN A LIST OF MEMBERS OF A PDS. I NEED TO PUT THE STRINGS WHICH ARE FOUND IN ANY ONE OF THE MEMBERS IN A PS...

I M NEW TO REXX PLS HELP
Back to top
View user's profile Send private message

Kevin

Active User


Joined: 25 Aug 2005
Posts: 234

PostPosted: Fri Oct 06, 2006 8:12 pm    Post subject: Re: CAN U PLS TEL ME HOW TO SEARCH A SET OF STRINGS...
Reply with quote

I'm a bit confused as to what you're trying to do here. Could you maybe provide the commands and/or code you've used up to this point, or maybe a little more details of the process. Usually, to search for strings in a dataset, multiple datasets, a PDS, or multiple PDS's, you use the SUPERC utility program (ISRSUPC).
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Sat Oct 07, 2006 2:20 am    Post subject: Re: How to search a set of strings in PS file
Reply with quote

If you have FILEAID in your shop, you can use:

Code:

//FILEAID EXEC PGM=FILEAID                         
//SYSPRINT DD  SYSOUT=*                             
//DD01     DD DISP=SHR,DSN=INPUT.PDS.HERE           
//SYSIN    DD  *                                   
$$DD01 LIST IF=(1,0,C'SEARCH-PARAMETER')                       


This JCL will search the input PDS file and look for SEARCH-PARAMETER in each member. When it gets a hit, it will print out the hit and indicate what member of the PDS it occurred in.

If you want to search for multiple items, you can code:


Code:

$$DD01 LIST IF=(1,0,C'ITEM1'),
          ORIF=(1,0,C'ITEM2'),
          ORIF=(1,0,C'ITEM3')


Back to top
View user's profile Send private message
snpavithra

New User


Joined: 22 Sep 2006
Posts: 9

PostPosted: Mon Oct 09, 2006 5:30 pm    Post subject:
Reply with quote

Code:

/*REXX*/
ADDRESS TSO
"ALLOC F(IN) DA('"U123451.PSFILE.IN"')SHR"
"ALLOC F(OUT) DA('"U123451.PSFILE.OUT"')SHR"
"EXECIO * DISKR IN(STEM DATA. FINIS"
SAY DATA.0
DO I=0 TO DATA.0
DATA.I=STRIP(DATA.I)
RESULT=''
FILE="U123451.U114998.INPUTS"
X=OUTTRAP("RES.")
ADDRESS TSO
"LISTDS '"FILE"' MEMBERS"
X=OUTTRAP("OFF")
DO J=7 TO RES.0
RES.J=STRIP(RES.J)
DS=FILE||'('||RES.J||')'
SAY "CONTENT OF MEMBER:" RES.J
SAY DS
CALL GET(DS)
END
END
EXIT
GET:
COUNT = '0'
SAY "INSIDE THE ARGUMENT"
SAY "MEMBER OPENED"
ARG DS
       ADDRESS TSO "ALLOC FI(INDD) DA('"DS"') SHR REUSE"
       ADDRESS TSO "EXECIO * DISKR INDD (STEM LINES. FINIS"
       ADDRESS TSO "FREE F(INDD)"
       DO K = 1 TO LINES.0
          SAY LINES.K
 SAY "GOING TO SEARCH STRING"
 /*DO L = 1 TO LINES.0 */
           IF INDEX(LINES.K,DATA.0) > 0 THEN
           DO
              SAY STRIP(LINES.K)
              COUNT = COUNT + 1
           END

        SAY "~~~~"COUNT " LINES FOUND"
       END
       RETURN(0)
"EXECIO * DISKR OUT(STEM DATA. FINIS"


This s the code m using ...
i could not fix the error in this ..
output is nt gettin wriiten in o/p file
Back to top
View user's profile Send private message
Kevin

Active User


Joined: 25 Aug 2005
Posts: 234

PostPosted: Mon Oct 09, 2006 8:27 pm    Post subject: Re: How to search a set of strings in PS file
Reply with quote

1. Change this line:
DO I=0 TO DATA.0
to
DO I=1 TO DATA.0

2. Modify the GET function:
GET:
COUNT = '0'
SAY "INSIDE THE ARGUMENT"
SAY "MEMBER OPENED"
ARG DS
ADDRESS TSO "ALLOC FI(INDD) DA('"DS"') SHR REUSE"
ADDRESS TSO "EXECIO * DISKR INDD (STEM LINES. FINIS"
ADDRESS TSO "FREE F(INDD)"
DO K = 1 TO LINES.0
SAY LINES.K
SAY "GOING TO SEARCH STRING"
IF INDEX(LINES.K,DATA.I) > 0 THEN
DO
SAY STRIP(LINES.K)
COUNT = COUNT + 1
/* Insert the logic here to QUEUE the matched record */
END
SAY "~~~~"COUNT " LINES FOUND"
END
RETURN

3. Write all of the Queued matches before the EXIT:
QUEUE ""
"EXECIO" queued() "DISKW OUT (FINIS"
Back to top
View user's profile Send private message
snpavithra

New User


Joined: 22 Sep 2006
Posts: 9

PostPosted: Tue Oct 10, 2006 5:57 pm    Post subject:
Reply with quote

i can understand the logic behind ur code.

Thanks for the help
Back to top
View user's profile Send private message
snpavithra

New User


Joined: 22 Sep 2006
Posts: 9

PostPosted: Wed Oct 25, 2006 12:46 pm    Post subject:
Reply with quote

i don get the logic to be coded here in the queue... pls help...

How can we do dis with a macro?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 1 Thu Jul 27, 2017 9:16 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us