× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



> I get an error when I try to update a physical file. The error is--->
> Attempt to write a duplicate record to file CDEBP"......"RPG procedure
> detected an output record with a duplicate key field"
>
> Can anyone see why I'd be getting this error?

Frank -- as has already been pointed out, you confused %found and %equal.
However, another thing to look out for is: though a record you may be
writing to a physical or logical file doesn't violate the uniqueness of the
key for that particular file, another logical may be built over the same
physical file for which the record you are writing creates an un-allowed
duplicate key. This is usually a case of poor database design. But it can
and does happen.

Example:
0000.01               * Physical file DUPLPF
0000.02              A                                      UNIQUE
0001.00              A          R DUPLR
0003.00              A            DUP1           1
0004.00              A            DUP2           1
0005.00              A          K DUP1
0006.00              A          K DUP2

0000.01               * Logical file DUPLLF
0000.02              A                                      UNIQUE
0001.00              A          R DUPLR                     PFILE(DUPLPF)
0003.00              A          K DUP1

If you load 'A' and 'B' to DUP1 and DUP2, respectively, and write a DUPLPF
record, no problem. If you then load 'A' and 'C' to DUP1 and DUP2,
respectively, and write to DUPLPF, you receive the following error:

Message . . . . :   Duplicate key on access path.

Cause . . . . . :   An output or update operation on record number 0 record

  format DUPLR member number 1 failed because of a duplicate key in a unique

  keyed member that is based on member DUPLPF file DUPLPF in library
(libraryname),
  or in a based-on member of DUPLPF. The failure could also have been caused

  by an output or update operation done to another file by a trigger program

  associated with file DUPLPF in library (libraryname).

Admittedly, a silly example, but, I think it demonstrates the concept.

Best regards!
Jeff



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.