IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to search a set of strings in PS file


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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
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
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top