Page 1 of 1

Compare column and write non matched records to output.

Posted: Wed Sep 30, 2015 4:59 pm
by alpna
I want to copy only the records where the value in column 2 is not equal to the value in column 3 :

Code: Select all

111 AAAAA   AAAAA    
222 AAAAA   BANANA  
333 BBBBBB  BBBBBB  
444 CCCCC   CCCCC    
555 DDDD    AAAAA 
How can I do that. I could not find a way of doing it in file-iad, perhaps can do it in sort. Thanks for any help.

Re: Compare column and write non matched records to output.

Posted: Wed Sep 30, 2015 6:25 pm
by William Collins
If the data is in a fixed position as you have shown, with a COPY operation and an INCLUDE COND=(5,8,CH,EQ,13,8,CH) (check the starts and lengths).

If the columns are in variable positions, you'd have to PARSE them and put them in fixed positions, and then use INCLUDE= on OUTFIL.

Re: Compare column and write non matched records to output.

Posted: Sat Oct 03, 2015 6:47 pm
by alpna
William Collins wrote:If the data is in a fixed position as you have shown, with a COPY operation and an INCLUDE COND=(5,8,CH,EQ,13,8,CH) (check the starts and lengths).
Thank you William. This helped me to achieve what I wanted.

Thanks! :good: