Page 1 of 1

setmaxerrs - syntax error in control statement

Posted: Thu Apr 09, 2020 3:28 am
by fi99ggb
Hello

I am using the setmaxerrs command to ignore errors and works fine in the majority of the errors encountered. However, it looks like execution is halted when the error is in relation to a for/loop. Is there a way around it? Am I missing something?

Thanks
George

Re: setmaxerrs - syntax error in control statement

Posted: Thu Apr 09, 2020 6:47 am
by EViews Matt
Hello,

There are about two dozen "critical" errors that halt an EViews program even when setmaxerrs is being used. Most of those errors relate to syntax errors, which cannot be safely ignored and should be fixed in the program. What is the exact error you're receiving?

Re: setmaxerrs - syntax error in control statement

Posted: Thu Apr 09, 2020 7:20 am
by fi99ggb
Hi Matt

I typically encounter these errors when a WF does not exist or a variable is not defined and I reach the point where I have a for-loop command.

Most importantly, what I am trying to do is to continue "executing" the code until the end of the file is reached where I instruct EViews to notify me for the error (push a log file to Oracle database) and then stop. Effectively, what I want to do is to reach the end of the program file regardless of the type of error (even if it is critical or I have not encountered it before). Would that be possible?

Thanks
George

Re: setmaxerrs - syntax error in control statement

Posted: Thu Apr 09, 2020 12:52 pm
by EViews Matt
While there's no way to suppress critical errors, neither of the errors you've mentioned are in the critical category. Is it possible setmaxerrs simply isn't set large enough?

Re: setmaxerrs - syntax error in control statement

Posted: Thu Apr 09, 2020 11:02 pm
by fi99ggb
Hi Matt

Thanks for your reply.

I get the same error regardless of the setmaxerrs value. I set out below an example code to explain where I typically get the error. If the dataset is missing, EViews stops despite the setmaxerrs. Is there a way for EViews to ignore this error?

Thanks
George

'==========================================
'Sample code
setmaxerrs 10000000

'Define variables
group GroupSales Sales_*
%Variables = GroupSales.@members

'Loop
for %Var {%Variables}
series test_{%Var} = 0
next

Re: setmaxerrs - syntax error in control statement

Posted: Fri Apr 10, 2020 7:07 am
by EViews Matt
Ah, I see the problem scenario now. When %Variables is empty because the assignment to it has failed, then the for statement effectively becomes just "for %Var", which is an ill-formed expression and a critical error. Since you cannot suppress this error, your best bet is to alter the program to avoid it, for example,

Code: Select all

if @length(%Variables) > 0 then for %Var {%Variables} ... next endif
You can still record in your log that there was an issue with %Variables, for example,

Code: Select all

if @length(%Variables) > 0 then for %Var {%Variables} ... next else seterr "%Variables was undefined" endif

Re: setmaxerrs - syntax error in control statement

Posted: Sun Apr 12, 2020 3:20 am
by fi99ggb
Thanks Matt. I appreciate the help.