- #1
Kyong
- 3
- 0
Fortran:
implicit none
character*4 head1,head2,ext
character*10 fn1,fn2
integer i,kev
head1='jack'
head2='jill'
ext='.dat'
do i=1, 50000
kev=int((i-1)/50)+1000
if(mod(i,50).eq.0) then
write(fn1,'(a,i4,a)') head1,kev,ext
write(3,*) fn1
write(fn2,'(a,i4,a)') head2,kev,ext
write(4,*) fn2
open (unit=3,file=fn1,status='unknown')
open (unit=4,file=fn2,status='unknown')
endif
write(3,*) i,i**2.
write(4,*) i,i**3.
if(mod(i,50).eq.0) then
close(3)
close(4)
endif
enddo
end
I want to write a code that can generate five thousand output files with jack1001.dat, jill1001.dat, ..., jack6000.dat, jill6000.dat...This code is compiled well without any error or warning message but if running the produced executable file, it showed error message :
At line 12 of file test3.f
Fortran runtime error: End of record
Can anyone help me?
How should I correct my code?
Thank you,