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



In theory the only people using UPDDTA should be savvy enough to delve 
into the joblog and see the escape message.

>From RPG your WRITE or UPDATE statement could check the %status for:
01023 - Error in trigger program before file operation performed
01024 - Error in trigger program after file operation performed
And then maybe use an API to check the joblog and retrieve the message off 
the stack that was sent as an escape message.

Then again, you could follow the camp that argues for externalizing I/O, 
stored procedures, etc.  Those programs could handle the triggers and 
return a nice error code.  Perhaps even using the standard API error code 
structure.  (I'd still use triggers and/or referential constraints even if 
externalized.  There's always that clown with *ALLOBJ who'd still update 
the file any way they saw fit.  Much like I am often tempted to update 
IBM's directory files instead of using api's.)

Rob Berendt
-- 
Group Dekko Services, LLC
Dept 01.073
PO Box 2000
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





Scott Klement <klemscot@xxxxxxxxxxxx> 
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
06/03/2004 02:13 PM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
cc

Fax to

Subject
Re: Database Trigger and Update problems







Hi Rob,

> Then how does one get the program to signal an error to whatever process
> attempts the update be it your RPG application, UPDDTA, C/S application,
> etc?

Sorry, I said "do not use escape messages to do this" and I
didn't specify what I meant by "this."   Please let me clarify...

It's okay to use escape messages to signal errors to the database
routines...  in that case, you're sending to one call stack level before
the program boundary (*PGMBDY, 1).  All this'll do is tell the DB2/400
routines that there's an error -- they don't care what the error is, they
just know that the trigger failed.

It's not okay to use escape messages to send human-readable messages
directly to your own program.   When you do this, you're bypassing the
database routines, effectively killing them, and returning control
directly to your own routines.

The problem is how to pass the error text back from the trigger to your
application if you don't use the text of the escape message...
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



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.