1. The first step in this process is to compare the duplicate records to determine if they are truly duplicates or if only the indexed field(s) have duplicate values. To accomplish this task, use the following pseudo ABL code:
Replace the <...> tags with the corresponding values reported in the 1422 error
FOR EACH <Table Name> WHERE RECID(<Table Name>) = <RECID>:
DISPLAY RECID(<Table Name>) <Indexed field name>.
END.
The output associated with the <indexed field name> can be used to find the original records RECID:
FOR EACH <Table Name> WHERE <Indexed field name> = <indexed field name value from above> use-index <non-unique index>:
DISPLAY RECID(<Table Name>) <Indexed field name>.
END.
Now that both RECIDs are known, the following code will output the complete contents of each field in both records. This can be used for comparison to determine if the records are duplicates or if it just the indexed field that has duplicate values:
OUTPUT TO dupeRecs.txt.
FOR EACH <Table Name> WHERE RECID(<Table Name>) = <RECID> OR
RECID(<Table Name>) = <RECID returned from above code> :
DISPLAY <Table Name> with 1 column down with width 128.
END.
OUTPUT CLOSE.
2. Review the output produced from the above code.
If the records are not duplicates but just have duplicate indexed field values determine whether to create a new record with the non-indexed values. Regardless, the next step is to delete the duplicate record with the IDXFIX utility.
$ proutil <db name> -C idxfix
Choose Option 6
Enter the RECID and Area Number of that table that was reported in the original 1422 error.