RNQ
RNQ1021 Write of a record that already exists
- RPG status code
- 01021 Tried to write a record that already exists (file being used has unique keys and key is duplicate, or attempted to write duplicate relative record number to a subfile).
Most common cause
WRITE to a file with a unique key and the key already exists. It is the RPG form of CPF5026. It also applies to a relative record number already used in a subfile.
Other causes
- The same sequence number computed by two jobs at once.
- A unique key on a logical file you are not considering.
How to fix it
Use WRITE(E) and test %STATUS = 01021, or check with SETLL and %EQUAL before writing.
Related errors
Text and codes from IBM documentation for 7.6. Checked on .