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

Selective search


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

New User


Joined: 08 Apr 2008
Posts: 34
Location: Chennai

PostPosted: Tue Aug 05, 2014 5:43 pm
Reply with quote

Scenario :

I have 10 files and my search string has 3 to 10 matching occurence in each of the file. Yet, I require only the first occurence of each file and ignore rest of them.

What would be the best way we can do it IBM mainframes.

1) If I use SORT, then that would lead to concatenating all the 10 files
2) If I use SRCHFOR in TSO, then I would get only the matching files but not the data inside it.

Please provide your knowledge on this.
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: Tue Aug 05, 2014 6:22 pm
Reply with quote

Can you clarify your task please. If you are searching for something, and you find it, then you know the content.

Show some sample data, and expected output, and explain better why you think neither SORT nor SRCHFOR are going to give you what you want.
Back to top
View user's profile Send private message
madprasy

New User


Joined: 08 Apr 2008
Posts: 34
Location: Chennai

PostPosted: Tue Aug 05, 2014 6:29 pm
Reply with quote

A.TXT
BILL123
PRAS123
DBZ456
PRAS456

B.TXT
NEO123
PRAS890
JACK123
PRAS123

C.TXT
ABC123
PRAS789
XYZ123
PRAS789


Now, from the above three files, I need to fetch only the records containing with "PRAS" in the first occurence of each file into a seperate output file

OUT.TXT
PRAS123
PRAS890
PRAS789


Note: I have ignored,
PRAS456 from A.TXT
PRAS123 from B.TXT
PRAS789 from C.TXT


Whats the most optimum was we can achieve this ?
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Aug 05, 2014 6:54 pm
Reply with quote

You can try something like below:
Code:
//STEP01   EXEC PGM=ICETOOL         
//TOOLMSG  DD SYSOUT=*               
//DFSMSG   DD SYSOUT=*               
//IN1      DD *                     
BILL123                             
PRAS123                             
DBZ456                               
PRAS456                             
//IN2      DD *                     
NEO123                               
PRAS890                             
JACK123                             
PRAS123                             
//IN3      DD *                     
ABC123                               
PRAS789                             
XYZ123                               
PRAS789                             
//OUT      DD SYSOUT=*               
//TOOLIN   DD *                     
  COPY FROM(IN1) TO(OUT)  USING(CTL1)
  COPY FROM(IN2) TO(OUT)  USING(CTL1)
  COPY FROM(IN3) TO(OUT)  USING(CTL1)
//CTL1CNTL DD *                     
  OPTION COPY,STOPAFT=1             
  INCLUDE COND=(1,4,CH,EQ,C'PRAS')   


I don't have DFSORT, but SYNCSORT. Couldn't test it.
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: Tue Aug 05, 2014 7:00 pm
Reply with quote

It'll need DISP=MOD on OUT when it has an actual DSN and will require that all inputs are either variable-length, or fixed-length of the same size.

Other than that, an efficient way to do it - until TS/OP comes up with a change to the requirement.
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Aug 05, 2014 7:20 pm
Reply with quote

Thanks Bill. I completely missed the DISP=MOD part .
Back to top
View user's profile Send private message
madprasy

New User


Joined: 08 Apr 2008
Posts: 34
Location: Chennai

PostPosted: Tue Aug 05, 2014 8:07 pm
Reply with quote

Thank You! ICETOOL.. Thats the spark.. Thanks for it..
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 Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts first column truncated in search result IBM Tools 13
No new posts ISRSUPC search utility - using high l... TSO/ISPF 2
No new posts To search DB2 table based on Conditio... DB2 1
Search our Forums:

Back to Top