× 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.



-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of
MKirkpatrick@xxxxxxxxxxxxxxxxx
Sent: Thursday, August 23, 2007 10:43 AM
To: midrange-l@xxxxxxxxxxxx
Subject: Triggers

I have a PF where when a certain field is changed I wish to write a copy

of the record to another file. Obviously, I could do this in the RPG
pgm
but prefer to not change the pgm.

I have been reading about triggers and would like some confirmation on a

couple things.

First, there are two kinds of DB triggers, PF and SQL table triggers.
I am not sure on this one.

Second, the PF trigger cannot detect an update to a specific field,
while
the SQL trigger can execute when a change in a specific column is
detected.
The PF trigger fires when the record is changed, this is if you do add a
change trigger, not an add or delete trigger. In a change trigger, you
get the before and after image of the record so you can check your field
and perform the action you need. Since you only want to record the
change, I would do an *AFTER *CHANGE trigger.

Third, since my file is a PF and not an SQL table, I cannot use the SQL
trigger and must use the ADDPFTRG.
I know nothing of the SQL trigger but the ADDPFTRG will work.

Fourth, if I were to change my PF to an SQL table, an SQL trigger would
be
a good choice to address my issue.
No need to be changing any files.

Any other suggestions as to how to handle my situation are also welcome.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.