Advanced Trigger question for *insert *before to allow update of field value

5 pts.
Tags:
RPG
RPG ILE
RPG IV
RPGLE
I need to update a field in a record being written prior to it being written. I want to do it with a trigger because many programs write and update this file. I have tried several things and the closest I have gotten is to do a *before *insert where I can see the values of the fields in the after image. I changed the value of the field I needed to change and it shows I changed it but the value doesn't return back to the program that caused the trigger so it doesn't write the modified value to the record.

Answer Wiki

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

The *before *insert trigger program runs after the application program has written the record and before database actually records the new records. The changes made by the trigger are not returned to the application (the application has done a WRITE, not a READ), but are written to the database (assuming ALWREPCHG is *YES that is).

Bruce Vining
Bruce Vining Services

Discuss This Question: 1  Reply

 
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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Piano
    Hi Bruce Based on your answer, I have an additional question. I have a trigger program that decrypts a field after a read operation occurs from the application program. I would like to be able to return the value of this decrypted field to the application program. Is there a way to do this ? Thanks, Nick
    520 pointsBadges:
    report

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following