|
Scott/AB, >If you want to make changes inside a trigger, make the changes to the >"AFTER" record buffer. This will cause it to be written to the file by >the operating system. Or better yet, starting with V3R2 and V3R7, you could use a *BEFORE trigger and specify ALWREPCHG(*YES) to enable "allow repeating changes". This is precisely to handle the situation described, where the trigger wishes to modify the record being added/inserted by the underlying application. But instead of having the trigger program perform any I/O (which causes the recursive loop you described), with ALWREPCHG(*YES) the trigger just modifies the trigger buffer. The modified buffer is then written to disk instead of the image from the application program. No additional disk I/O, and no recursive calls generated. The default is ALWREPCHG(*NO) to you don't accidentally modify a record, and to remain backward compatible with triggers prior to V3R2 and V3R7. Also note it must be a *BEFORE trigger, not *AFTER. Doug +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.