Hello all!
I am new to this site and to Fortran. I wanted to write my first program now, but it doesn't work. The error seems to be in the OPEN statement, cause when i run the .exe, the PC aborts and puts out a big positive number (once I also received a -1), so the status isn't 0. Here is the important part of the program:
PROGRAM timeseries
IMPLICIT NONE
! Declare Variables
INTEGER:: n
INTEGER:: year
INTEGER:: status
REAL, DIMENSION(262) :: array
CHARACTER(len=20):: filename
REAL:: temp
WRITE (*,*) 'get input data'
! READ (*,*) filename
OPEN ( 20, FILE='C:\program files\Fortran\ytemp2m.dat', STATUS='OLD')
IF ( status /= 0 )THEN
WRITE (*,*) 'open failed', status
(...)
CLOSE (22)
END PROGRAM
I use the gfortran compiler and tried Fortran 77, 90 and 95.
Thanks for your help
I am new to this site and to Fortran. I wanted to write my first program now, but it doesn't work. The error seems to be in the OPEN statement, cause when i run the .exe, the PC aborts and puts out a big positive number (once I also received a -1), so the status isn't 0. Here is the important part of the program:
PROGRAM timeseries
IMPLICIT NONE
! Declare Variables
INTEGER:: n
INTEGER:: year
INTEGER:: status
REAL, DIMENSION(262) :: array
CHARACTER(len=20):: filename
REAL:: temp
WRITE (*,*) 'get input data'
! READ (*,*) filename
OPEN ( 20, FILE='C:\program files\Fortran\ytemp2m.dat', STATUS='OLD')
IF ( status /= 0 )THEN
WRITE (*,*) 'open failed', status
(...)
CLOSE (22)
END PROGRAM
I use the gfortran compiler and tried Fortran 77, 90 and 95.
Thanks for your help