ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Updating file inside a trigger

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Updating file inside a trigger

    Hi *,
    imagine physical file with columns NAME, SURNAME, MARITALSTS, WASMARRIED (flag Y/N). Lots of processes update MARTIALSTS in this file and I want to create a trigger that checks if MARITALSTS was set to married. If yes, I want to set flag WASMARRIED to 'Y'. Can I update inside my trigger PGM a record, which is currently processed by this trigger, or I will get some lock?

    Real situation is more complicated, example above is only to show what I want to do.

    Thanks

  • #2
    you can if the trigger is TRGTIME(*BEFORE) ALWREPCHG(*YES)), you just update the field in the after buffer before the trigger completes.

    Comment


    • #3
      Originally posted by Scott M View Post
      you can if the trigger is TRGTIME(*BEFORE) ALWREPCHG(*YES)), you just update the field in the after buffer before the trigger completes.
      Thanks a lot, I will try.

      Comment

      Working...
      X