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
 

 

SRCHFOR a text in a set of files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: SRCHFOR a text in a set of files
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Mar 13, 2015 12:59 pm    Post subject: Reply to: SRCHFOR a text in a set of files
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Fri Mar 13, 2015 1:05 pm    Post subject: Reply to: SRCHFOR a text in a set of files
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    Post subject: Reply to: SRCHFOR a text in a set of files
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    Post subject: Reply to: SRCHFOR a text in a set of files
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Fri Mar 13, 2015 5:33 pm    Post subject: Reply to: SRCHFOR a text in a set of files
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Mar 13, 2015 6:13 pm    Post subject: Reply to: SRCHFOR a text in a set of files
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: 641
Location: Whitby, ON, Canada

PostPosted: Fri Mar 13, 2015 9:28 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts Adding records from two files into on... shiitiizz SYNCSORT 4 Mon Sep 19, 2016 8:41 pm


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