MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Search using sort

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
waves
Beginner


Joined: 09 Nov 2006
Posts: 35
Topics: 12

PostPosted: Tue Feb 24, 2009 1:34 am    Post subject: Search using sort Reply with quote

Hi all,

I have a situation here...

I have two input files A and B.

I need to pick up the search string from the input file A for the first record, let us say at pos(30-40) and do a search for that string in the input file B. If i get any match, will write that matching record in to an output file. This search needs to be done for all the records in the input file A one by one irrespective of whther it gets any matching record or not in the input file B.

watever may be the output, it should go to the second record and pick up the search string and do the search in the input file B.

I tried to do this using COBOL. I'm getting some error.
Please Guide me on this. Is it possible using DFSORT or SYNCSORT??

Thanks in advance.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Feb 24, 2009 11:14 am    Post subject: Reply with quote

waves,

Please search before posting. Check this link

http://www.mvsforums.com/helpboards/viewtopic.php?t=11&highlight=match
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Brian Wood
Beginner


Joined: 14 Jan 2009
Posts: 37
Topics: 0
Location: USA

PostPosted: Tue Feb 24, 2009 12:03 pm    Post subject: Reply with quote

waves: If the 'search string' field in input file B is at a particular location within the input file B record, then this can probably be done using SyncSort's JOIN processing. SyncSort's JOIN processing can be used to essentially function like an INCLUDE, where input file A contains all the values on which you want to search, so that you can match any of these values to any record in input file B. The length of the 'search string' field would have to be the same for both input files, but the location within input file A could be different from the location within input file B.

If you think using SyncSort's JOIN might be able to help, please contact me at zos_tech@syncsort.com and I will email you some simple examples. Here is a simple example of code I wrote recently to select only those records from input File 2 that matched the selection criteria I built into File 1:
Code:

//SYSIN  DD *
 JOINKEYS FILE=1,FIELDS=(1,15,A)
 JOINKEYS FILE=2,FIELDS=(9,15,A)
 REFORMAT FIELDS=(F2,1,23)
 SORT FIELDS=COPY

Please let me know if this helps.
_________________
Brian Wood
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Back to top
View user's profile Send private message Send e-mail
samlwho
Beginner


Joined: 08 Feb 2007
Posts: 21
Topics: 2

PostPosted: Tue Feb 24, 2009 1:47 pm    Post subject: Reply with quote

Along the same lines as Brian, here is A sort that will write 3 different output files with one pass of the data.

File One -> records with like keys on both input files
File Two -> reocrods that only exist on file 1
File Three -> records that only exist on file 2

Code:

//SRTFIL1  EXEC PGM=SYNCSORT,COND=(0,LT)                               
//*                                                                     
//SORTJNF1 DD *                                                         
12345I AM ON BOTH FILES                                                 
12346I AM ONLY ON FILE ONE                                             
//*                                                                     
//SORTJNF2 DD *                                                         
     12345I AM ON BOTH FILES                                           
     12347I AM ONLY ON FILE TWO                                         
//*                                                                     
//SYSIN    DD *                                                         
 JOINKEYS FILE=F1,                                                     
           FIELDS=(001,05,A)         *Input File One                   
 JOINKEYS FILE=F2,                                                     
           FIELDS=(006,05,A)         *Input File Two               
  JOIN UNPAIRED                                                         
  REFORMAT FIELDS=(F1:01,05,6,30,F2:06,05,11,30)                       
  SORT     FIELDS=COPY                                                 
  SUM      FIELDS=NONE                                                 
      OUTFIL FNAMES=BOTH,                                               
        INCLUDE=(01,05,CH,EQ,36,05,CH)                                 
      OUTFIL FNAMES=FIL1O,                                               
        INCLUDE=(36,01,CH,EQ,C' ')                                     
      OUTFIL FNAMES=FIL2O,                                               
        INCLUDE=(01,01,CH,EQ,C' ')                                     
//BOTH     DD SYSOUT=*                                                 
//FIL1O     DD SYSOUT=*                                                 
//FIL2O     DD SYSOUT=*                                                 


File One (BOTH)
Code:

********************************* TOP OF DATA **********************************
12345I AM ON BOTH FILES            12345I AM ON BOTH FILES                     
******************************** BOTTOM OF DATA ********************************

File Two (FIL1O)
Code:

********************************* TOP OF DATA **********************************
12346I AM ONLY ON FILE ONE                                                     
******************************** BOTTOM OF DATA ********************************

File Three (FIL2O)
Code:

********************************* TOP OF DATA **********************************
                                   12347I AM ONLY ON FILE TWO                   
******************************** BOTTOM OF DATA ********************************
[/code]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group