|
I don't see the definition of the keylist CDEB_KEY02 or the subroutine MOVE_DATA in the sample code that you submitted, but the error can occur if you CHANGE the value of one of the key fields of the file that you are attempting to update. In this situation, the Update operation will fail if there is already a record in CDEBP that has this key value, since it has UNIQUE specified. ----- Original Message ----- From: "Frank W. Kany IV" <frank.kany@burr-reid.org> To: "RPG Mailing List" <rpg400-l@midrange.com> Sent: Wednesday, September 04, 2002 11:47 AM Subject: duplicate record error when updating a physical file > This is a multi-part message in MIME format. > -- > [ Picked text/plain from multipart/alternative ] > 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? > > > > *duplicate record error when updating CDEBP > F CDEBP UF A E K DISK > > * > * Get Record > C CDEB_KEY02 CHAIN CDEBP > > * > * Make sure Record is NOT in CTRNP file > C CTRN_KEY01 SETLL CTRNP1 > C IF %FOUND(CTRNP1) > C EVAL CTRNP_FLG = 'Y' > C ELSE > C EVAL CTRNP_FLG = 'N' > C ENDIF > > * Move Account "A" record into save fields > C IF CTRNP_FLG = 'N' > C EVAL MVEFLG = '01' > C EXSR MOVE_DATA > * Move saved Account "B" record into Account "A" fields > C EVAL MVEFLG = '02' > C EXSR MOVE_DATA > C UPDATE CDEB > C ENDIF > > C *INZSR BEGSR > > C CTRN_KEY01 KLIST > C KFLD KF_ALP2 > C KFLD KF_NUM2 > * > C CDEB_KEY01 KLIST > C KFLD KF_ALP1 > C KFLD KF_NUM1 > C ENDSR > > > *Physical File DDS > A UNIQUE > A R CDEB > A RP1ALP 5 > A RP1NUM 5S 0 > A BLA1 15 > A BLA2 10 > A K RP1ALP > A K RP1NUM > > > -- > > > _______________________________________________ > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list > To post a message email: RPG400-L@midrange.com > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l > or email: RPG400-L-request@midrange.com > Before posting, please take a moment to review the archives > at http://archive.midrange.com/rpg400-l. >
As an Amazon Associate we earn from qualifying purchases.
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.