On 2018-09-04 9:02 AM, Steve Jones wrote:
I had a program fail & I "D"umped it. The reported dump shows the calling
procedure as what failed, but what really failed was a line of called that
is in another proc, that is called from the proc that the dump reported,
not very helpful.
What do I need to change so that it would have reported the line of code
that actually caused the failure?
You could add a MONITOR block in the procedure with the error and add a
DUMP(A) opcode in the ON-ERROR section. But now you'll have to have a
way to notify your caller that you failed, since the MONITOR handled the
error.
Or you could enable a condition handler (API CEEHDLR) where the handler
is in the same module as the called procedure, and put a DUMP(A) opcode
in the handler. The handler wouldn't actually handle the message **, it
would just return with Action = Percolate, and ordinary RPG exception
handling would still happen.
** Note: Never actually handle an exception (Action = Resume) in a
condition handler, hoping to continue at the next instruction. The "next
instruction" isn't the next RPG statement, but the next low-level
machine instruction. So if you handle an exception in the middle of the
code generated for an RPG statement, it would continue processing the
rest of the statement, possibly with bad data.
As an Amazon Associate we earn from qualifying purchases.
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.