Delete Duplicate Records in File Before you Assign Keys using SQL

Let’s say you are building a file from multiple spreadsheets and need to consolidate and remove duplicates. ¬†Build your DB2 file without keys load all the spread sheets with *add not *replace then run this SQL using the where statement to match the fields

Delete from ksfcexg F1 where RRN(f1) > (select MIN(RRN(F2)) from

ksfcexg F2 where F2.stcuno = F1.stcuno)

F1 and F2 are the same file