Solved

db2 trigger: call a clle from trigger insert

Posted on 2011-03-11
5
891 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
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…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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