next up previous contents
Next: Software on the UNIX Up: FORTRAN (f77, ld, dbx) Previous: Sun Fortran   Contents

Binary Data - UNIX vs. VMS (dd)

Another important difference between the Suns and VAXes is that the internal binary representation of floating-point data is completely different: the Suns always use IEEE format; the VAXes usually use Digital's own format (if you specify G_FLOATING for your VMS compiles, you will only need to worry about byte-swapping; see below). Therefore, it is strongly recommended that you do not try to transfer binary (i.e. ``unformatted'') data files back and forth between VMS and UNIX. Note also that all data, including integers, has another difference in binary representation: the bytes are ordered starting with the least significant byte in DEC and Intel-based machines, whereas in Motorola- or SPARC-based machines such as the Suns, and on Convexes and many others, the most significant byte comes first. This means that even binary integer data will need conversion before it can be used. Byte-swapping can be accomplished using the dd utility, specifying conv=swab. Please read the man page on dd before attempting to use it.

If you really cannot avoid moving binary data from VMS to UNIX, the simplest and best way to convert it is to write two very short programs, one on the VAX which will read your unformatted data and write out an ASCII (``formatted'') file, and the other on the UNIX system to do the opposite. Run the first program on the VAX, transfer the ASCII file from VMS to UNIX, and run your second program. Remember this will only need to be done once for each data file. Since the format of the records changes from file to file, depending on what you put there, there is no straightforward way to automate the procedure.

Of course this is not practical for very large data files, say more than a few megabytes in size. If you find it absolutely necessary to transfer files of this size, please talk to a system person about the best way to accomplish it.

truein


next up previous contents
Next: Software on the UNIX Up: FORTRAN (f77, ld, dbx) Previous: Sun Fortran   Contents
h.stilmack@jach.hawaii.edu