Hiya Dan,

Doesn't MONMSG allow this functionality already? Couldn't you do this?

ChkObj QSTRUPEX1 *Pgm /* Check for exit program. */
MonMsg MsgId(CPF9800) Exec(DO)
/* handle expected error here */
EndDo
MonMsg MsgId(CPF0000) Exec(DO)
/* Unexpected error.. call QMHRSNEM API to send message +
back to caller ... */
EndDo

Call QSTRUPEX1
MonMsg MsgId(CPF0000) Exec(Do)
/* Handle error or whatever */
EndDo

Ahh, I see the bit about nesting the try/catch. That might not work with MonMsg as is... though you might be able to get close with a global monmsg vs. specific monmsg.

Not saying that monmsg is quite as nice as Java's try/catch... but it's possible to do some of the same stuff, right?


On 7/25/2013 2:23 PM, Dan Kimmel wrote:
A structure that might better represent the original intention might be like this:
try {
try {
ChkObj QSTRUPEX1 *Pgm /* Check for exit program. */
} catch MonMsg(CPF9800) { // no exit program
Throw CPF9800
}
Call QSTRUPEX1 /* Run it. */
} catch MonMsg(CPF0000) {
// do nothing
} finally {
// do nothing
}

Re-throwing the CPF9800 causes the message to be caught by the MonMsg(CPF0000) in the outer try block which does nothing and exits the block.


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