Compare column and write non matched records to output.

SyncSort's Sort Product, SyncTool for z/OS, SYNCINIT and SYNCLIST.
Previous topicNext topic

Topic Author
alpna
Registered Member
Posts: 38
Joined: Fri Jun 21, 2013 10:35 pm
Zodiac: Virgo

Compare column and write non matched records to output.

Post by alpna » Wed Sep 30, 2015 4:59 pm

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.




William Collins
Global Moderator
Global Moderator
Posts: 499
Joined: Sun Aug 25, 2013 7:24 pm

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

Post by William Collins » Wed Sep 30, 2015 6:25 pm

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.




Topic Author
alpna
Registered Member
Posts: 38
Joined: Fri Jun 21, 2013 10:35 pm
Zodiac: Virgo

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

Post by alpna » Sat Oct 03, 2015 6:47 pm

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:



Previous topicNext topic

Return to “SyncSort, SyncTool, SyncGener.”