Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

End-of-file error message

3 views
Skip to first unread message

Wael Alkasawneh

unread,
Nov 12, 2002, 10:35:32 PM11/12/02
to
Hello everyone,

When I compiled my program no error encountered,but when I executed it
it gave this message
"forrtl: severe <24>: end-of-file during read, unit 11,file
D:\myfiles\inputs.dat"
I have tried to solve for this problem, for example:
1-I thought that my input file might have spaces that cause error when
reading the numbers.

2-Adding an error control statement such as"ERR=111"
open (11,file ='inputs.dat',status ='old',action ='read',ERR=111)

I could not solve this problem. May be becuase it is my first time to
write such a program.

Below is part of the program, hopefully someone might help.
Thanks to all
wael

-------------------------
program wael

implicit none
integer::i,j,nels,n,nn,s,iel,NEQ,k,kk,t,mm,mmm,tt,count1,count2
integer::iph,ilo,yy,vv,Nphi,Nload,Ndispx,idisp,rr,count11,count22
real::EI,L,power
!------------------------------dynamic
arrays----------------------------------
real,allocatable::phi(:),length(:),km(:,:),phi1(:,:),load(:)
real,allocatable::dtheta1(:),dtheta(:),lmoment(:),mom(:),dispx(:)

integer,allocatable::pre(:)

!------------------------input and
initialisation------------------------------

open (11,file ='inputs.dat',status ='old',action ='read',ERR=111)
open (12,file ='solution.dat',status ='replace',action='write')
!----------------------------------------------------------------------
! 1-Reading number of elements and EI
!----------------------------------------------------------------------
read(11,*)nels,EI !

nn=nels+1
s=((nels*2)-1)+3
NEQ=s
allocate (phi(nn), length(nels),km(s,s),phi1(nels,nn),load(nn))
allocate (dtheta1(s),pre(s),dispx(nn),mom(nn))
allocate (dtheta(s),lmoment(s))

!----------------------------------------------------------------------
! Initializing Vectors and Arrays
!----------------------------------------------------------------------

do k=1,s
do kk=1,s
km(k,kk)=0.0
end do
end do

do t=1,s
dtheta(t)=0.0
dtheta1(t)=0.0
end do


do i=1,nn
phi(i)=0.0
load(i)=0.0
dispx(i)=0.0
pre(i)=0.0
mom(i)=0.0
end do


!----------------------------------------------------------------------
! 2-Reading Variables provided if any
!----------------------------------------------------------------------
read (11,*) NPhi,Nload,Ndispx
if (Nphi/=0) GOTO 100

100 read (11,*) (iph,phi(iph),yy=1,NPhi)

if (Nload/=0)GOTO 200
200 read (11,*) (ilo,load(ilo),vv=1,Nload)
if (Ndispx/=0)GOTO 300
300 read (11,*) (idisp,dispx(idisp),rr=1,Ndispx)


read (11,*) (length(j),j=1,nels)
count1=1
count2=1
do i=1,s
mm=MOD(i,2)
if(mm/=0)then
dtheta1(i)=dispx(count1)
count1=count1+1
pre(i)=1
else

dtheta1(i)=phi(count2)
count2=count2+1
pre(i)=1
endif

end do


!------------------------------------------------------------------------------
! Matrix
!------------------------------------------------------------------------------
elements_1: do iel=1,nels
n=(iel*2)-1
length(iel)=L

power=L**3


km(n,n)=km(n,n)+12*EI/power
km(n,n+1)=km(n,n+1)+6*EI*L/power
km(n,n+2)=km(n,n+2)-12*EI/power
km(n,n+3)=km(n,n+3)+6*EI*L/power

km(n+1,n)=km(n+1,n)+6*EI*L/power
km(n+1,n+1)=km(n+1,n+1)+((4*EI*L**2)/power)
km(n+1,n+2)=km(n+1,n+2)-6*EI*L/power
km(n+1,n+3)=km(n+1,n+3)+((2*EI*L**2)/power)

km(n+2,n)=km(n+2,n)-12*EI/power
km(n+2,n+1)=km(n+2,n+1)-6*EI*L/power
km(n+2,n+2)=km(n+2,n+2)+12*EI/power
km(n+2,n+3)=km(n+2,n+3)-6*EI*L/power

km(n+3,n)=km(n+3,n)+6*EI*L/power
km(n+3,n+1)=km(n+3,n+1)+((2*EI*L**2)/power)
km(n+3,n+2)=km(n+3,n+2)-6*EI*L/power
km(n+3,n+3)=km(n+3,n+3)+((4*EI*L**2)/power)

end do elements_1

call gauss(NEQ,load,km,pre,dtheta1)
call BAKSUB(NEQ,load,km,pre,dtheta1,dtheta,lmoment)

!------------------------------------------------------------------------------
! outputs
!------------------------------------------------------------------------------
count11=1
count22=1
do i=1,s
mmm=MOD(i,2)
if (mmm/=0) then
load(count11)=lmoment(i)
phi(count11)=dtheta(i)
count11=count11+1
else
mom(count22)=lmoment(i)
dispx(count22)=dtheta(i)
count22=count22+1
endif
end do
!------------------------------------------------------------------------------
! Printing the Node,Displacement,Phi,Moment and Shear
!------------------------------------------------------------------------------

results: do i=1,nn
write (12,1000)i,dispx(i),phi(i),mom(i),load(i)
1000 Format (4x,i5,4x,e12.4,4x,e12.4,4x,e12.4,4x,e12.4)
end do results


111 end program wael

Jim Patterson

unread,
Nov 12, 2002, 11:45:58 PM11/12/02
to

--
Jim Patterson


"Wael Alkasawneh" <wm...@yahoo.com> wrote in message
news:dd7099c.02111...@posting.google.com...

Try putting ,end=xxx after the * inside the parenthesis, where xxx
is a statement number that the program should jump to in order to quit
reading from unit 11. (That is a comma between the * and the word end).


Jim Patterson

Patrick

unread,
Nov 13, 2002, 5:17:33 AM11/13/02
to
You are trying to read too much data from your input file.
One of your READ statement wants to read a line form then file, when
it is at the end of the file. Thus the message 'end of file'.

There is a syntax similar to ERR= for the READ instruction: IOSTAT=

for example:

READ(11,*;IOSTAT=ierr) your_data
if(ierr==0) then
write(*,*) 'no error during read'
elseif(ierr<) then
write(*,*) 'error : end of file'
elseif(ierr>0) then
write(*,*) 'other error'
endif


Hope this helps
Pat


wm...@yahoo.com (Wael Alkasawneh) wrote in message news:<dd7099c.02111...@posting.google.com>...

0 new messages