What it means
DUPKEY is RESP 15 with RESP2 140 on READ and READNEXT. The record was retrieved through an alternate index with the NONUNIQUEKEY attribute, and another alternate index record with the same key follows.
On READNEXT it is not raised for the last record having that non-unique key. The default action is to end the task abnormally.
Typical causes
- A record was read through an alternate index with the NONUNIQUEKEY attribute.
- Another record with the same alternate key follows the one retrieved.
How to fix it
- Test RESP for DUPKEY; a record was retrieved, and more records with the same key follow.
- To read the rest, continue a browse with READNEXT; DUPKEY is not raised on the last record with that key.
- In assembler with SET, the register is not set when DUPKEY occurs but can be loaded from DFHEITP1.
Example
Illustrative only; names and values are invented.
IF WS-RESP = DFHRESP(NORMAL) OR WS-RESP = DFHRESP(DUPKEY)
PERFORM 2000-SHOW-RECORD
END-IF