Charles,

This is not a bug.  This is a flaw in your design.  You have two copies of
the file using the same identity.  When you add records to both files they
can end up with the same identity value because the files aren't aware of
each other.  As you mentioned you are doing CPYFs between tables which can
merge these records into the same file.

The INSERT is having a problem because you used a CPYF to insert a record
with the next available index value.  The generator isn't aware that value
is already taken and it just attempts to increment for the next value on the
INSERT.  But that value is already in the file so you get a duplicate record
error.

You can reset the next value for an identity column (above any value
currently in the file) with:

ALTER TABLE MELDBFQ.HPDOCU ALTER DHDOID RESTART WITH nnnn

Query SYSCOLUMNS in the QSYS2 library to determine the next increment value.

Paul


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.