Kevin,
There are a couple of options here ...
Since you're connected to an iSeries, you should be able to take advantage of QTemp and SQL to get this done. The following pseudo code should give you what you're looking for.
Code: Select allRead File1 (rowset.File1)
Read File2 (rowset.File2)
SQL -
Create Table QTemp.File1 as (c1, c2, c3)
Create Table QTemp.File2 as (c1, c2, c3)
Create Table QTemp.File3 as (c1, c2, c3)
Create Table QTemp.Errors as (c1, c2, c3)
Insert rowset.File1 into QTemp.File1
Insert rowset.File2 into QTemp.File2
Insert into QTemp.File3 (Select * from QTemp.File1)
Insert into QTemp.Errors (Select * from QTemo.File2 where "key" exists in QTemp.File1)
Insert into QTemp.File3 (Select * from QTemp.File2 where "key" does not exist in QTemp.File1)
Select * from QTemp.File3 (Final File)
Create CSV/Txt/Excel, etc...
Or If at least one of the files is under 1000 records, Write the larger file to your third file. Read the smaller file, then in a for Each loop - use the search and replace to check the third file for the current filename. If it's there, skip, otherwise add it to the third file. It is up to you to determine the file size you feel comfortable using as a sizelimit. Keeping in mind, this will be some intensive looping and might take a bit of time to complete, depending on file size.