- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When I tried to read a binary file, I've got an error of IOSTAT = 36.
What is this error about and how to solve it?
OPEN(10,FILE='C:\temp\test.bin',ACCESS='DIRECT', RECL=144*4,FORM='UNFORMATTED',STATUS='OLD',IOSTAT=ISTAT)
It seems that the file is open properly, as the IOSTAT is equal to 0.
But when the following read command is executed, the IOSTAT = 36.
READ(10,REC=366,IOSTAT=ISTAT,ERR=103)ICYEAR,IRT
I don't know what's wrong with the code.
Many thanks.
What is this error about and how to solve it?
OPEN(10,FILE='C:\temp\test.bin',ACCESS='DIRECT', RECL=144*4,FORM='UNFORMATTED',STATUS='OLD',IOSTAT=ISTAT)
It seems that the file is open properly, as the IOSTAT is equal to 0.
But when the following read command is executed, the IOSTAT = 36.
READ(10,REC=366,IOSTAT=ISTAT,ERR=103)ICYEAR,IRT
I don't know what's wrong with the code.
Many thanks.
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The file would have to have been written by DIRECT access with the same RECL, with at least 366 records, with identically shaped arrays, probably with the same brand of run-time library, for this to work. You don't present any information bearing on any of those points.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - junhonguk
When I tried to read a binary file, I've got an error of IOSTAT = 36.
What is this error about and how to solve it?
OPEN(10,FILE='C:temptest.bin',ACCESS='DIRECT', RECL=144*4,FORM='UNFORMATTED',STATUS='OLD',IOSTAT=ISTAT)
It seems that the file is open properly, as the IOSTAT is equal to 0.
But when the following read command is executed, the IOSTAT = 36.
READ(10,REC=366,IOSTAT=ISTAT,ERR=103)ICYEAR,IRT
I don't know what's wrong with the code.
Many thanks.
What is this error about and how to solve it?
OPEN(10,FILE='C:temptest.bin',ACCESS='DIRECT', RECL=144*4,FORM='UNFORMATTED',STATUS='OLD',IOSTAT=ISTAT)
It seems that the file is open properly, as the IOSTAT is equal to 0.
But when the following read command is executed, the IOSTAT = 36.
READ(10,REC=366,IOSTAT=ISTAT,ERR=103)ICYEAR,IRT
I don't know what's wrong with the code.
Many thanks.
From the help (error codes) error 36 :
"Attempt to access non-existent record"
Seems that your file does not have a record number 366.
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - tim18
The file would have to have been written by DIRECT access with the same RECL, with at least 366 records, with identically shaped arrays, probably with the same brand of run-time library, for this to work. You don't present any information bearing on any of those points.
Thanks for your comments.
Based on your comments, I just found the previous binary file created is based on G77. And the current compiler that I used is Visual Fortran Compiler 9.1. There are different conventions regarding to the record length.
The way that I used to solve the problem is to use an ASCII-type file of the original binary file and convert it under intel visual fortran environment into a new binary file in the machine that I used.
And it works!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was going to suggest that you try changing the 144*4, to just 144 and see if that fixed it.
This is an area where I have definitely seen differenences between the default behaviors of compilers. Some
compilers measure their record lengths in bytes by default and others measure theirs in words. This was an
issue as I moved through the Microsoft/DVF/CVF migration. Compatibility options are usually available to
override the default, so it behaves the way you want.
This is an area where I have definitely seen differenences between the default behaviors of compilers. Some
compilers measure their record lengths in bytes by default and others measure theirs in words. This was an
issue as I moved through the Microsoft/DVF/CVF migration. Compatibility options are usually available to
override the default, so it behaves the way you want.

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