the program /xray2/berry/for/raxhead2.for has a swapbytes routine for reals going either way. should work also on integer*4? if fortran will ignore type mismatch and just pass the bytes. except factor of 4 inappropriate then. subroutine byteswapr4(value) real*4 value,exch1,exch2 character*1 exbyt1(4),exbyt2(4) equivalence (exch1,exbyt1(1)) equivalence (exch2,exbyt2(1)) exch1=value exbyt2(1)=exbyt1(2) exbyt2(2)=exbyt1(1) exbyt2(3)=exbyt1(4) exbyt2(4)=exbyt1(3) c value= exch2*4.0 !if run on vms-type machine (but file access needs fixing) value= exch2/4.0 !if run on unix machine return end c----------------------------------------- subroutine byteswapi4(value) integer*4 value,exch1,exch2 character*1 exbyt1(4),exbyt2(4) equivalence (exch1,exbyt1(1)) equivalence (exch2,exbyt2(1)) exch1=value exbyt2(1)=exbyt1(2) exbyt2(2)=exbyt1(1) exbyt2(3)=exbyt1(4) exbyt2(4)=exbyt1(3) value= exch2 return end c----------------------------------------- subroutine byteswapi2(value) real*4 value,exch1,exch2 character*1 exbyt1(2),exbyt2(2) equivalence (exch1,exbyt1(1)) equivalence (exch2,exbyt2(1)) exch1=value exbyt2(1)=exbyt1(2) exbyt2(2)=exbyt1(1) value= exch2 return end