|
On 02-Sep-2015 14:16 -0600, James Rich wrote:
On Wed, 2 Sep 2015, Buck Calabro wrote:
On 9/2/2015 3:36 PM, Charles Wilt wrote:
On 02-Sep-2015 13:31 -0600, James Rich wrote:
We want to send an email if our nightly closing/backup stops
on any kind of error. I thought about monitoring for CPF0000
but I think that will prevent the job from stopping with a
MSGW. I still want the job to stop with MSGW on the line
where the error occurred, I just need some facility to notice
that a MSGW condition exists and send an email. Any
suggestions?
Can't be done.
Either the job stops, or the job doesn't stop (and sends an
email).
You'd need an external process that monitors for the MSGW and
sends an email.
A possible alternative is to MONMSG (ie trap the error), in the
DO() send the email and then re-throw the exception.
I thought about this but couldn't come up with a satisfactory way
to do it. Many programs are called during the execution of the
daily close and I'd want execution to stop at the original point of
execution of the error.
<<SNIP>>
If you are wanting to monitor application program errors why not
have the programmers incorporate error handling into their programs?
For CL do something like this...
At top of program put in this line to handle errors globally.
MonMsg MsgID(CPF0000 MCH0000) Exec(Goto HandleErr)
/* your program does stuff here */
HandleErr:
/*---------------------------------------*/
/* Receive and resend Diagnostic message */
/*---------------------------------------*/
RcvMsg MsgType(*DIAG) MsgDta(&msgData) MsgDtaLen(&msgDtaLen) +
MsgID(&msgID) MsgF(&msgFile) msgFLib(&msgLib)
MonMsg MsgID(CPF0000 MCH0000) exec(GoTo PgmEnd)
If (&msgID *NE ' ') Then(Do)
DMPCLPGM
DSPJOBLOG JOB(*) OUTPUT(*PRINT)
SndPgmMsg MsgID(&msgId) MsgF(&msgLib/&msgFile) +
MsgDta(&msgData) ToPgmQ(*PRV) MsgType(*DIAG)
MonMsg MsgID(CPF0000 MCH0000) /* you don't want to loop */
/* Or call a program that sends an email and also sends an inquiry message to QSYSOPR */
/* call YourPgmName PARM(&rtncode &sndmsg &sndmsgfile &sndmsglib &sndmsgdta) */
/* MonMsg MsgID(CPF0000 MCH0000) Exec(Do) */
/* do what you will */
/* enddo */
GoTo PgmEnd
EndDo
/*-----------------------------------*/
/* Receive and resend Escape message */
/*-----------------------------------*/
RcvMsg MsgType(*EXCP) MsgDta(&msgData) MsgDtaLen(&msgDtaLen) +
MsgID(&msgID) MsgF(&msgFile) msgFLib(&msgLib)
MonMsg MsgID(CPF0000 MCH0000) exec(GoTo PgmEnd)
If (&msgID *NE ' ') Then(Do)
SndPgmMsg MsgID(&msgId) MsgF(&msgLib/&msgFile) +
MsgDta(&msgData) ToPgmQ(*PRV) MsgType(*ESCAPE)
MonMsg MsgID(CPF0000 MCH0000)
/* Or call a program that sends an email and also sends an inquiry message to QSYSOPR */
/* call YourPgm PARM(&rtncode &sndmsg &sndmsgfile &sndmsglib &sndmsgdta) */
/* MonMsg MsgID(CPF0000 MCH0000) Exec(Do) */
/* do what you will */
/* enddo */
GoTo PgmEnd
EndDo
GoTo PgmEnd
You can use whatever you currently use to send the email.
<<SNIP>>
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.