I am getting an eror "Invalid character in name at (1)" in my Fortran 77 program. Why is this?
It is in my read statement
100 READ(S,*,END=200) LINE
but I am not sure why
Code:
PROGRAM Exercise
C
C PARAMETERS
C
INTEGER UNUM
PARAMETER (UNUM=15)
C
C LOCAL VARIABLES
C
REAL LINES
C
C FUNCTION DECLARATIONS
C
REAL NUMLIN
C
C COMMON VARIABLES
C
C
C DATA STATEMENTS
C
C MAIN PROGRAM MODULE
C
OPEN(UNIT=UNUM, FILE = 'line.txt', STATUS='OLD')
LINES=NUNMLIN(UNUM)
C
C Rewinding to the top of the file because the pointer is at the end
C of the file
C
REWIND(UNUM)
CLOSE(UNUM)
CALL PROCES(UNUM,LINES)
STOP
END PROGRAM
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C SUBROUTINE PROCES
C
C dynamically allocates space
C
SUBROUTINE PROCES(U,L)
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C FUNCTIONS
C
C NUMLIN - counts the number of lines, uses the fact that the file
C is already open and passes this information to the next subroutine
C
REAL FUNCTION NUMLIN(S)
REAL NUMLIN
REAL S
CHARACTER*256 LINE
100 READ(S,*,END=200) LINE
NUMLIN=NUMLIN+1
GOTO 100
200 CONTINUE
RETURN
END
Error:
NumberCountingExercise.for:90.7:
100 READ(S,*,END=200) LINE
1
Error: Invalid character in name at (1)
NumberCountingExercise.for:93.7:
200 CONTINUE
1
Error: Invalid character in name at (1)
NumberCountingExercise.for:85.27: