setmaxerrs - syntax error in control statement

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

fi99ggb
Posts: 26
Joined: Tue Jul 02, 2019 4:05 am

setmaxerrs - syntax error in control statement

Postby fi99ggb » Thu Apr 09, 2020 3:28 am

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

EViews Matt
EViews Developer
Posts: 562
Joined: Thu Apr 25, 2013 7:48 pm

Re: setmaxerrs - syntax error in control statement

Postby EViews Matt » Thu Apr 09, 2020 6:47 am

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?

fi99ggb
Posts: 26
Joined: Tue Jul 02, 2019 4:05 am

Re: setmaxerrs - syntax error in control statement

Postby fi99ggb » Thu Apr 09, 2020 7:20 am

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

EViews Matt
EViews Developer
Posts: 562
Joined: Thu Apr 25, 2013 7:48 pm

Re: setmaxerrs - syntax error in control statement

Postby EViews Matt » Thu Apr 09, 2020 12:52 pm

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?

fi99ggb
Posts: 26
Joined: Tue Jul 02, 2019 4:05 am

Re: setmaxerrs - syntax error in control statement

Postby fi99ggb » Thu Apr 09, 2020 11:02 pm

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

EViews Matt
EViews Developer
Posts: 562
Joined: Thu Apr 25, 2013 7:48 pm

Re: setmaxerrs - syntax error in control statement

Postby EViews Matt » Fri Apr 10, 2020 7:07 am

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

fi99ggb
Posts: 26
Joined: Tue Jul 02, 2019 4:05 am

Re: setmaxerrs - syntax error in control statement

Postby fi99ggb » Sun Apr 12, 2020 3:20 am

Thanks Matt. I appreciate the help.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 13 guests