> > Hi all.> > I have a very strange problem which I've spent two days trying to fix without success.> > I am getting an error message "File is in use" when the file is patently not in use. A simple DISP STAT shows this.> > Nevertheless the program is crashing so I need to fix it.> > I have now added a CLOSE DATA statement before opening any tables, so presumably there should be no tables open?> > I am not using a DBC database but rather just opening up individual stand-alone tables.> > The code reads as follows:> > CLOSE DATA> SELECT 1> USE table1> SELECT 2> USE table2> SELECT 3> USE table3> SELECT 4> USE table4> SELECT 5> USE table5> > I get the error message "File is in use" on the last line (USE table5).> > How can a file be in use when I have issued a CLOSE DATA statement?> > Also, if I change the order to:> > .............> .............> SELECT 5> USE table5> SELECT 4> USE table4> > then the error message pertains to the USE table4 statement and table5 is actually successfully opened.> > Has anyone got any ideas? > > I'm completely at a loss.> > Thanks in advance.> > Russell.>

Well, I don't think this will specifically fix your problem but there are a couple of things I'd add to your code.

First of all I'd issue CLOSE DATA ALL or CLOSE TABLES ALL. The ALL is pretty important since it spans all availale work areas.

Secondly, it looks like you're opening one table right after another within the same work area. While USE is supposed to close the current table and open the new one, I tend to do things manually. So you might issue a CLOSE TABLES ALL betweeen USE commands. If you want to open all tables in their own separate work area you can issue USE table3 IN 0.