Page 1 of 1

"too many files" runtime error

Posted: Wed Mar 08, 2006 9:39 pm
by Hank
I?ve written a PDS 7.1 (QuickBasic) program that requires 18 + 5 = 23
files to be opened simultaneously (I know that some programmers will
argue that no one ever needs to have this many files open at one time,
but let?s suppose for the purpose of this discussion that they?re wrong).
My operating system is Windows 98 SE with a 20 GB hard drive and 128
MB RAM. To override DOS? default limit of 15 + 5 = 20 files, I included in
my source code the lines

InRegs.AX = &H6700
InRegs.BX = 23
CALL INTERRUPT(&H21, InRegs, OutRegs)

The object and executable programs were created with no problem using
the bc and link commands. However, when I run the .EXE program
(about 135,000 bytes), I get a ?too many files? at such and such address
error message. I tried altering the ?files =? line in config.sys, but that
doesn?t help. A very short test program I wrote just to see if 25 files
(InRegs.BX = 30) can be opened at the same time works ok, so this
suggests to me that the problem may have something to do with memory
accessibility. Using SETMEM in the larger .EXE to release additional
memory didn?t work either, although this is to be expected since BASIC
allocates as much memory as possible to the far heap when a program
starts.
By restricting the values of two parameters I have been able to open
16 + 5 = 21 files simultaneously and successfully run a modified version
of the .EXE. But this modification severely limits what the program is
intended to do. I used the FRE function in both the original and
modified .EXEs to give you an idea of what memory resources are
available when each program is run:

FRE(0) FRE(-1) FRE(-2) SETMEM(0)
--------- ---------- ---------- ----------------
Original .EXE 45432 459304 4046 474112

Modified .EXE 45448 460312 4046 475088

FRE(0) returns the remaining space in DGROUP (in bytes)
FRE(-1) returns the remaining space in far memory for DOS (in bytes)
FRE(-2) returns the remaining stack space (in bytes)
SETMEM(0) returns the current size of the far heap (in bytes)

There doesn?t seem to be that big a difference in the memory available to
each program, but as I?ve mentioned the original .EXE generates a ?too
many files? error message whereas the modified .EXE does not. I
appreciate any ideas you may have on how I can get the original .EXE to
run successfully (I?m hoping for something akin to a CALL INTERRUPT that
can be included in the source code, although of course I will be grateful
for just about anything that will work). Thanks.

Hank

Posted: Wed Mar 08, 2006 9:59 pm
by RyanKelly
Have you tried the original program with the file handle limit set higher than 23? DOS itself keeps at least 4 file handles open at all times. I'm not sure if this is your problem, but it might be a good place to start.

Too many files

Posted: Fri Mar 10, 2006 4:43 am
by Valerie
Error code 67?

Any chance you have gone over the limit of the number of files in the root directory?

See here...
________
Hiroshima Plant