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

SRCHFOR a text in a set of files


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rakhin

New User


Joined: 07 Mar 2007
Posts: 5
Location: chennai

PostPosted: Fri Mar 13, 2015 12:49 pm
Reply with quote

I have a set of 100 files (all different lrecls) and i need to search for a text in all of these files. The result should show which file the text was found.

Currently i use the SRCHFOR utility in ISURPC, it shows the text if found or not but doesnt show where it was found.

Is there any way that this can be achieved?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Mar 13, 2015 12:59 pm
Reply with quote

What, exactly, do you mean by this? Can you show an example?

You have consulted the documentation?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Mar 13, 2015 1:05 pm
Reply with quote

the dataset name is displayed in the header line of the srchfor output

so You will have to post process on your own the outputs to produce a more compact report

there should be examples doing it with rex and sort

....
just found that
srchfor does not handle well concatenated files
seems to process and report only the last dataset of the concatenation
Back to top
View user's profile Send private message
rakhin

New User


Joined: 07 Mar 2007
Posts: 5
Location: chennai

PostPosted: Fri Mar 13, 2015 5:04 pm
Reply with quote

@enrico-sorichetti - Yes, that's what it shows. It displays the last searched file in the output and not where the string was found
Back to top
View user's profile Send private message
rakhin

New User


Joined: 07 Mar 2007
Posts: 5
Location: chennai

PostPosted: Fri Mar 13, 2015 5:12 pm
Reply with quote

@Bill Woodger

I am trying to search for a text in about 100 files.

Code:
//SEARCH  EXEC PGM=ISRSUPC,                         
//            PARM=(SRCHCMP,                       
//            'ANYC')                               
//xxxx DD DSN=abcd.lrecl1, disp=shr       
//        DD DSN=fghf.lrecl2, disp=shr       
:::::::::::::::::::::::::::::::::::::::::::
//        DD DSN=zxcv.lrecl100, disp=shr   
//OUTDD  DD SYSOUT=*     
//SYSIN  DD *               
SRCHFOR  'xxxxxxx'   
/*             


Output -
---------

Code:
  ISRSUPC   -   MVS/PDF FILE/LINE/WORD/BYTE/SFOR COMPARE UTILITY- ISPF FOR z/OS
 LINE-#  SOURCE SECTION                    SRCH DSN: zxcv.lrecl100
                                                                               
      6  1 mdfmdmdfm         xxxxxxxxx        iuruirueiure

ISRSUPC   -   MVS/PDF FILE/LINE/WORD/BYTE/SFOR COMPARE UTILITY-

ISPF FOR z/OS
     SEARCH-FOR SUMMARY SECTION            SRCH DSN: zxcv.lrecl100
                                                                               
LINES-FOUND  LINES-PROC  DATASET-W/LNS  DATASET-WO/LNS  COMPARE-COLS  LONGEST-LI
        4        58644            1              0           1:8201       4000 



What i needed was the output to show which file was the search string found. But this doesnt seems to be showing.

Code'd
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Mar 13, 2015 5:33 pm
Reply with quote

Quote:
What i needed was the output to show which file was the search string found. But this doesnt seems to be showing.


unfortunately a concatenation of PS datasets is seen as a ONE BIG dataset

so while it is unpleasant that isrsupc is displaying the last one
the only alternative is to display the first one
(*) for the output format chosen - the page header for the report

on the other side for PDS/PDSE concatenations
it still displays the last dataset name but for each member processed it tells
the sequence number of the concatenation
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Mar 13, 2015 6:13 pm
Reply with quote

Why are you doing this?

I'd create a "header" file with a single record, uniquely identifiable (in this example, five bytes long with RDW followed by X'FF').

Then include that before each file in your concatenation, and run this, where you replace nnn by the maximum LRECL you have (you can guess, as long as you are high):

Code:
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,
            BUILD=(1,4,4X,5)),
        IFTHEN=(WHEN=INIT,
            OVERLAY=(nnn:X)),
        IFTHEN=(WHEN=GROUP,
                 BEGIN=(9,1,CH,EQ,X'FF'),
                 PUSH=(5:SEQ=3)),
        IFTHEN=(WHEN=(9,76,SS,EQ,C'FIND'),
                 OVERLAY=(8:C'Y'))
  OUTFIL INCLUDE=(8,1,CH,EQ,C'Y')


This will

1) Make space at the beginning of the record, after the RDW, for a 3-digit sequence number and a flag
2) Extend all records to the same size
3) Make the dummy headers define a group, with a SEQuence number
4) Do a substring search for your value and set a flag if found
5) Use OUTFIL to write all the flagged records, the first part of the data will tell you the sequence number of the file the hit was on

Untested, but should be close...
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Fri Mar 13, 2015 9:28 pm
Reply with quote

Use the SRCHFOR IDPFX parm. It will show you the member name and the concatenation sequence number that contains the hit.

Code:
1  ISRSUPC   -   MVS/PDF FILE/LINE/WORD/BYTE/SFOR COMPARE UTILITY- ISPF FOR z/OS         2015/03/13  1
  MEMBER  CONC#  LINE-#  SOURCE LINE        SRCH DSN: xxxx.xxxx.USAGELOG.$AOBATCH                 
                                                                                                     
 BARTB2   (1)        74  12/08/16 12:46  ARCDTER Project Date Chg 20030910 set S0 SS0DBC IMSS YNYYYYYY
 BARTB2   (1)        75  12/08/17 16:03  ARCDTER Project Date Chg 20030910 set S0 SS0DBC IMSS YNYYYYYY
                                                                                                     
 BELGOV2  (1)         2  14/03/29 23:35  ARCDTER Project Date Chg 20140328 set S0 SS0DBC IMSS YNYYYYYY
 BELGOV2  (1)         3  14/03/31 14:19  ARCDTER Project Date Chg 20140331 set S0 SS0DBC IMSS YNYYYYYY
 BELGOV2  (1)         4  14/04/01 15:41  ARCDTER Project Date Chg 20140401 set S0 SS0DBC IMSS YNYYYYYY
 BELGOV2  (1)         5  14/04/04 13:43  ARCDTER Project Date Chg 20140404 set S0 SS0DBC IMSS YNYYYYYY
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top