|
MONITOR doesn't provide all the same functions as condition handlers. Using MONITOR, you can choose which status codes to monitor for by coding one or more ON-ERROR statements. But once you are in an ON-ERROR, the message has already been handled, and you can't promote it. You could receive the message in the ON-ERROR, and then issue a different one of your own, but the "from pgm" of the new message would be your MONITOR program, and not the original frompgm.
Couldn't you do something like the following? D QMHMOVPM PR ExtPgm('QMHMOVPM') D MsgKey 4A const D MsgTypes 10A dim(4) options(*varsize) D const D NumMsgTypes 10I 0 const D ToStack 10A const D ToStackCnt 10I 0 const D ErrorCode 8000A options(*varsize) D QMHRSNEM PR ExtPgm('QMHRSNEM') D MsgKey 4A const D ErrorCode 8000A options(*varsize) D ErrorNull DS qualified D BytesProv 10I 0 inz(0) D BytesAvail 10I 0 inz(0) D x s 5I 0 inz(1) D y s 5I 0 inz(0) D z s 5I 0 inz(0) /free monitor; z = x / y; on-error; QMHMOVPM(' ':'*DIAG':1:'*PGMBDY':1:ErrorNull); QMHRSNEM(' ':ErrorNull); endmon;The QMHMOVPM moves the diagnostic errors (if any) and the QMHRSNEM resends the escape message.
Of course, if you're not interested in the diagnostic messages, it would take much less code :)
D QMHRSNEM PR ExtPgm('QMHRSNEM') D MsgKey 4A const D ErrorCode 8000A options(*varsize) D ErrorNull DS qualified D BytesProv 10I 0 inz(0) D BytesAvail 10I 0 inz(0) D x s 5I 0 inz(1) D y s 5I 0 inz(0) D z s 5I 0 inz(0) /free monitor; z = x / y; on-error; QMHRSNEM(' ':ErrorNull); endmon; *inlr = *on; /end-free
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.