Thanks to all who answered my question.
And yes, I feel awfully stupid.
What happened is that one part of my brain changed STATUS="OLD"
to STATUS="UNKNOWN" in the OPEN statement, while an other part
of my brain figured that checking the IOSTAT argument was a good
way to check whether the files exists.
An other example of the danger of having several entities work
on the same code.
> From [log in to unmask] Fri Apr 21 16:54:12 2000
> X-Authentication-Warning: styx.bruyeres.cea.fr: Processed from queue /usr/local/spool/mqueue
> X-Authentication-Warning: styx.bruyeres.cea.fr: Processed by smap with -C /etc/mail/sendmail.cf
> Date: Fri, 21 Apr 2000 16:48:51 +0200 (MET DST)
> Subject: Opening a non-existing file is not an error?
> From: [log in to unmask] (Bertrand Meltz)
> To: [log in to unmask]
> X-List: [log in to unmask]
> X-Unsub: To leave, send text 'leave comp-fortran-90' to [log in to unmask]
> X-List-Unsubscribe: <mailto:[log in to unmask]>
>
>
> I thought that by having the IOSTAT=error_condition,
> I would detect whether I'm opening a file that does not exist.
>
> Apparently I was wrong.
>
> In my code, I have :
>
> open( unit=...., ..., IOSTAT=error_condition)
> if ( error_condition == 0 )
> ! read the file
> ...
> end if
>
> it appears that even though the file does not exist, I get
> error_condition = 0,
> and the my reading of the files fails.
>
> I have the same behaviour with 3 different compilers ( IBM, SUN and
> Compaq/TRU64).
> I searched the F95 standard, but it does not say explicitly (or not
> explicitly enough for me) whether opening a non-existing file should
> be an error.
> Does anybody ahve the final word about that?
>
> B. Meltz
>
> ****************************************
> * *
> * Bertrand Meltz *
> * CEA / Bruyeres-le Chatel *
> * BP 12 *
> * 91680 Bruyeres-le-Chatel *
> * FRANCE *
> * *
> * Tel : (33) [0] 1 69 26 57 83 *
> * Fax : (33) [0] I 69 26 73 84 *
> * *
> * e_mail : [log in to unmask] *
> * *
> ****************************************
>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|