Update without prior read or chain error

170 pts.
Tags:
RPG UPDATE ERROR
I am getting RNX1221:Update or delete in file without prior input operation on the update of file SRCDTAL in the following code. I don't see what the issue is. Any help would be appreciated. FSRCDTAL UF A E K DISK RENAME(QWHFDML:SRCDTAR) F Prefix('S') D HistData ds qualified D In likerec(SRCDTAR:*input) D Out likerec(SRCDTAR:*output) D overlay(In) Chain (ds2.MLLIB:ds2.MLFILE:ds2.MLNAME) SRCDTAL HistData.In; . . . If %Found(SRCDTAL); HistData.Out = ds2; update SRCDTAR HistData.Out; Else; HistData.Out = ds2; Write SRCDTAR HistData.Out; ENDIF;

Answer Wiki

Thanks. We'll let you know when a new response is added.

Do you have any other file operations on SRCDTAL between the Chain and the If %Found statements because the code you have supplied looks OK.

Another idea :
Have you check that you do not modify the key fields between the chain and the update ?

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: