Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

db2 trigger: call a clle from trigger insert

Posted on 2011-03-11
5
Medium Priority
?
924 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 1000 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 1000 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

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

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 (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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

604 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