Nathan



I do believe that you are mixing names here. What you have posted is a
service program that isolates RLA access to a table. I would call that an
I/O module or a File Server. Then you have isolated the validation of data
in a row in another service program but it isn’t a traditional DB2 trigger
and may be overruled.



I have used File Servers since System/36 where I ran ASNA RPG III and also
in the early days of AS/400 because opening and closing tables was a time
consuming operation that took up a lot of resources.



A trigger is an external program or a stored procedure that you place on
the table and they can’t be circumvented. The service program is executed
before or after I/O to the table regardless where the actual I/O comes from
(DFU, SQL, RPG, COBOL or other).



To my best knowledge a trigger, even if it is executed before the I/O,
isn’t able to prevent the I/O being done so triggers are limited unless you
at the same time as you build in a validation and a way to message back to
the caller (that is not standard in a trigger) and combines it with
commit/rollback in the caller.



This out rules such triggers being used in DFU, raw SQL or external access
from pase etc. because you need some home brewed messaging system and still
need commit/rollback in the caller.



Triggers could be used to update other tables based on the change of data
in the table it is connected to but it is actually a bad idea since the
other tables also may have triggers so one trigger may cause a cascade of
events in you DB that you have no way to control.



So IMO a trigger should just be seen as an advanced way to make
‘programmable’ journaling.



I use triggers to monitor changes made in specific ‘sensitive’ fields. It
monitors what program and who made the change and logs the changes in a
common journal file that again may cause messages to be send to other users
that the change has been made. This is mainly done to prevent internal
fraud by manipulating sensitive data such as product prices that are
lowered while a ‘friends’ order is placed in the system, credit limit are
changed, due dates are prolonged, bank account numbers the system transfers
money to is changed etc.

On Sun, Oct 4, 2015 at 12:55 AM, Nathan Andelin <nandelin@xxxxxxxxx> wrote:


Nathan
how du expect that triggers should signal back to the client (program)
in a
common way that is supported in any program language SQL etc.?


Henrik,

In the code sample I posted previously, it showed calls to a procedure
named trgMsgAdd(), which I use to return messages to ILE "callers". The
same procedure would be used to "log" messages which might subsequently be
retrieved from applications which might be running in other language
environments (Java, PHP, Python, Ruby, Etc.)
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.