replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - FORTRAN not compiling
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

FORTRAN not compiling

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
ElSiglo



Joined: 30 Jan 2012
Posts: 4

PostPosted: Mon Jan 30, 2012 1:55 pm    Post subject: FORTRAN not compiling Reply with quote

Hi folks,

I have an old FORTRAN program for Markov Chain analysis, it was written in FORTRAN77. I've tried to run it in FORTRAN77 but it hasn't worked so I tried to run it in free format FORTRAN, however I get the following errors:

Quote:
C:\Users...: error 32 - Statement no recognised
C:\Users...: error 399 - Unrecognised statement, did you forget to add /FIXED_FORMAT?


Here's some of the FORTRAN code I'm using:

Code:
      PROGRAM ORDER
c
c  PROGRAM FOR FINDING DEGREE OF ORDER IN EMPRICAL TRANSITION TALLEY MATRIX,
c     USING CONCEPTS FROM INFORMATION THEORY
c  SUBROUTINE CONVG POWERS INITIAL HY(X) PROB. MATRIX TO EQUILIBRIUM FOR REGULAR
c     MATRICES ONLY
c  SUBROUTINE MARKOV PRODUCES -2LOGE VALUE FOR TESTING MARKOV TENDENCY  OF HY(X)
c      MATRIX WITH NO ZERO ELEMENTS.  IF ZERO ELEMENTS, D.F. ADJUSTED BY
c     KRUMBEINS METHOD (1967).
c
      DIMENSION TOTJ(11),TOTI(11)
      DIMENSION HYX2(11),B(11),C(11),BR(11),CR(11),RXR(11),HYX1(11)
      DIMENSION RES(11,11),CTOT(11,11),RET(11),ROT(11)
      DIMENSION PRTO(11,11),PCTO(11,11)
      COMMON RTOT(11,11),AB(11,11)
      COMMON/MARK/ TM(11,11),XR(11,11),CXR(11),jo(11,11)
c  Input file (1) has OTM data. But note that a new line 1 has to be inserted.
c  leave a single space between following variables
c NS=NUMBER OF MATRICES TO BE ASSESSED
c ICONV  0=CONVERGENCE REQUIRED, 1=NOT REQUIRED
c IMARK  0=MATRIX ORDER, 1=MATRIX ORDER PLUS MARKOV TEST
c IN= MATRIX POWER FOR CONVERGENCE
c N=NUMBER OF STATES IN (NS) MATRIX
c
c  Output (2) is a screen file of OTM and Markov tests
c
      open(1,file='mh4otm.58-01',status='old',form='formatted')
      open(2,file='mh4order.58-01',status='new',form='formatted')
      READ(1,*)NS,ICONV,IMARK,in,n
      DO 100 KI=1,NS
      Write(2,22)ki
22    FORMAT(1h ,10x,i3,1x,15hSTEP TRANSITION/)
C
C FINDING MAX ENTROPY OF VECTOR AND MATRIX OF (N) STATES
C
      ZT=FLOAT(N)
      XT=ZT**2
      HT=ALOG2(XT)
      HM=ALOG2(ZT)
C
C AA(I)=INPUT FORMAT OF MATRIX, BY VECTORS
C
      DO 21 I=1,N
21    READ(1,*)(jo(I,J),J=1,N)
      do 211, i=1,n
      do 211, j=1,n
211   tm(i,j)=float(jo(i,j))
      DO 101 J=1,N
      DO 101 I=1,N
      TOTI(I)=0.0
      TOTJ(J)=0.0
      RXR(I)=0.0
      CXR(J)=0.0
      HYX1(I)=0.0
101   HYX2(I)=0.0
C
C DERIVE H(X,Y) PROB. MATRIX
C
      DO 5 J=1,N
      DO 5 I=1,N
      TOTJ(J)=TOTJ(J)+TM(I,J)
5     TOTI(I)=TOTI(I)+TM(I,J)
      MN=0
      DO 102 I=1,N
102   MN=MN+TOTI(I)
      DO 3 J=1,N
      DO 3 I=1,N
4     XR(I,J)=TM(I,J)/MN
3     CONTINUE
C
C ACTUAL ENTROPY OF H(X,Y) MATRIX
C
      HXY=0.0
      DO 11 J=1,N
      DO 11 I=1,N
      IF(XR(I,J))112,112,111
112   RES(I,J)=0.0
      GOTO 11
111   RES(I,J)=XR(I,J)*(ALOG2(1.0/XR(I,J)))
11    HXY=HXY+RES(I,J)
      HXY=ABS(HXY)
C
C DERIVATION  OF ROW AND COLUMN CONDITIONAL PROBS.
C     HY(X) AND HX(Y)
C
      DO 7 J=1,N
      DO 7 I=1,N
      IF(TOTI(I))703,703,70
703   RTOT(I,J)=0.0
      GOTO 701
70    RTOT(I,J)=TM(I,J)/TOTI(I)
701   IF(TOTJ(J))704,704,702
704   CTOT(I,J)=0.0
      GOTO 7
702   CTOT(I,J)=TM(I,J)/TOTJ(J)
7     CONTINUE
C
C ENTROPY AND REDUNDANCY OF EQUILIBRIUM HY(X)
C
      IF(ICONV)72,72,71
72    CALL CONVG(N,IN,K,HIND,RIND)
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1899

PostPosted: Mon Jan 30, 2012 2:41 pm    Post subject: Re: FORTRAN not compiling Reply with quote

The code that you included (incomplete, possibly truncated because of limits imposed by the forum software) is not valid free-form Fortran. For instance, comments come after '!', not with 'C' or 'c' in column-1.

Give the source file an extension of .f or .for and compile.

When you report problems, state which compiler options you used and state the compiler and OS versions.
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2402
Location: Yateley, Hants, UK

PostPosted: Mon Jan 30, 2012 7:11 pm    Post subject: Reply with quote

This will never compile in free format - not without lots of editing.

My advice: get it working in fixed format first. It looks like it should compile (well, the fragment that we can see from the forum).

You will get into some minor difficulties with units 1 and 2 for input and output.

Now I'm a dinosaur even by Fortran standards, but this code has stuff in it that goes back to the 1960's - arithmetic IF statements, Hollerith character constants etc. It looks more like Fortran 66 than Fortran 77. Send me a private message for an e mail if you want me to sort it out for you - I should have the time, I'm retiring tomorrow, and it looks like a 10 minute job!

Eddie
Back to top
View user's profile Send private message
ElSiglo



Joined: 30 Jan 2012
Posts: 4

PostPosted: Mon Jan 30, 2012 9:56 pm    Post subject: Re: Reply with quote

LitusSaxonicum wrote:
This will never compile in free format - not without lots of editing.

My advice: get it working in fixed format first. It looks like it should compile (well, the fragment that we can see from the forum).

You will get into some minor difficulties with units 1 and 2 for input and output.

Now I'm a dinosaur even by Fortran standards, but this code has stuff in it that goes back to the 1960's - arithmetic IF statements, Hollerith character constants etc. It looks more like Fortran 66 than Fortran 77. Send me a private message for an e mail if you want me to sort it out for you - I should have the time, I'm retiring tomorrow, and it looks like a 10 minute job!

Eddie


PM sent.
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2615
Location: Sydney

PostPosted: Tue Jan 31, 2012 7:54 am    Post subject: Reply with quote

look at the /convert option in FTN95
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group