|
Well, you could delete bb and update the values in cc. Just a thought. In the scenario you have, you have to test for the existence of cc before trying to update bb. Which works out OK since if you get a hit on cc you can issue a DELET opcode immediately then chain to bb and perform your UPDAT. Dinesh_Goel@dtconsulting.com wrote: > Hi All, > > I have a problem in RPG. > > In my RPG program I want to update a LF(which is defined as Unique). In > case of duplicate Key record error I have to Delete the record which Is > duplicate and then I have to write the one which I was initially trying to > write. > > For Ex. > > Data in File A > > Fld1 Fld2 Fld3 > aa 1 2 > bb 2 3 > cc 3 4 > > File is defined as Unique on Fld1. When I do setll on Second record(i.e. > with bb) and try to change bb to cc ad Eval fld2=9 > and then update it gives me Duplicate Key error. Thats true it should give > that error. > > My Requirement is to delete third record(i.e. with va;ue cc ) and update > 2nd record > > Please advise me how to do so. > +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---END
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.