INQUIRE - FORM vs. (UN)FORMATTED



Hello,

I'm trying to understand the FORM, FORMATTED and UNFORMATTED specifiers
of INQUIRE.

Let's start with FORM:
"The scalar-default-char-variable in the FORM= specifier is assigned
the value FORMATTED if the file is connected for formatted
input/output, and is assigned the value UNFORMATTED if the file is
connected for unformatted input/output. If there is no connection, it
is assigned the value UNDEFINED."

Ok, this is clear to me. Especially, it means given a UNIT (or a FILE
name) I can determine whether a file is connected and, if yes, whether
I need to access it as unformatted or formatted. I see many uses for
procedures where the UNIT is passed.


Ok, now comes the specifiers for which I don't understand what is (a)
exactly the purpose and (b) what value should be assigned when. (I talk
about FORMATTED below, but with UNFORMATTED I have exactly the same
problems.)

"The scalar-default-char-variable in the FORMATTED= specifier is
assigned the value YES if FORMATTED is included in the set of allowed
forms for the file, NO if FORMATTED is not included in the set of
allowed forms for the file, and UNKNOWN if the processor is unable to
determine whether or not FORMATTED is included in the set of allowed
forms for the file."

First case: INQUIRE(NAME=existing_file,...), which is not
connected/opened. Well, "UNKNOWN" can of cause always returned, but are
there scenarios where one would return FORMATTED="YES" or "NO"?
For a directory, one could e.g. return "NO". And in principle if a file
is readable, writtable and seekable there should be no problem opening
it - either as FORMATTED or as UNFORMATTED, whether one can read
something from the file is another question.

gfortran and g95 currently return for non-opened files: UNIT: "UNKNOWN"
NAME: Does not exists "UNKNOWN", directory "NO", File (regular,
block/character device, named pipe) "YES", else "UNKNOWN".
NAG f95, ifort and sunf95 return "UNKNOWN" which is always right.

Is the behaviour of gfortran/g95 correct?


Second case: The file is opened.
What should be returned for (UN)FORMATTED? Simply FORMATTED = "YES" if
FORM="FORMATTED" and otherwise "NO"? If this is the case, what is the
purpose of the FORMATTED vs. UNFORMATTED?
Or should be returned whether it is in principle possible to open the
file as (UN)FORMATTED? Then one would always return "YES" (I'm ignoring
issues like whether a file is seekable.)?

gfortran/g95 return always "YES" in this case,
ifort/NAG f95/sunf95 return FORMATTED="YES", UNFORMATTED="NO" if the
file is opened as FORMATTED.

In total, my problem is: What is meant by "in the set of allowed forms
for the file"? Depending how I understand it, I would either expect the
g* behaviour or the ifort/(sun)f95 behaviour.

Especially, for the ifort/sunf95/f95 behaviour I completely miss the
purpose of the (UN)FORMATTED specifier as they provide effectively the
same information as the FORM specifier.


Tobias

PS: Besides an interpretation of the standard, I'm also interested what
would be useful to return - as "this is implementation dependent" has
also somehow to be implemented.

.



Relevant Pages

  • Re: no sound with the new imac
    ... Node 0x02 wcaps 0x11: ... Connection: 1 ... Pin Default 0x012b4050: HP Out at Ext Rear ... Conn = Unknown, Color = Unknown ...
    (Linux-Kernel)
  • Re: Re: Encase Forensic
    ... Ayub ensures the pope in front of hers and grudgingly proves. ... Bob the blade's meaningful, v me it's unknown, whereas in connection with you it's ...
    (sci.crypt)
  • Re: ladies in waiting-genealogy
    ... It has been said that one of my ancestors was a lady in waiting ... My thought is that you could well employ your time, enthusiasm and energy to better effect than hunting for an unknown person of an unknown age at an unknown time at an unknown location who might possibly have had a connection with another unknown person. ...
    (soc.genealogy.britain)
  • Re: A licensee puts another nail in the coffin
    ... Unknown wrote: ... I assume they are referring to a Wifi ...
    (uk.radio.amateur)