Easiest way is in SQL
Select count(*), field1, field2, field3 from myfile
group by field1, field2, field3
having count(*) > 1
This would find matches on these three fields.
Programmatically you would open a cursor and fetch the results into a datastructure of
count(*), field1, field2, field3
But if you must do it in RPG – this will do it — kind of — it will find records that are identical and have the same key unless there are other records that have the same key and are not identical.
create two datastructures based on the file structure.
one of them should have a prefix such as h_
open the file as keyed
1. Read each record of the file
2. dow not eof
3. if the two datastructure’s are equal
— do whatever you want with the duplicated record
datastructure_h = datastructure
5 read next record