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



1. there are two kinds of DB triggers, PF and SQL table triggers.
There are indeed 2 kinds of triggers, but system and SQL triggers.
System-Triggers are written in an HLL (such as RPG, Cobol, CL or C) and
registered with the CL command ADDPFTRG or as external trigger with the
SQL-command CREATE TRIGGER
SQL-Triggers are purely written with SQL and created and registered in a
single step with the SQL-Command CREATE TRIGGER.

2. 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.
A system trigger is activated as soon as a record will be changed, Updated
or deleted. In an update trigger you can detect if a specific field changed,
because you have access to both, before and after image of the record.
A SQL trigger can be specified at the change of a specific field.

3. since my file is a PF and not an SQL table, I cannot use the SQL trigger
and must use the ADDPFTRG.
Wrong system triggers and SQL triggers can be activated for DDS described
physical files and SQL tables.
You do not have to change your file from DDS described to SQL defined and
vice versa.

For to get more information about triggers I'd suggest to read the following
redbooks:
Stored Procedures, Triggers, and User-Defined Functions on DB2 Universal
Database for iSeries
http://www.redbooks.ibm.com/abstracts/sg246503.html?Open

Modernizing IBM eServer iSeries Application Data Access - A Roadmap
Cornerstone
http://www.redbooks.ibm.com/abstracts/sg246393.html?Open


Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von
MKirkpatrick@xxxxxxxxxxxxxxxxx
Gesendet: Thursday, August 23, 2007 19:43
An: midrange-l@xxxxxxxxxxxx
Betreff: 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.

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.

Third, since my file is a PF and not an SQL table, I cannot use the SQL
trigger and must use the ADDPFTRG.

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

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

Thanks.




This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
Unless you are the addressee (or authorized to receive for the addressee),
you may not use, copy or disclose to anyone this email or any information
contained in this email. If you have received this email in error, please
advise the sender by replying to this email, and delete this email
immediately. Please note that any views or opinions presented in this email
are solely those of the author and do not necessarily represent those of
Western Dental Services, Inc. Finally, the recipient should check this
email and any attachments for the presence of viruses. Western Dental
Services, Inc. accepts no liability for any damage caused by any virus
transmitted by this email.

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.