- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am now using the Parallel Studio XE 2015 Composer Edition for Fortran combined with Xcode 6.3 to run a program.
The program was made in order to read data from file first and then go for some further computation.
I had all my f90 files (including the main program and the modules) in the Project folder and it did compile and run.
But when I tried to input the file name and load the file, it seemed that it failed to read the file.
I have my code like this
.......
CHARACTER(LEN = 20) :: fileName
INTEGER :: iNode
REAL(KIND = dp) :: xBox, yBox, zBox
WRITE(*,'(A)', ADVANCE = "NO") "Input file name: "
READ(*,*) fileName
OPEN(1, FILE = TRIM(fileName)//'.in' , STATUS = 'UNKNOWN')
READ(1,*) iNode, xBox, yBox, zBox
........
When I ran the program and input the file name it simply returned forrtl: severe (24): end-of-file during read, unit 1...
I though it might be due to failure to find the file though I had put the data file (output.in) in the same folder as other .f90 files, as well as add it to the project.
I am just wondering how to deal with this issue (I thought it might be a reference/file location issue of Xcode, since this program is running well on other fortran compiler.)
Thanks.
-Abright
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The severe(24) is an end-of-file error indicating the amount of data in the file found/opened was less than what was attempted by the READ. (See here for list of run-time error messages).
With the STATUS=’UNKNOWN’, when a pre-existing file by the name you constructed for FILE= is not found, a new (empty) file by that name is created/opened which could lead to the severe (24) when the READ statement executes. Since you seem to indicate knowing the file name created (i.e. output.in) does exists, then the severe(24) likely indicates the program not finding the file where you expected it might.
You likely need to just set the working directory accordingly under Xcode or place a copy of the input file into the pre-set working directory (where the executable resides), which ever you prefer.
I do not have a working example readily available under Xcode 6.x to play with so see if the details in this older post helps with setting the working directory.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Doesn't the error message give the full path to the data file? Adding the file to the project has no effect. Are you using these other compilers in Xcode? I am not sure how it works in Xcode, but most likely the default for files is not where you think it is. You could use INQUIRE to get the full path if it isn't in the error message. Note that the default is STATUS='UNKNOWN' so it will create an empty file if it doesn't exist, and then get an EOF on the first read. You could also try using STATUS='OLD' to force an error if the file is not found. (But make sure you delete any empty copies of the file first.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The severe(24) is an end-of-file error indicating the amount of data in the file found/opened was less than what was attempted by the READ. (See here for list of run-time error messages).
With the STATUS=’UNKNOWN’, when a pre-existing file by the name you constructed for FILE= is not found, a new (empty) file by that name is created/opened which could lead to the severe (24) when the READ statement executes. Since you seem to indicate knowing the file name created (i.e. output.in) does exists, then the severe(24) likely indicates the program not finding the file where you expected it might.
You likely need to just set the working directory accordingly under Xcode or place a copy of the input file into the pre-set working directory (where the executable resides), which ever you prefer.
I do not have a working example readily available under Xcode 6.x to play with so see if the details in this older post helps with setting the working directory.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve and Kevin,
Thanks for you help!
Case closed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Glad to hear that!

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page