|
wrote:
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.
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.