Page 1 of 1

compare two fields within one file

PostPosted: Tue Dec 15, 2009 1:08 am
by venkyjm
Hi,

I would like to compare two fields within one file F1 and if there is a mismatch between two fields in a row then write it out to a output file F2. can be this done using sort utility. I did search the forum but i coudn't find something similar to my question, please point me if there is already a thread discussing about this topic.

eg:
FILE1
           pos(1-15)          pos(16-30)
rec1:   allanxsmith        allanJsmith
rec2:   rainxdeer          rainxdeer
rec3:   kimxlarry          kimslarry
rec4:   robertxhenry       robertxhenry

in the above example rec1 and rec3 has to be written to the output file since those fields dont match.

thanks,

Re: compare two fields within one file

PostPosted: Tue Dec 15, 2009 4:15 am
by Frank Yaeger
You can use a DFSORT job like the following to do what you asked for:

//S1    EXEC  PGM=SORT                       
//SYSOUT    DD  SYSOUT=*                     
//SORTIN DD *                                 
allanxsmith    allanJsmith                   
rainxdeer      rainxdeer                     
kimxlarry      kimslarry                     
robertxhenry   robertxhenry                   
//SORTOUT DD SYSOUT=*                         
//SYSIN    DD    *                           
  OPTION COPY                                 
  INCLUDE COND=(1,15,CH,NE,16,15,CH)         
/*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080