compare two fields within one file



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

compare two fields within one file

Postby venkyjm » Tue Dec 15, 2009 1:08 am

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,
venkyjm
 
Posts: 1
Joined: Tue Dec 15, 2009 12:35 am
Has thanked: 0 time
Been thanked: 0 time

Re: compare two fields within one file

Postby Frank Yaeger » Tue Dec 15, 2009 4:15 am

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
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post