- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here's an easy one. I am relatively new to FORTRAN
and can't see what the problem is with my READ of a
binary file. I get an IERR of 22. Here is how I am
opening and reading my file:
Originally, there was no record length in the open statement.
This gave me the same error.
Can someone please point out what is wrong?
I just can't see it.
Thank you!
Jane
and can't see what the problem is with my READ of a
binary file. I get an IERR of 22. Here is how I am
opening and reading my file:
CHARACTER*512 PATHTAP
REAL*4 DATS(300)
LFCTAP=11
OPEN(LFCTAP,FILE=PATHTAP,IOSTAT=IERR,
1 FORM='UNFORMATTED',STATUS='OLD',RECL=300)
READ (LFCTAP,IOSTAT=IERR) DATS
Originally, there was no record length in the open statement.
This gave me the same error.
Can someone please point out what is wrong?
I just can't see it.
Thank you!
Jane
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's not easy, without full information. Was the file written by an Intel compiler, using the same OPEN statement? If the file was written in what Intel compilers refer to as FORM='BINARY' (an extension to standard Fortran), it must be so specified.
Which compiler are you using? That error code is not in the list which comes with my copy of IFL. Neither the error codes nor the exact form of an unformatted file are portable between compiler vendors.
Which compiler are you using? That error code is not in the list which comes with my copy of IFL. Neither the error codes nor the exact form of an unformatted file are portable between compiler vendors.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Probably CVF. 22 is "input record too long". My guess is that the file was not written by Fortran and needs to be opened with FORM='BINARY', as Tim suggests. The RECL can be removed, it's not needed for this case.
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jane,
At the grave risk of my ego (you have responses from two Intel reps (one also a CVF rep))I'll volunteer an observation. You should always be able to read a partial record if the I/O list is equal or shorter than the physical record being read. The RECL=300 shouldn't change that; the READ stmt input list should override that. The suggestions about FORM='BINARY' are good because the end of record mark can differ in different disk file formats and look like data in one case and the end of the record in another. See if you can find CVF error 22 for a clue, I think the CVF IDE(text editor) has them all indexed.
Regards,
Keith
At the grave risk of my ego (you have responses from two Intel reps (one also a CVF rep))I'll volunteer an observation. You should always be able to read a partial record if the I/O list is equal or shorter than the physical record being read. The RECL=300 shouldn't change that; the READ stmt input list should override that. The suggestions about FORM='BINARY' are good because the end of record mark can differ in different disk file formats and look like data in one case and the end of the record in another. See if you can find CVF error 22 for a clue, I think the CVF IDE(text editor) has them all indexed.
Regards,
Keith
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you all for your suggestions. I did try using FORM='BINARY', however, I think I have concluded that there is something more wrong with the file that I was given. I have decided to create my own binary file from the format description and things seem to be going fine. I will be able to get another file from someone else soon, so that will tie me over for now.
Thank you all again for the responses.
Jane
Thank you all again for the responses.
Jane
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