Muhajjir Ajir February 2016

unclassifiable statement at (1) Fortran Error

at line 64 confirmed as the errors began

I was asked to modify a legacy code. I have found these errors when compiling error compiling picture . Does anybody know how to solve these errors? I use gfortran as my compiler.

The source code:

   * Spectral analysis of measured data *

      PARAMETER (ND=86400,NSP=43200,NND=86400)
      COMMON /WDATA/ WD(NND),WD2(NND)
      COMMON /SPEC/ WSP(NSP)
      COMMON /TSDATA/ TS(ND*2),CTTS(ND*2)
      COMMON /SPDATA/ P(NSP),DF

      REAL MEAN

      DATA DT/1.0/
      DATA COTL/14400.0/
      DATA COTS/600.0/
      PI=3.141593

      OPEN(32,FILE="Pw.txt",STATUS="OLD")

      OPEN(12,FILE="output1",STATUS="UNKNOWN")

      OPEN(13,FILE="output2",STATUS="UNKNOWN")

      DO J=1,NND
          READ(32,*)WD(J)
      END DO

       TOTAL=0.0
       MEAN=0.0
       DO J=1,NND
        TOTAL=TOTAL+WD(J)
       END DO

        MEAN=TOTAL/FLOAT(NND)

        DO J=1,NND
         WD(J)=WD(J)-MEAN
        END DO

    Numerical filtering and Spectral analysis

      M=ND/2
      KF=1
      TD=DT*FLOAT(ND)
      DF=1./TD

      DO J=1,ND          
        TS(J)=WD(J)
        TS(J+ND)=0.
      END DO  

      COFL=1./COTL
      COFH=1./COTS
      NCUTL=IFIX((COFL+DF/2.)/DF)+1
      NCUTH=IFIX((COFH-DF/2.)/DF)+1
      =========================  
      CALL CUTOFF(M,NCUTL,NCUTH)
      =========================
      DO J=1,ND
        WD2(J)=CTTS(J)
      END DO
     =================================
      SUBROUTINE CUTOFF(M,NCUTL,NCUTH)
     =================================
      PARAMETER(ND=86400,NSP=43200)
      COMMON /TSDATA/ TS(ND*2),CTTS(ND*2)
      COMMON /FFTDATA/ W1(ND*2)
      MM=M+M
      M4=MM+MM

      DO J=1,MM
        W1(2*J-1)=TS(J)
    W1(2*J)=TS(J+MM)
      END DO
      ===============
      CALL FOUR1(MM,1)
      ===============
      DO J=1,M
        IF(J.EQ.1.AND.NCUTL.GT.0)THEN
      W1(1)=0.
      W1(2)=0.
        ELSE IF        

Answers


RussF February 2016

You haven't closed the main program with an end statement before the subroutine cutoff statement

      DO J=1,ND
          WD2(J)=CTTS(J)
      END DO
      =================================
      SUBROUTINE CUTOFF(M,NCUTL,NCUTH)
      =================================

This should read something like

      DO J=1,ND
         WD2(J)=CTTS(J)
      END DO
      END
      SUBROUTINE CUTOFF(M,NCUTL,NCUTH)

however that doesn't really make sense. I'm sure there are more missing lines. There are also many illegal statements in the code presented mostly due to bad formatting as Vladimir F has noted.


Blake February 2016

Muhajjir,

If gfortran is anything like fortran used to be, this code will generate a plethora of errors. One thing is for sure, there does HAVE to be and END statment at the end of the main. Otherwise, the compiler gets VERY confused. In addition, some of your statments appear to have code to the left of column 7. Remember, fortran dates from the days of IBM punch cards, which were HIGHLY column oriented. A capital 'c' was typically used, in column 1, to indicate a comment. Column 6 was reserved for continuation character, which eventually became any character you wanted, as long as column 6 was not empty. Numbers used as labels HAD to start in column 1 and could not go past column 5 into 6, or beyond. This code looks like many of these basic rules have been violated. Check everything, straighten it all out, and everythng should be fine. If not, we can go from there.

                                 Blake Mitchell
                                 Retired free lance programmer

P.S. To whom it may concern, I have read through the how to answer link and this answer appears to fit the requirements perfectly. Why do you think it doesn't?

Post Status

Asked in February 2016
Viewed 1,566 times
Voted 5
Answered 2 times

Search




Leave an answer