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



On 9/22/2014 7:09 PM, Nathan Andelin wrote:
Thank you for your detailed reply, Buck. I agree with the idea of
using a "Trigger Mediator". I would send *ESCAPE message from the
Mediator rather than the "Trigger Handler". But I would only use an
*ESCAPE message to STOP an Insert/Update/Delete and flag an error
condition - not to communicate with a previous call-stack entry.

Too many opportunities for the call-stack to contain something
different what your Trigger Mediator or subsequent Handler might
expect.

Well... Maybe? When I wrote the first proof of concept code ten years
ago, the call stack count between the sender and receiver was immutable;
set when designed. No one could slip anything in between the I/O and
the trigger. Even if someone put another trigger in the mix, THAT
trigger would become the I/O program needing failure notification.

Now, with RPGOA, I'm not so sure that the call stack is completely fixed
at design time.

Did you have a chance to look at the Data export example in my
previous message? Error handling would be simpler, and the interface
would be bullet-proof.

In the Trigger Handler:

if trg.aft.email = *blanks; // user didn't fill in an email account?
trg.msg.type = type_error;
trg.msg.column = 'EMAIL';
trg.msg.text = 'Please fill in an email address, which is a required field';
trg.esc = *on;
return;
endif;

In the Application:

write(e) myrec;

if %error() and trg.esc;
... process trg.msg values (ie. show error on screen)...
endif;

...

No messy call stacks to deal with.

I did, and that's a very cool way to craft the interface if you own both
sides. I have to deal with a somewhat less... ordered architecture :-)
and as a result, my I/O programs need to be able to handle RI and
trigger errors more generically.

Thanks for an interesting thread!
--buck


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.