AS/400 Trigger programming

0 pts.
Tags:
AS/400
Development
Lifecycle development
RPG
Software testing
Sir, I have a trigger program on a file (File1) with INSERT / UPDATE / DELETE. The requirement is to execute the business logic on the same file (File1). So I'm opening File1 in trigger program in update/add mode. I know that it is not recommended to use the same file in trigger program. The question is, how can I get out of the trigger program, once I execute my logic on File1? Thank you for the help in advance... Mahesh
ASKED: November 22, 2004  6:56 PM
UPDATED: November 11, 2011  12:12 AM

Answer Wiki

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

You probably have to set ALWREPCHG to *NO in your ADDPFTRG command.
Regards

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.

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
  • Daveslateree
    Hi You do not need to open the file for update. If you use the original DB to create an external data structure and base it on a pointer e.g. D p_After s * D MYds e ds ExtName(myDB) D based(p_After) You can then set the to the memory after image Eval p_After = %addr(Parm1) + AftOffset Parm1 is the standatd Parmeter 1 and the standard afrter offset (I can not remember the exact position) If you then update the data structure and add the trigger on the *Before event with ALWREPCHG(*YES) The updated image is written to disk. Dave
    0 pointsBadges:
    report
  • JaneVideo
    The trigger program which is called based on the trigger criteria on the file should not update the same file. You will have an ugly loop. You should reconsider triggering the file and updating with the same program. Maybe have the trigger program write to a work file from which another program applies the updates to the original file. Good Luck.
    0 pointsBadges:
    report
  • Costevet
    If your trigger pgm updates the file it is defined on, then you will cause the trigger to fire ad infinitum. Find some other way. The only acceptable reason to open FILE1 in the trigger is if you are firing it BEFORE the update/insert and modifying the new record image with ALWREPCHG(*YES).
    0 pointsBadges:
    report
  • Oldgrayprogrammer
    Hello, Setting on the LR indicator should end your program. It works with my trigger programs.
    0 pointsBadges:
    report
  • Shaiesellmon
    how trigger in as400....??
    10 pointsBadges:
    report
  • TomLiotta
    how trigger in as400….?? How what? Do you need to know how to create triggers? ...how to add a trigger to a table? This might be better if you create a new question. Include more detail to describe the problem you are having. Tom
    125,585 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