Solved

db2 trigger: call a clle from trigger insert

Posted on 2011-03-11
5
910 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

Question has a verified solution.

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

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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

688 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