On 26/07/2005, at 8:26 AM, Paul Morgan wrote:

All just because the exception handling model on the 400 (escape messages)
doesn't allow for automatic propagation up the call stack.
Not quite true. In an ILE environment exceptions are propagated up the 
call stack until a control boundary is reached.
You either
handle it at the target of the escape message or the system takes over with some default handling. Because of that model your subroutine has to have knowledge of the top level entry point. That's unnecessary cohesion between
the subroutine and the 'top level' point.
Not true. You can send to *PGMBDY plus 1 relative invocation level and 
know that the message will be sent to the caller of the program 
containing your sub-routine or procedure regardless of what program is 
the caller.
Better would be the subroutine throwing an exception to it's caller (where's the RPG THROW opcode?). Let the caller decide to handle the exception or if
it's ignored it gets automatically bubbled up to it's own caller.
That's exactly what happens with ILE procedures but it stops at the the 
first control boundary. Easy solution is to have each program that 
starts a control boundary catch all exceptions. They can either handle 
them or throw them on. Eventually someone will either handle it or the 
system default handler will deal with it.
Eventually it would then reach your 'top level' point that would handle the exception. If it's not handled it would reach the top of the call stack and
get some default handling like ending the job or breaking on QSYSOPR.
Sounds like the above description. Easy enough to do with existing 
functions.
Regards,
Simon Coulter.
--------------------------------------------------------------------
   FlyByNight Software         AS/400 Technical Specialists

   http://www.flybynight.com.au/
   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175                                   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------



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-2025 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 copyright@midrange.com.

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.