Error in nested loops

Welcome to the forum for MLwiN users. Feel free to post your question about MLwiN software here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Remember to check out our extensive software FAQs which may answer your question: http://www.bristol.ac.uk/cmm/software/s ... port-faqs/
Post Reply
ddsswick
Posts: 9
Joined: Thu Aug 10, 2017 3:27 pm

Error in nested loops

Post by ddsswick »

Hi,

I get the following error when I run a macro. I do not have 2 loops in that macro. But I have 2 'obey' functions. Is it why I do get this error? I am very grateful if someone can help. This only occurs after few loops in the main macro worked well.

error while obeying batch file D:\****\***\Codes\code5.txt at line number 1:
loop b306 1 B30

nested loops must be in seperate obey files


Thank you very much....
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: Error in nested loops

Post by ChrisCharlton »

The shouldn't be a limitation on the number of calls to obey that you can make within a macro. If you could provide a simplified example that demonstrates the problem then I will investigate this further.
ddsswick
Posts: 9
Joined: Thu Aug 10, 2017 3:27 pm

Re: Error in nested loops

Post by ddsswick »

ChrisCharlton wrote: Thu Oct 19, 2017 4:29 pm The shouldn't be a limitation on the number of calls to obey that you can make within a macro. If you could provide a simplified example that demonstrates the problem then I will investigate this further.
Say, I have the main code as 'code1'. Inside that there is an obey command to call 'code2'. Inside 'code2' also there are two obey commands that call 'code3' and 'code4'. When I run 'code1', after some iterations I get this error. The error shows in the loop command in 'code4'.

I am very much thankful if you could help...
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: Error in nested loops

Post by ChrisCharlton »

I tried to replicate the error with the following macros:

code1.txt:

Code: Select all

SAY "inside code1"
LOOP b1000 1 10000
  OBEY "code2.txt"
ENDLOOP
code2.txt:

Code: Select all

SAY "inside code2"
OBEY "code3.txt"
OBEY "code4.txt"
code3.txt:

Code: Select all

SAY "inside code3"
code4.txt:

Code: Select all

SAY "inside code4"
However I did not get the error that you are seeing.
ddsswick
Posts: 9
Joined: Thu Aug 10, 2017 3:27 pm

Re: Error in nested loops

Post by ddsswick »

ChrisCharlton wrote: Fri Oct 20, 2017 9:00 am I tried to replicate the error with the following macros:

code1.txt:

Code: Select all

SAY "inside code1"
LOOP b1000 1 10000
  OBEY "code2.txt"
ENDLOOP
code2.txt:

Code: Select all

SAY "inside code2"
OBEY "code3.txt"
OBEY "code4.txt"
code3.txt:

Code: Select all

SAY "inside code3"
code4.txt:

Code: Select all

SAY "inside code4"
However I did not get the error that you are seeing.
I tired changing few values inside the code. Now the error is not coming.
Thank you very much for taking your time for this.
namphan1998
Posts: 3
Joined: Mon Dec 11, 2017 3:02 am

Re: Error in nested loops

Post by namphan1998 »

Keep up the good work ddsswick

You're dedicated to this site!!

Im also looking for this!!
Post Reply