pure binary files in fortran on RS6000 (xlf)

Daniel Packman pack at acd.uucp
Thu May 23 05:32:08 AEST 1991


In article <9105221902.AA08859 at ucbvax.Berkeley.EDU> freese at dalvm41b.vnet.ibm.com ("Bradley T. Freese") writes:
>fn at fractal.math.yale.edu (Francois Normant) writes:
>
>> I'm trying to write pure binary files in fortran in order to read them in C.
>> ...
>> The question is:
>
>> Is there a function equivalent to setpure in xlf (RS6000 fortran) ?
>
>No, xlf does not have such a function.  However, xlf does not add any
>extraneous characters to an unformatted file (other than an EOF
>record).  It only writes the data you write to the file.

   Depends on what you mean "extraneous".  In order to support standard
unformatted reads, a byte count at least must be accessable before the
data.  In order to support backspace and detection of "eof", byte counts
of some sort must be added after the data.  Counts of some sort somewhere
must be added to the data stream for fortran unformatted io.

   AIX/RS6000 and *many* other unix fortran implementations on 32 bit
machines prepend and postpend a 4 byte byte count of the intervening data.
You are, of course, never guaranteed what the local fortran implementation
of binary data is.  

   We solve the problem of multi-architecture binary
data by using the netCDF (common data format) routines.  The package
is free from unidata.ucar.edu and runs on VMS and DOS as well as unix
machines.  Its underlying assumption is the XDR (external data represention)
which is used by NFS and other animals.

Dan Packman     NCAR                             INTERNET: pack at ncar.UCAR.EDU
(303) 497-1427  P.O. Box 3000                       CSNET: pack at ncar.CSNET
                Boulder, CO  80307-3000      DECNET  SPAN: 9583::PACK



More information about the Comp.unix.aix mailing list