Solved

db2 trigger: call a clle from trigger insert

Posted on 2011-03-11
5
898 Views
Last Modified: 2012-05-11
Hi,
I would like to call a CLLE procedure
from a Trigger Insert.
I have a table called UPDATECMD, with a field 'OK'
when, from pc by ODBC driver, I insert a row,
I want to run a CLLE program on aS400.
How to do so?
Thanks

0
Comment
Question by:bobdylan75
  • 3
5 Comments
 
LVL 37

Accepted Solution

by:
momi_sabag earned 250 total points
ID: 35107857
create an external stored procedure that runs the program and use the CALL statement to call it (that how it should be done in zOS, i believe as400 should be similar)
0
 

Author Comment

by:bobdylan75
ID: 35108120
Sorry,
can you write the code of this store procedure?
thanks..
0
 

Author Comment

by:bobdylan75
ID: 35108308
sorry of the trigger..
0
 
LVL 16

Assisted Solution

by:theo kouwenhoven
theo kouwenhoven earned 250 total points
ID: 35108399
Just add the trigger like this:

ADDPFTRG FILE(UPDATECMD)  
         TRGTIME(*AFTER)  
         TRGEVENT(*INSERT)
         PGM(MYPROGRAM)  

If required you can use qualified file and program names.

If your trigger is making changes to the record. (you can by changing the buffer before insertion)
Then you have to use the same command with different parms:

ADDPFTRG FILE(UPDATECMD)  
         TRGTIME(*BEFORE)  
         TRGEVENT(*INSERT)
         PGM(MYPROGRAM)    
         ALWREPCHG(*YES)  


Beware, you have to remove the trigger before you add it again, or use CHGPFTRG otherwise you have 2 triggers on your file.

After the trigger is added, you can update the file from whatever program or even FTP, it will fire the trigger until it is removed or.... until you *Disable it with the CHGPFTRG command.


Good Luck
Murph
0
 

Author Closing Comment

by:bobdylan75
ID: 35108433
Thank you!
see you later...
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SELECT * FROM [Stored Procedure] 6 103
db2 != check 14 54
Read e-mail from SMTP account - using RPG code 6 90
Monitoring IBM System x through PRTG 7 140
Recursive SQL in UDB/LUW (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question