Opening an already-connected unit with status='unknown'

From: Toby White (tow21_at_cam.ac.uk)
Date: 01/07/05


Date: Fri, 07 Jan 2005 18:01:11 +0000


Query - is this legal?

That is, I have the following program:

program status
 open(unit=13,name="file")

 open(unit=13,name="file",status='unknown')
end program
 
Should the second open succeed?

ifort doesn't complain; NAG fortran gives the runtime error:
OPEN on connected unit 13 with STATUS= specifier must have STATUS='OLD'

And indeed, if I replace 'unknown' with 'old', the complaint goes away.
In fact, if I don't specify any status on the second open, NAG is happy.

I would normally be inclined to trust NAG, but I'd thought half the point
of the 'unknown' status specifier was that it was for use when the status
was, well, unknown. In this case, clearly it is known, but I've come across
this in a much larger program where I don't know, and I'd put 'unknown' rather
than having to precede every open with an inquire.

Unfortunately, the standard isn't illuminating me.
(I presume 9.3.4.2 (f95) is the relevant paragraph)

-- 
Dr. Toby White, Dept. of Earth Sciences, Downing Street, Cambridge CB2 3EQ. UK
Email: <tow21@cam.ac.uk>


Relevant Pages