AS/400: Update the record that caused the trigger to be called

15 pts.
Tags:
AS/400
AS/400 triggers
I need to update the record that caused the trigger to be called. When the status is updated to a certain value, I want to be able to perform some calculations on other files and then update the original status. This is not working due to record locking.


Software/Hardware used:
RPG free form
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 6  Replies

 
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.
  • pdraebel
    I know this is possible. Has something to do with Allow Repeated Change. Do not know exactly what is involved though.
    7,545 pointsBadges:
    report
  • pdraebel
    Found this when Googling as400 trigger allow repeated change :

    Re: Allow repeated change.

    Others have explained it quite well but down to the nuts and bolts of it's 
    use...
    When you write a trigger program you are passed some parameters and one is 
    rather large.  In that one are a couple of data structures.  One is a 
    before image of the data and the other is an after image of the data. 
    RPGers can use an externally defined data structure of the file the 
    trigger is based on to define these data structures.  If you say 
    ALWREPCHG(*YES) you can modify the after image and it will be passed back 
    to the system.  Often useful for modifying fields like "who updated this 
    record last?" and "when?".
    
    Rob Berendt

    7,545 pointsBadges:
    report
  • lisawml
    Thanks for your quick responses. I have tried the ALWREPCHG(*YES). My problem is trying to update the trigger record in the calculation program as it is locked.
    15 pointsBadges:
    report
  • TheRealRaven
    You shouldn't `update the trigger record`. That generally wouldn't make sense. Instead, you update the "trigger buffer".
    36,145 pointsBadges:
    report
  • TheRealRaven
    For clear help, we first need to see the trigger definition. After that, we might need to see the trigger body.
    36,145 pointsBadges:
    report
  • pdraebel
    The trigger event should be a "before" trigger. So the pgm is called before the actual DB update or write occurs. You will have to put the update field(s) into the "after" buffer.
    7,545 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.

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

Following

Share this item with your network: