For Programmers: Free Programming Magazines  


Home > Archive > Fortran > October 2006 > UU









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author UU
robert.corbett@sun.com

2006-10-30, 7:16 pm


Mike wrote:
> Hi
>
> I would like to know whether a file with io-unit has been opened.
> To prevent from the following situation:
>
> program main
> open(11,file='a.dat',....
> call suba()
> close(11)
> end
> subroutine suba()
> open(11,file='a.dat',....
> ......
> close(11)
> end subroutine suba
>
> Can I detect if io-unit in suba has been used in somewhere else, like
> main?


There is no 100% reliable method, but the INQUIRE statement

INQUIRE(11, OPENED=opened)

where opened is a logical variable comes close.

Bob Corbett

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com