Focal Point
Catching Focus errors

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

January 03, 2006, 10:39 AM
<bigpgo>
Catching Focus errors
Hello all. I'm trying to prevent the report from running if I selected an invalid holiday file (file that isn't found). Otherwise, the report will run 'normally', but all the business day calculations will be wrong.

So I have:
SET HDAY = &myHolidayFile

Is there a way to detect the error and abort the report if the holiday file name isn't found?
((FOC1892) FILE NOT FOUND error). Thanks in advance.
January 03, 2006, 01:43 PM
Francis Mariani
Interesting.

Normally, this would trap a WebFOCUS error:

-SET &MYHOLIDAYFILE = 'BAD';
-SET &ECHO=ALL;

SET HDAY = &MYHOLIDAYFILE
-RUN

-IF &FOCERRNUM NE 0 GOTO FOCUS_ERROR;

-TYPE HOLIDAY FILE FOUND

-GOTO PROGRAM_END

-FOCUS_ERROR

-TYPE WEBFOCUS ERROR: &FOCERRNUM

-PROGRAM_END

Except, for this particulr request, &FOCERRNUM is 0 even though an error message is displayed.

Weird.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
January 03, 2006, 04:22 PM
j.gross
SET HDAY=whatever
-RUN
-? SET HDAY &HDAY


will retrieve the new setting (in &HDAY). The value will remain unchanged (typically blank) if the SET HDAY command failed.
January 03, 2006, 04:33 PM
susannah
and i would offer this way, if you're on a windows box
FILEDEF HOLIDAY DISK D:\IBI\APPS\FHOLIDAY.FTM (or .txt or whatever)
CMD STATE D:\IBI\APPS\FHOLIDAY.FTM
-RUN
-IF &RETCODE EQ 0 GOTO process ;
-* the return code is 0 when ok, not zero (-1 i think) when it fails, ie files doesn't exist
-TYPE HOLIDAY FILE ISN'T THERE FOLKS.
-GOTO EOJ ;
-process
TABLE FILE HOLIDAY...etc




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
January 03, 2006, 06:32 PM
<bigpgo>
Thank you all for replying. Yup, I was puzzled myself when FOCERRNUM was staying at 0. And unfortunately, we're running this on a unix box. However, j.g.'s approach worked for me.
So it looks like:
- ? SET varName &XYZ

pumps the value of varName into a new variable, &XYZ. Very cool. Thanks.