- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I open a file using this.
open(100,FILE ='temp.txt',STATUS='OLD',ERR=63)
But it goes to error line.
Then,I check the error using this(when the error is happen) .
INQUIRE (100, OPENED=I_OPENED, NAME=I_NAME, ACTION=I_ACTION)
But it says file is opened.
I_OPENED = T and other variable are fine.
Please help me.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Change your OPEN statement to also include IOSTAT. it will look something like this:
open(100,FILE ='temp.txt',STATUS='OLD',IOSTAT=IERR, ERR=63)
and then look to see what the error number is.
In case it's not obvious, you should also declare "INTEGER IERR"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, Lorri Menard.
I tested. It gives me 0. That means no error. But unfortunately it goes to error line(to 63);
What can be the reason for that?
Thank you.
OH sorry.. I couldn't tell you one important thing.
Programme works fine when it run at the visual studio. Only it gives me the error when it run as separate programme. Because of that I couldn't understand the reason for this. Please help me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In which directory is your file temp.txt located?
When running as a separate program you need to be in the directory where temp.txt exists.
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
on error it will still jump to the ERR line (63) but IERR will be set non-zero to 29 (file not found) I would expect....
Perhaps something like below would help you more....
open(100,FILE ='temp.txt',STATUS='OLD',IOSTAT=IERR) if( ierr /= 0) then write(*,*) 'file error is:',ierr goto 63 endif
![](/skins/images/3CECF0550DB8BF54496C114A1FF06FE9/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page