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



Scott Klement wrote:

Are you sure that escape messages will even work for this task?

Sending an escape message is intended for when a program calls another
program.  If the second program ends abnormally, it uses an escape message
to trigger an exception to the caller.  If the caller doesn't catch that
exception, then it will also crash, and the cycle continues until either a
program handles the error, or you get back to the command line.

However, in your case, what you've got is the operating system running a
routine to update/insert a record in your database.  You see, when you
tell your RPG program to update or write a record, it calls a DB2/400
routine in order to do the actual work. That DB2/400 routine will,
eventually, call your trigger program.

So, your program stack at the time that the trigger runs will look
something like this:

1  P_PEP_CSUPDT  <-- ILE program entry procedure for CSUPDT
2  CSUPDT        <-- ILE procedure CSUPDT
3  _DB_UPDATE    <-- database update routine
4  QDBUDR        <-- routine called by database update
5  _TRGCSDELR    <-- entry procedure for trigger
6  TRGCSDELR     <-- the trigger's main procedure

So if you want to prevent the update, you should send the escape message to the database routine (SMMsgQ '*PGMBDY', SMStack# 1). The database will refuse the update and send an escape message to the requesting program (CSUPDT). The trick then, as Scott pointed out, is finding the useful information in the messages that are sent to you.


Joep Beckeringh

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.