From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,3f66cb31a9300a74 X-Google-Attributes: gidfee84,public From: lionel@quark.enet.dec.com (Steve Lionel) Subject: Re: Endian problems... Date: 1995/11/09 Message-ID: <47te7o$j8d@zk2nws.zko.dec.com>#1/1 X-Deja-AN: 119005022 distribution: world references: <47me7b$9an@taco.cc.ncsu.edu> organization: Digital Equipment Corporation, Nashua NH reply-to: lionel@quark.enet.dec.com (Steve Lionel) newsgroups: comp.unix.osf.osf1 In article <47me7b$9an@taco.cc.ncsu.edu>, decroix@brunt.meas.ncsu.edu writes: |> |>I have a rather strange problem, but I think others must have run into this. |>I have written an unformatted file on a cray Y-MP using IEEE floating point |>format. I can read this file on the Alpha, running Digital Unix Ver. 3.2c, by |>setting a few compiler flags to force all i/o to be big endian or little endian. |>Here's the problem: |> |>I want to *read* a IEEE floating point file and *write* a dec-native unformatted |>file. The compiler line flags set ALL files to either big endian or little endian. |>The way I did it on the cray was using the 'assign' command in an execution |>c-shell script, but assign doesn't appear to be available on the alpha. |> |>How do I read a big endian and write a little endian unformatted file? |>I have been working with in FORTRAN, so that solution would be prefered. |>I know a little C, so if someone could tell me the pertinent statements, |>I could probably muddle my way through! ;) There are three DEC Fortran "hammers" with which you can affect the data-conversion attribute of I/O. You've picked the biggest one, the compile command switch, which affects all I/O on all units. The next smaller hammer is to define an environment variable of the form FORT_CONVERTn, where "n" is the unit number, before running the program. The value of the variable is the convert type wanted for that unit, for example, BIG_ENDIAN. The smallest hammer is the CONVERT= keyword on the OPEN statement for the file you want to use. For more information, please read the chapter on non-native data conversion during I/O in the DEC Fortran User Manual. -- Steve Lionel Mail: lionel@quark.enet.dec.com DEC Fortran Development WWW: http://www.digital.com/info/slionel.html Digital Equipment Corporation CompuServe: 75263,3001 110 Spit Brook Road, ZKO2-3/N30 Nashua, NH 03062-2698 "Free advice is worth every cent" For information on DEC Fortran 90, see http://www.digital.com/info/hpc/f90/