forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

READ* causes run-time error after file has been opened/close

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
viroxa



Joined: 28 Jul 2017
Posts: 78

PostPosted: Mon Aug 14, 2017 4:08 pm    Post subject: READ* causes run-time error after file has been opened/close Reply with quote

Hello, everyone,

I opened a file using
Code:
OPEN(UNIT=1,FILE='...',STATUS='old',IOSTAT=stats)


after reading data from that file, I closed it again, using
Code:
CLOSE(UNIT=1)


After that, READ* - which should get user input from the command promt returns
Quote:
"Run-time error 94: Unit has neither been OPENed nor preconnected"


PRINT*,'...' on the other hand, works just fine.

How can I open the command prompt for input again?[/quote]
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Mon Aug 14, 2017 4:31 pm    Post subject: Reply with quote

I think that it is advisable not to use low-numbered units in an OPEN statement, as the idea is that they are 'pre-connected'. Old-fashioned advice was to avoid units 5 and 6, because traditionally they were the card reader (5) and line-printer (6). On the first machine I ever used, 1 was the operator's console, 2 and 3 were tape readers, and 4 was the tape punch. 7 was another card reader!

If you are using a pre-connected unit, never CLOSE it, or you are likely to get the problems you describe. A unit number given as * is also pre-connected. If a UNIT is pre-connected, you do not need to OPEN it.

The advice given in FTN95.CHM is: "UNIT values should be greater than 6 to avoid the possibility of re-assigning standard input/output streams."

Eddie
Back to top
View user's profile Send private message
viroxa



Joined: 28 Jul 2017
Posts: 78

PostPosted: Mon Aug 14, 2017 5:17 pm    Post subject: Reply with quote

Thanks for the detailed explanation!

I'm working with code that someone had written back in the 90's. They only excluded 5 and 6.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group