Xref: utzoo comp.sys.hp:8100 comp.sys.dec:5322 comp.lang.fortran:5013 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!wuarchive!udel!haven!decuac!shlump.nac.dec.com!fman.enet.dec.com!peterson From: peterson@fman.enet.dec.com (Bob Peterson) Newsgroups: comp.sys.hp,comp.sys.dec,comp.lang.fortran Subject: Re: f77 comp option to swap bytes? Keywords: f77 compiler byte swap hp dec ultrix fortran Message-ID: <1991Mar22.132140@fman.enet.dec.com> Date: 22 Mar 91 18:21:40 GMT References: Sender: news@shlump.nac.dec.com Reply-To: peterson@fman.enet.dec.com (Bob Peterson) Followup-To: comp.sys.hp Organization: Digital Equipment Corporation Lines: 25 In article , traymund@uiuc.edu (Tim Raymund) writes: >Is there a f77 compiler option to swap byte 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: ... >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 identical across systems. Yes. The DEC Fortran V3.0 compiler might help. It is capable of byte swapping and VAX<->IEEE conversion on binary I/O. The drawbacks of this are that FORTRAN programmers sometimes equivalance a lot of data in COMMON to a single integer vector, and then do I/O with the vector. The conversions then may fail. The experimental support allows you three options to control this: a per-unit environment variable, a compiler option affecting all units, and a new OPEN statement keyword, CONVERT. Details on request. We haven't had enough experience with this to catch all the gotchas. One gotcha: the binary data may be converted, but the binary record formats have to be the same as well. We think we match formats pretty well, but like I said, we're in learn mode. \bob