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
 

 

Selective search

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
madprasy

New User


Joined: 08 Apr 2008
Posts: 31
Location: Chennai

PostPosted: Tue Aug 05, 2014 5:43 pm    Post subject: Selective search
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Aug 05, 2014 6:22 pm    Post subject: Reply to: Selective search
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: 31
Location: Chennai

PostPosted: Tue Aug 05, 2014 6:29 pm    Post subject:
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: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Aug 05, 2014 6:54 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Aug 05, 2014 7:00 pm    Post subject: Reply to: Selective search
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: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Aug 05, 2014 7:20 pm    Post subject:
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: 31
Location: Chennai

PostPosted: Tue Aug 05, 2014 8:07 pm    Post subject:
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    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 Search a Load Module sreekanth1984 TSO/ISPF 8 Tue Jun 07, 2016 8:45 pm
No new posts Copy one PDS to another PDS based on ... alluri12 JCL & VSAM 10 Tue Sep 29, 2015 8:10 pm
No new posts Need to do selective update in JCL manuwankenobi DFSORT/ICETOOL 1 Mon Sep 07, 2015 4:23 pm
No new posts DFSORT - Retrieve selective records f... narasimha_devi DFSORT/ICETOOL 8 Thu Aug 06, 2015 4:12 pm
No new posts Search and replace the key in the report V S Amarendra Reddy SYNCSORT 1 Thu Jul 09, 2015 7:41 pm


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