CPF
CPF5026 Duplicate key
Most common cause
WRITE or UPDATE with a key that already exists in a file with a unique key.
Other causes
- The unique key may be on a logical file built over the file, not on the physical file you are writing.
- Two jobs compute the same sequence number by reading the last one used.
How to fix it
Message CPF5009, earlier in the job log, says which record has the duplicate key. Check for the key with SETLL and %EQUAL before writing, or write with WRITE(E) and test %STATUS = 01021. For sequence numbers use an IDENTITY column or a SEQUENCE instead of computing them by hand.