[comp.sys.dec] Summary to binary file io question

traymund@uiuc.edu (Tim Raymund) (03/26/91)

A short while ago, I submitted the following to you all:

> Is there a f77 compiler option to swap word order on i/o?  I ran
> the same program on a DECstation 5000 and an HP 9000/835 (see program
> at the end) and the resulting files look like:
> 
> DECstation 5000> od -h float.data
> 0000000  0028 0000 0000 3f80 0000 4000 0000 4040
> 0000020  0000 4080 0000 40a0 0000 40c0 0000 40e0
> 0000040  0000 4100 0000 4110 0000 4120 0028 0000
> 0000060
> 
> HP 9000/835> od -h float.data
> 0000000  0000 2800 803f 0000 0040 0000 4040 0000
> 0000020  8040 0000 a040 0000 c040 0000 e040 0000
> 0000040  0041 0000 1041 0000 2041 0000 0000 2800
> 0000060
> 
> We like to use binary file i/o as in the program, and it would
> be handy if a f77 compiler option could be set to make the
> files similar across systems.


There is no simple solution!  Byte ordering and floating point format
are almost integral parts of the machine design, and conversions are not
simple matters.

There are some deeper questions about error due to format conversions
that I won't get into, but one should keep in mind that this sometimes
comes into play.

In summary, there are three options that I think are worth considering
and are more or less currently available.  The first is BDX, Binary Data
Exchange from NASA, which is a library of routines which standardize 
the floating point data and write a machine independant file.  Libs
of BDX subroutines would be implemented on each machine, and users would 
call the library to do binary i/o.  The second is netCDF, a similar 
library of routines available from NCAR.  The third is a new DEC RISC
FORTRAN compiler which offers byte order swapping and VAX to IEEE
floating point conversion as an option in the OPEN statement, etc.

For specific information about each product contact:

BDX:        Christopher J. Miller             togood@roger.lerc.nasa.gov
netCDF:     Russ Rew                          russ@unidata.ucar.edu
DEC RISC FORTRAN: your local DEC rep.


Thanks to all you netters out there who wrote in!
tim.

--------------------------------------------------------------------
TIM RAYMUND                                  phone: 217/333-2931
WPL, 60 ELB                                  fax:   217/244-5624
DEPT OF ECE, UNIV OF IL                      email: t-raymund@uiuc.edu
1406 W GREEN                                        uiwpl::traymund
URBANA  IL  61801-2991
--
--------------------------------------------------------------------
TIM RAYMUND                                  phone: 217/333-2931
WPL, 60 ELB                                  fax:   217/244-5624
DEPT OF ECE, UNIV OF IL                      email: t-raymund@uiuc.edu