I am a beginner to Fortran and am trying to compile a Fixed-Term Fortran Code using gfortran. I got a bunch of errors, which I could fix them. However, there is an Error related to "EOF" which I could not solve it. Is there any way to fix this problem? (The two "EOF" lines are lines 40 and 121.)
37 OPEN(4,FILE="ABCE.Pn")
38
39 OPEN(5,FILE="../sta.txt")
40 DO WHILE (.not.EOF(5))
41 N=N+1
42 READ(5,*)STA(N)%COD,STA(N)%NAME,STA(N)%LAT,
43 $ STA(N)%LON,STA(N)%H
44 ENDDO
45 NSTA=N
46 CLOSE(5)`
......
121 DO WHILE (.not.EOF(1))
122 READ(1,'(A60)',ERR=999) TIT
123 C IF(IYEAR.GE.2008.OR.
(IYEAR.EQ.2007.AND.MONTH.GE.11))
124 C $ TIT=TIT(2:60)
125 IF(TIT(1:60).EQ.'')THEN ! NEW EARTHQUAKE`
The error:
DO WHILE (.not.EOF(5))
1
Error: Operand of .not. operator at (1) is REAL(4)
ReadP2Pn.for:121.21:
DO WHILE (.not.EOF(1))
1
Error: Operand of .not. operator at (1) is REAL(4)
EOF(5) is non-standard. You should check for EOF in the read statement (which sadly looks like a goto) :
40 DO WHILE (.true.)
41 N=N+1
42 READ(5,*,end=990)STA(N)%COD,STA(N)%NAME,STA(N)%LAT,
43 $ STA(N)%LON,STA(N)%H
44 ENDDO
45 990 NSTA=N