for loop error
Posted: Wed Jul 17, 2013 10:43 am
Hi there! So I'm trying to create a shell program that will take a list of databases and use them in a series of programs. However, when I run it I get the error, "Next found outside of loop or IF statement." The wierd thing is, when I comment out three of the included programs, it runs until it gets an error related to the programs not being included. If I include just one of those problem programs, I'll get the same error again.
I've gone through those three programs and there are no "nexts" without matching "fors". In the actual program, I also have statements before the next that close the databases, etc. that I have opened, but they don't seem to affect anything. Any thoughts on what could be causing this error? Thanks in advance for your help.
%files = @wdir("P:\Growth\Policy\2013_Immigration_Analysis\Output\CGE")
%files = @wkeep(%files, "*hi.edb *md.edb *lo.edb")
for !i=1 to @wcount(%files)
wfcreate(wf=smallbudmod!i,page=annual) a 2004 2023
%begdat = "2006"
%enddat = "2023"
pagecreate(page=quarterly) q %begdat %enddat
pageselect quarterly
smpl %begdat %enddat
'Open the black box
dbopen p:\bbox\final\2013_1\b130114b.edb as rec
'Change working directory to the specified folder
cd "P:\Growth\Policy\2013_Immigration_Analysis\Output\CGE\"
%db = @word(%filenames,!i)
dbopen %db as recnew
include u:\SBM\dataprep.prg
include u:\SBM\snapacaid.prg
include u:\SBM\badmodelui.prg
include u:\SBM\tadmodel.prg
include u:\SBM\badmodel.prg
include u:\SBM\eitc&doccare.prg
next
I've gone through those three programs and there are no "nexts" without matching "fors". In the actual program, I also have statements before the next that close the databases, etc. that I have opened, but they don't seem to affect anything. Any thoughts on what could be causing this error? Thanks in advance for your help.
%files = @wdir("P:\Growth\Policy\2013_Immigration_Analysis\Output\CGE")
%files = @wkeep(%files, "*hi.edb *md.edb *lo.edb")
for !i=1 to @wcount(%files)
wfcreate(wf=smallbudmod!i,page=annual) a 2004 2023
%begdat = "2006"
%enddat = "2023"
pagecreate(page=quarterly) q %begdat %enddat
pageselect quarterly
smpl %begdat %enddat
'Open the black box
dbopen p:\bbox\final\2013_1\b130114b.edb as rec
'Change working directory to the specified folder
cd "P:\Growth\Policy\2013_Immigration_Analysis\Output\CGE\"
%db = @word(%filenames,!i)
dbopen %db as recnew
include u:\SBM\dataprep.prg
include u:\SBM\snapacaid.prg
include u:\SBM\badmodelui.prg
include u:\SBM\tadmodel.prg
include u:\SBM\badmodel.prg
include u:\SBM\eitc&doccare.prg
next