× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Darryl,

Have you looked at SQL statement merge (<https://www.ibm.com/support/knowledgecenter/nl/ssw_ibm_i_73/db2/rbafzmerge.htm>)? Basically you can execute either an update ('when matched') or an insert ('when not matched').

Joep Beckeringh


Op 19-4-2018 om 20:10 schreef a4g atl:
I have a SQL RPGLE program reading from the input file and testing if a
record with the same part number exists in the target file. The input file
has duplicates and I am trying to filter out the duplicates.

The output file is cleared with DELETE ALL up front.


The process is
1. read input file.
2. use Select count(*) counting if the part number exists in the output
file.
SELECT COUNT(*) into :COUNT from INPUTFILE WHERE PART_NO = :PART
3. if it does not exist, I do an INSERT.
4. if it exists, I update the record with the latest values.
5 Read next input record.

I have the isolation level set to *none. The file is a new file and is not
journaled.

Problem:
The count process does not see the records already inserted so I am getting
duplicates written to the file. Its almost like the program needs a COMMIT
executed after each INSERT.

Why does the program not find the records it has written?

TIA

Darryl Freinkel.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.