- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When I try to close some files I'm getting
forrtl: severe (157): Program Exception - access violation
Other files accessed in the same way in the same run close just fine.
The file is opened with
open(kElanFile,file=trim(ElanFileName),status='unknown')
Some ascii data is written to it.
The close statement is simply
close(kElanFile)
I never had trouble closing a file before. Does anyone have any ideas?
Thanks, Andy
forrtl: severe (157): Program Exception - access violation
Other files accessed in the same way in the same run close just fine.
The file is opened with
open(kElanFile,file=trim(ElanFileName),status='unknown')
Some ascii data is written to it.
The close statement is simply
close(kElanFile)
I never had trouble closing a file before. Does anyone have any ideas?
Thanks, Andy
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Andy,
It looks like you already get the run-timeerror number, but would it help to add the IOSTAT option to the CLOSE statement? Perhaps it could provide another error code to help diagnose the problem.
Is it possible that the kElanFile unit number gets changed as the program runs, or another file is using the same unit number? I've had file close errors when there is an unexpected change to a file unit number. I've also had file close problems with file shared across the local network (my PC to the server) if there is a network interuption. Does using a different file unit value help, or does the error still occur?
Regards,
Greg
It looks like you already get the run-timeerror number, but would it help to add the IOSTAT option to the CLOSE statement? Perhaps it could provide another error code to help diagnose the problem.
Is it possible that the kElanFile unit number gets changed as the program runs, or another file is using the same unit number? I've had file close errors when there is an unexpected change to a file unit number. I've also had file close problems with file shared across the local network (my PC to the server) if there is a network interuption. Does using a different file unit value help, or does the error still occur?
Regards,
Greg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Getting Error 157 on a CLOSE suggests that there has been a corruption of a run-time library data structure. The way I usually try to diagnose this is to selectively remove code before the close to see which, when removed, makes the error go away.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the input guys.
It turned out that boundaries of an array were being violated,
but traceback was making it appear that the error occurred when a file was being closed.
It turned out that boundaries of an array were being violated,
but traceback was making it appear that the error occurred when a file was being closed.
![](/skins/images/7B0AB6865064EAE32B30EC9A4E94B48A/responsive_peak/images/icon_anonymous_message.png)
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