Focal Point
[SOLVED] Automatically detect that scheduled report has failed

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5787057666

January 16, 2014, 06:19 PM
Marc97229
[SOLVED] Automatically detect that scheduled report has failed
Is there a way to get a message (email or otherwise) when a scheduled report fails?

Unfortunately there is no guarantee that a report runs properly when it is scheduled, even though it runs fine in the browser with exactly the same parameters. So we are forced to schedule each report and check the results before each and every product release. This is very time-consuming, boring, and error prone.

So we are looking for a way to detect that (the execution of) a scheduled report failed.

Ideally we would get an alert if a report failed, at a configurable email address.
Or else we would go to a web page that would show us an entry for each report we have scheduled and for each entry when it last ran and if the last run was successful or not.

We are willing to manually register each report when it is scheduled (even though this seems superfluous - the ReportCaster knows of all the scheduled reports).

If nothing else can be done, we would already be grateful if we could just get a concatenation of the logs of all scheduled report.

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 8.0.0.8, Windows 7
January 17, 2014, 03:47 AM
Wep5622
ReportCaster writes its results into a database that you can report on. The data you are looking for is in the BOTLOG and BOTLOG2 tables.

One word of warning, we have a case open where errors in procedures executed (EX foo bar=1 baz=2 etc.) from another procedure in RC do not propagate to the top procedure. As a result RC reports the job as completed successfully, while it did encounter errors.
If you just -INCLUDE other procedures, errors are reported correctly as far as we have seen.

Example code:
-DEFAULT &LOGDATE = &YYMD.EVAL;

JOIN
 STAT_BT_NAME IN BOTLOG2 TO
 STAT_BT_NAME IN BOTLOG AS J0
 END
DEFINE FILE BOTLOG2
 DATE0/HYYMDS = HINPUT(8, '19700101', 8, DATE0);
 STARTHDATE/HYYMDS = HADD(DATE0, 'ms', START_STAMP, 8, STARTHDATE);
 LOGDATE/I8YYMD = HDATE(STARTHDATE, 'YYMD');
END
TABLE FILE BOTLOG2
PRINT
 MSG_CODE AS 'Message,code'

BY HIGHEST LOGDATE
BY HIGHEST STARTHDATE AS 'Log,date'
BY COUNTER AS ''
BY MESSAGE AS 'Message'
BY STAT_BT_NAME AS 'Job ID'
BY JOB_DESC AS 'Job,desc.'
BY TASKOBJ AS 'Task,object'

WHERE ERROR2 EQ 'Y';
WHERE LOGDATE GE '&LOGDATE';
END



WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
January 17, 2014, 09:42 AM
Ian Dalton
Why don't you just set the Notification Tab (click to Open Schedule first) to send out a message 'On Error' or is that not informative enough ?


_______________________
*** WebFOCUS 8.1.05M ***
January 17, 2014, 10:15 AM
George Patton
Look at the Notification tab in the ReportCaster schedule setup and choose "On Error" You'll get some additional fields to fill out including where to send the error message.


hmmm.... there seems to be an echo in here !


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
January 17, 2014, 10:27 AM
Tom Flynn
How do these last 2 suggestions reflect the question, "Automatically", which, actually means, "Programically".
Wep suggested 1 answer, we have used that, but is a report and after the fact. Capturing the error in Task1 and generating a HTML message in Task2 is another way, which we also use...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
January 18, 2014, 10:45 AM
George Patton
quote:
How do these last 2 suggestions reflect the question, "Automatically", which, actually means, "Programically".


Tom: I guess it all depend on one's definition of "automatic". A notification that the report has failed that appears magically in my e-mail seems pretty automatic to me ...


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
January 18, 2014, 07:56 PM
Marc97229
Thank you guys!

Either one works. I let the QA people decide what they want to use.

I myself like to use a SQL query (based on the WF code):

SELECT DATEADD(s, (CAST(END_STAMP AS bigint) - 24 * 3600 * 1000 * (CAST(END_STAMP AS bigint) / (24 * 3600 * 1000))) / 1000, DATEADD(dd, (CAST(END_STAMP AS bigint) / (24 * 3600 * 1000)), '1970-01-01')) AS [TimeStamp],
Job_Desc, RC_Message, ERROR2 AS IsError
FROM [dbo].[BOTLOG2] bl2
INNER JOIN [dbo].[BOTLOG] bl
ON bl2.STAT_BT_NAME = bl.STAT_BT_NAME
WHERE ERROR2 = 'Y'
ORDER BY [TimeStamp] DESC


WebFOCUS 8.0.0.8, Windows 7