On 2019-02-17 6:45 PM, Craig Richards wrote:
A few other things you end up having to think about when you start using
sub-procedures:

- You now want to return a value to be sensibly used in an expression -
but how do you tell the caller when something goes wrong?
- Generally I THROW an error in the sub-procedure and catch it in a
monitor block surrounding the sub procedure call (at some level) If you
haven't seen this technique before it's a nice one to know.

Another related way to handle this issue is to also add an optional parameter to receive error information. If the parameter isn't passed, send the exception.

Here's an RPG Cafe blog post I wrote about this issue a few years ago.
https://www.ibm.com/developerworks/community/blogs/b542d3ac-0785-4b6f-8e53-f72051460822/entry/return_code_or_exception?lang=en


This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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].