A problem in writting a sequential binary file (compiled with LF95)



Hey, Guys:

I met a strange problem in writting a sequential binary file. My code
shown as below is compiled with LF95.

+++++++++++++++++++++++++++++++++++++++++++++++++++
program binarytest

real*8 test(20000)

integer*4 testnum

testnum=1001

do i=1,20000
test(i)=i*i*3./1000.
enddo

OPEN(33, FILE='test', ACCESS='sequential', FORM='binary')

do i=1,testnum
write(33)test(i)
enddo

CLOSE(33)

stop
end
+++++++++++++++++++++++++++++++++++++++++++++++++++

The problem is a little weird. If I give the "testnum" a small value
like 1001, it works well. But If a bigger value e.g. 3000 is given, an
error message as below will appear:

****************************************************************************
An I/O error was detected (system call=write, errno=6, system
message="bad file
number", unit=33).
Program Completed
Press Enter to Continue.
****************************************************************************

And the generated file has less than 8 KB data.

I'm quite confused. Could anyone help me out?

Many thanks in advance!

P. Wholey

.