Silverfrost FTN95, Programma written in Fortran and giving error 299

In summary, the conversation is about a problem with a Fortran program that is giving the error 299 at line 4, stating that a statement ordering error has occurred and the parameter (n-100001) cannot appear after executable statements. The expert advises to move the PARAMETER and DIMENSION statements before the OPEN statement and provides a reference for Fortran 90.
  • #1
xaria181
3
0
Hello everybody.I have a problem with a program I wrote in Fortran.The program is this and it is giving me the error 299 at line 4(parameter (n-100001)) saying -Statement ordering error - PARAMETER cannot appear after executable statements. What can I do to fix the problem?? :-(


program intergrate
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
open(10,file="500Ktr.rox")
parameter (n=100001)
dimension x(n),y(n)
write(*,*)'enter number of points <100000'
read(*,*)nd
if(nd.gt.n)stop 'number of points > 100000 !'
write(*,*)'enter left and right limits'
read(*,*)a,b
a=1.d0
b=2.d0
step=(b-a)/dfloat(nd)
write(*,*)
write(*,*)
write(*,*)'integration with step=',step
write(*,*)
write(*,*)
do i=1,nd
read(10,*)thesi,TPK_x
x(i)=thesi
y(i)=TPK_x
end do
call traper(x,y,nd,x(1),x(nd),result)
rr=dexp(2.d0*b)-dexp(2.d0*a)/2.d0+5.d0/3.d0*(a**3-b**3)
write(*,*)
write(*,*)
write(*,*)'result=',result,' analytically=',rr
write(*,*)
write(*,*)
end
c
SUBROUTINE TRAPER (X,Y,N,AA,BB,RE)
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
DIMENSION X(N),Y(N)
DATA ZERO/0.D0/
C
RE=ZERO
SD=ZERO
IF(AA .EQ. BB .OR. N .LT. 2) RETURN
A=AA
B=BB
IF(AA .LT. BB) GO TO 1
A=BB
B=AA
1 CONTINUE
DO 40 I1 = 2,N
I=I1
IF(X(I) .GE. A) GO TO 41
40 CONTINUE
41 CONTINUE
DO 42 J1 = 2,N
J=J1
IF(X(J) .GE. B) GO TO 43
42 CONTINUE
43 WI1=(X(I)-A)**2/(X(I)-X(I-1))
WI=(1.0D0+(A-X(I-1))/(X(I)-X(I-1)))*(X(I)-A)
WJ1=(1.0D0+(X(J)-B)/(X(J)-X(J-1)))*(B-X(J-1))
WJ=(B-X(J-1))**2/(X(J)-X(J-1))
IF(I .NE. J) GO TO 2
WI1=WI1+WJ1+X(I-1)-X(I)
WI=WI+WJ+X(I-1)-X(I)
WJ1=ZERO
WJ =ZERO
GO TO 10
2 IF(I .NE. J-1) GO TO 3
WI=WI+WJ1
WJ1=ZERO
GO TO 10
3 WI=WI+X(I+1)-X(I)
WJ1=WJ1+X(J-1)-X(J-2)
IF(I .EQ. J-2) GO TO 10
LI=I+1
LJ=J-2
DO 4 L = LI,LJ
RE=RE+(X(L+1)-X(L-1))*Y(L)
4 CONTINUE
10 RE=RE+WI1*Y(I-1)+WI*Y(I)+WJ1*Y(J-1)+WJ*Y(J)
RE=0.5D0*RE
IF(AA .GT. BB) RE=-RE
C
RETURN
END
 
Technology news on Phys.org
  • #2
Probably move the PARAMETER and DIMENSION statements before the OPEN statement.
 
  • #3
Well,it's giving exactly the same error 299 for the next line,which is dimension x(n),y(n)...
 
  • #4
Reorder the first few lines of your program like so:
Code:
program intergrate
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
parameter (n=100001)
dimension x(n),y(n)

open(10,file="500Ktr.rox")
.
.
.
The compiler is telling you that declarations, such as the parameter and dimension statements, have to occur before any executable statements, such as open(...)

BTW, "intergrate" is not a word in English. The compiler won't care, but you should.
 
  • #5
Thanks a lot for your advice...!I'll try for it! :smile:
 
  • #6

Related to Silverfrost FTN95, Programma written in Fortran and giving error 299

1. What is Silverfrost FTN95?

Silverfrost FTN95 is a Fortran compiler developed by Silverfrost Ltd. It is used for developing and running programs written in the Fortran programming language.

2. What is Fortran?

Fortran is a high-level programming language primarily used for scientific and engineering applications. It was first introduced in the 1950s and has undergone several revisions since then.

3. What does error 299 mean in Silverfrost FTN95?

Error 299 in Silverfrost FTN95 indicates a I/O error, specifically a file not found error. This means that the program is unable to locate a file that it needs in order to run correctly.

4. How can I fix error 299 in my Fortran program?

If your Fortran program is giving error 299, you can try checking the file paths of any files that your program is trying to access. Make sure that the files are in the correct location and that the program has proper permissions to access them.

5. Are there any other common errors in Silverfrost FTN95?

Yes, there are several other common errors that may occur while using Silverfrost FTN95. These include syntax errors, runtime errors, and linker errors. It is important to carefully review and debug your code to identify and fix these errors.

Similar threads

  • Programming and Computer Science
Replies
4
Views
967
  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
12
Views
1K
  • Programming and Computer Science
Replies
3
Views
2K
  • Programming and Computer Science
Replies
4
Views
2K
  • Programming and Computer Science
Replies
6
Views
3K
  • Programming and Computer Science
Replies
22
Views
4K
  • Programming and Computer Science
Replies
20
Views
2K
Replies
1
Views
2K
  • Programming and Computer Science
Replies
12
Views
2K
Back
Top