Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran90 problem, runtime error

  1. Feb 17, 2013 #1
    Hello, i've been playing around with some code (as shown below) and for some reason everytime i run this code I am told:

    At line 11 of file tester.f90
    Fortran runtime error: End of file

    I'm not really sure whats causing it, is it the position of my Open file?
    Any help would be much aprrieiated :)

    PROGRAM tester

    !Turn off implicit typing

    INTEGER :: a, b


    WRITE(10,*) 'Please give value for a'
    READ(10,*) a

    IF (a < 0) THEN
    WRITE(10,*) 'Wrong number'
    END IF

    WRITE(10,*) 'Please give value for b'
    READ(10,*) b

    IF (b > 0) THEN
    WRITE(10,*) 'Wrong number'
    END IF

    WRITE(10,*) a * b


    END PROGRAM tester
  2. jcsd
  3. Feb 17, 2013 #2


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    Are you sure the file exists?

    You are writing to the file and reading from it simultaneously. This can cause problems if not done carefully.

    When opening the file, FORM ='FORMATTED' should probably be used.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook