|
During the *before trigger program, the file has not been updated yet. The *before trigger program is fired before the actual update to the file. This gives you the ability to make changes to the new record image or to cancel the update by sending an escape message. I am not sure what exactly happens under the covers but the sequence is: UPDATE FILE(program) --> *before trigger program --> {if no escape msg} actual file update --> *after trigger program Joe Teff wrote: > Joe Teff wrote: > > >> If I want to update some information in the same record that caused by > >> trigger to fire, I would: > >> 1. Before Add and Before Update - place the new data into the > >> appropriate position of the "new record" image in the buffer and > >> RETURN. > >> 2. After Add and After Update - chain out to the record, change to > >> data in the field, update the record and RETURN. > >> The difference being is that on the Before action, I make the update by > >> changing the image in the ENTRY parameter and on the After action, > >> I change the record itself. Is this correct or do I not understand what I > >> am reading? > >> This is a V3R2 system and the parameter on the ADDPFTRG says to allow > >> repetitive changes. > > David Duerr wrote: > > > Actually, you do not need the second step. The record will be updated with > > the updated new record image in the trigger program. Your method will work, > > but the second step is unnecessary. > > In the trigger program, use %subst to move the new record image into an > > externally described data structure with the definition of the file that >fired the > > trigger. To apply the changes move the external data structure to > > the new record image with another %subst. > > I'm not sure how this works. If I'm able to chain to the database and update >the > record that caused the trigger to fire, then the update had to complete in the > original program before the trigger program is called. I know that I can >chain to > and update the same record that caused the trigger to fire because I've done >it. > How could I then update the record by passing the change back in the trigger > buffer? The actual update to the database would have to have occurred already. > Or does the system check the buffer for a change, re-read the record and > make the update? > > Joe Teff > QDS > Bloomington, MN > +--- > | This is the Midrange System Mailing List! > | To submit a new message, send your mail to "MIDRANGE-L@midrange.com". > | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. > | Questions should be directed to the list owner/operator: david@midrange.com > +--- +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to "MIDRANGE-L@midrange.com". | To unsubscribe from this list send email to MIDRANGE-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-2024 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.