Focal Point
Line numbers in fex files

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

May 04, 2012, 09:07 AM
shravan
Line numbers in fex files
Hi all,

Is there a way to find out the line number (in run time) in a fex file ?

Like, for example

-TYPE LINENO = &LINENUMBER


Then it will display

LINENO = 275


I thought this would make debugging easier.

Thanks,
Shravan


7.7.03, Windows 7, SQL Server 2005
May 04, 2012, 01:02 PM
Doug
Just some thoughts: It shows "AT OR NEAR LINE" when an error occurs. You can add -TYPE statement when coding...
May 04, 2012, 01:19 PM
shravan
Doug,

Errors don't always show line numbers, especially the ones you catch with &FOCERRNUM. It catches only the last error that occurred. For example, if an error is caused by unbalanced parenthesis, it also throws INCOMPLETE REQUEST STATEMENT error. And &FOCERRNUM catches the last error only (INCOMPLETE REQUEST STATEMENT), with no line numbers, which is not much of a help. That is the problem.

Thanks,
Shravan


7.7.03, Windows 7, SQL Server 2005
May 04, 2012, 03:07 PM
Doug
Would you provide a simple expample. Check your seeting, such as "SET MSG = ON"...
May 04, 2012, 03:41 PM
shravan
Doug,

Currently I don't have any issues with any reports. I am trying to provide a user friendly message whenever an error occurs. For example if I have 10 hold files in a report. I am doing something like

-RUN
-SET &ErrorNumber = &FOCERRNUM;
-IF &FOCERRNUM GT 0 THEN GOTO ERROR ELSE GOTO NOERR;
-ERROR
-INCLUDE ERRORREPORT
-NOERR   


after every hold file so that I catch the error immediately after it happens. INCOMPLETE REQUEST STATEMENT error is thrown after most of the syntax errors. So, some times knowing the error description does not help much because it is not very specific (like INCOMPLETE REQUEST STATEMENT).So, if I know where exactly(line number) the problem is happening, debugging will be easy IF an error happens. That's the idea.

Thanks,
Shravan


7.7.03, Windows 7, SQL Server 2005
May 04, 2012, 04:40 PM
Doug
That's great that you're doing any Error handling (most / a lot of developers don't, everyone should) Kudos to You! Anyway, if you use the -SET &ECHO and ask the users to do a View Source AND send that to you for analysis, that should be all the users need to know, unless you want to display more info, then you can check what Francis has to say about it in his post (here) or search on "text focerrnum" for more posts.
May 04, 2012, 04:41 PM
Dan Satchell
I haven't tried this in newer releases, but it used to be possible to capture error messages from a procedure to a file by doing this at the top of your procedure:

APP FILEDEF EMGFILE DISK EMGFILE.TXT
 or
APP FILEDEF EMGFILE DISK EMGFILE.TXT (APPEND

SET EMGSRV=FILE
-RUN

You could then search EMGFILE, either with -READ/-WRITE or a temp MASTER and TABLE FILE, and display appropriate messages.

To return error messages to standard output:

SET EMGSRV=ON



WebFOCUS 7.7.05
May 07, 2012, 01:09 PM
Doug
About this:
quote:
Errors don't always show line numbers, especially the ones you catch with &FOCERRNUM. It catches only the last error that occurred. For example, if an error is caused by unbalanced parenthesis, it also throws INCOMPLETE REQUEST STATEMENT error. And &FOCERRNUM catches the last error only (INCOMPLETE REQUEST STATEMENT), with no line numbers, which is not much of a help. That is the problem.


How often do you use the "-RUN"? The "Last Error" Should be the last error execution of the stack.

Consider doing a -SET &ErrorMessage = 'Something significant...' ; before and error checking of &FOCERRNUM and use that in you errormessage routine.