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



Slightly off topic... if LEAVE is new to you, I'd like to point out ...

CALLSUBR
SUBR
ENDSUBR

I hate goto with a passion, every time I see one in this code I'm
maintaining and improving, I scream (even in RPGIII).

My CLLE programs are now...


PGM

/* Program Variables */
DCL &TYPE *CHAR 1

/* Retrieve Job Attributes */
RTVJOBA TYPE(&TYPE)

/* Check Processing Mode */
IF (&TYPE *EQ '0') (DO)
CALLSUBR BATCH
ENDDO
ELSE DO
CALLSUBR INTER
ENDDO
RETURN

/* Interactive */
SUBR INTER


ENDSUBR

/* batch */
SUBR BATCH


ENDSUBR
ENDPGM






On Thu, Jul 25, 2013 at 5:04 PM, Scott Klement
<midrange-l@xxxxxxxxxxxxxxxx>wrote:

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 is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



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