(1)中具有固定格式源的名称中的字符无效

时间:2014-04-16 22:49:58

标签: fortran gfortran fortran77

我的Fortran 77程序中出现了“(1)中名称无效的错误”。这是为什么?

这是我的阅读声明

      100 READ(S,*,END=200) LINE

但我不确定为什么

代码:

      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

错误:

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:

1 个答案:

答案 0 :(得分:3)

在固定来源表单中,语句标签应出现在第1列到第5列中。

语句字段中的

100200(从第7列开始)被视为实体名称的一部分。名称必须以字母开头。