× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Booth wrote:
>I will admit to not understanding it though.  Since we 
>are only changing the buffer and not the record why 
>does the database care? 

The buffer = the record.  If I remember rightly, RPG assembles the data from
your individual fields into an internal I/O buffer (think of it as
concatenating each field together into one long string)  The internal I/O
buffer is then passed to the data manager as a unit.  At this point, the
database manager has two versions of the record: the original record and the
changed record.  If you fire a trigger, the DB manager sends both versions
to the trigger buffer.  The trigger can then inspect either side or both
(before or after) to make decisions on what to do.  If you have
ALWREPCHG(*YES), you can manipulate the after image directly in the buffer
passed to the trigger.  If the trigger program ends normally, the after
image is passed back to the DB manager which replaces it in the virtual
memory space.  If the trigger program ends abnormally (signals an exception)
the after image is discarded and the program that made the change (not the
trigger - it's ended) gets an I/O error because the record was not affected.
(I'm not going to get caught up in the "when do the electrons go on the disk
platter" problems in this thread!)

The "repeated change" mentioned refers (I think) to the fact that the
application program made a change to the record, and now the trigger wants
to make a change as well.  Two changes = repeated change to the same record.

>And why not just always 
>set the parm at *YES?  What is the downside?  
>What protection or efficiency does it provide?

Security?  If there's some sneaky programmer who changes the payroll master
trigger program to add some zeroes to her net pay by playing with the after
image, she won't be allowed to at run time.

Buck Calabro
+---
| 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 thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.