"Craig T. Dedo" wrote:
> Dear Alberto:
>
> Alberto Fasso' wrote:
>
> > Some people have mentioned INQUIRE.
> >
> > I have a program which takes its input from a number of files. These may
> > have been written either as formatted or unformatted (binary) but contain
> > essentially the same kind of information.
> >
> > Therefore I need a way to tell the program how each file should be read. I
> > have tried INQUIRE with the FORMATTED=fmt option, but it is completely
> > useless. Indeed, although the fmt variable is supposed to take the values
> > 'YES' or 'NO', it looks that the standard allows also the response
> > 'UNKNOWN'. And this is the value which I find systematically returned.
> >
> > What is the point of providing such a facility, if it cannot be used?
> >
> > Alberto Fasso'
> >
> > --------------------------------------------------
> > Alberto Fasso'
> > Stanford Linear Accelerator Center
> > Radiation Physics Dept. ms 48
> > 2575 Sand Hill Road
> > Menlo Park, CA 94025
> >
> > Tel. (1 650) 926 4062 Fax: (1 650) 926 3569
>
> Yes, the Fortran 95 standard required that UNKNOWN is one of the valid
> values which INQUIRE (FORMATTED=scalar-default-char-variable) may return.
> Here is the text from the F95 standard:
> [Begin F95 text]
> 9.6.1.11 FORMATTED= specifier in the INQUIRE statement
> 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.
> [End of F95 text]
>
> Whether a Fortran compiler can determine if formatted I/O is allowed under
> a given set of circumstances is highly variable from one processor to the
> next. It depends on the OS, the file system, the run time library and the
> quality of the comiler implementation. Under many, if not most, OSes the file
> system does not keep track of whether the file's contents is formatted or
> unformatted. Hence, the set of circumstances in which the procesor can
> determine whether or not formatted I/O is allowed may be quite small.
>
> Why have such a facility? Well, in some cases, the compiler can make this
> determination. In those cases, this information is quite useful.
>
> The best approach in your case is to take a sample of records and find out
> what percentage of the characters are non-printable characters and what
> percentage are printable. Unless the percentage of printable characters is
> quite high, most likely the data is unformatted.
>
> --
> ----------
> Sincerely,
> Craig T. Dedo Internet:
> [log in to unmask]
> Elmbrook Computer Services Voice Phone: (262) 783-5869
> 17130 W. Burleigh Place Fax Phone: (262) 783-5928
> Brookfield, WI 53005-2759 Disclaimer: These opinions
> are mine alone.
> USA They do NOT
> represent any organization.
>
> "They that can give up essential liberty to obtain a little temporary
> safety deserve neither liberty nor safety." -- Benjamin Franklin (1759)
--
----------
Sincerely,
Craig T. Dedo Internet:
[log in to unmask]
Elmbrook Computer Services Voice Phone: (262) 783-5869
17130 W. Burleigh Place Fax Phone: (262) 783-5928
Brookfield, WI 53005-2759 Disclaimer: These opinions are
mine alone.
USA They do NOT represent
any organization.
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety." -- Benjamin Franklin (1759)
|