[Thread Prev][Thread Next][Index]

Re: [ferret_users] reading FORTRAN sequential access data - simplequestion



Hi,

| FORTRAN unformatted output is not really a standard.  It is system
| and compiler dependent how the concept of a "record" is implemented.

You are correct in principle.  In practice, unformatted files are
very compatible, *if* these two items are taken care of:

1) Endianness:  Compilers on little-endian machines usually
   have an option to convert to the big endian format on I/O.
   Ferret has one, too.  (The "swap" keyword.)

2) For direct access files, recl may not be in terms of bytes.
   On some compilers, recl can be in the units of 4 bytes.
   But, such compilers usually have an option to make it one byte.

For sequential files, most compilers follow the de facto standard
for the representation of records.  A direct-access file is almost
always represented as a uniform sequence of bytes, so there's no
record boundary or anything in the underlying data.

Cheers,
Ryo
--------------------------
On the three major OSes (Unix/Linux, Windows, & MacOS),
files aren't orgnized around "records".  From the user's point
of view, files are simply uniform sequences of bytes.  Fortran
direct-access files are almost always just that, on such OSes.
Fortran sequential files are a bit trickier because they do
have the notion of record.  But, most compilers follow the
de facto standard format to represent records.  To represent
floating-point numbers, the IEEE standard is the norm these
days, so, once the endianness is taken care of, the
floating-point number representation is almost always
compatible.  Unless you are using an old IBM mainframe
or a Cray (what about VMS?), that is.

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement