You need to use ADDPFMTRG to specify the program to call when a record is added, deleted or changed. You can specify the trigger to fire before or after each event but you can only specify one at a time so you have to do the ADDPFMTRG for each one. The trigger program is passed data which has a header section to tell you which event has occurred and whether it is before or after the event. Then it has a string which gives you an image of the data which has changed. The best bet here is to define an externally defined data structure using the trigger file name then just use EVAL to set this equal to the string which has been passed.
ps. it ain't a good idea to change the trigger file in the trigger program because this kicks up a Recursive Call error message.
PeteJ
(Contract Code-monkey)
It's amazing how many ways there are to skin a cat
(apologies to the veggies)
I can't think of any. Whichever way you update the data it is going to fire the trigger. Even if you have a workfile with the same layout and write to it, when you write or update these records back to the main file it will fire the trigger. If you didn't need to track adds or deletes and you didn't do ADDPFTRG for the *ADD/*DELETE events you could delete the record, change the fields then write a new record. Then it wouldn't fire the trigger program because you weren't doing an update but that may not be practical/possible.
PeteJ
(Contract Code-monkey)
It's amazing how many ways there are to skin a cat
(apologies to the veggies)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.