First off, if you want to future-proof your code, you should pick one of the following and use it:
But if you really do want the expedient route, then read on....
Here is an example of converting a file with variable length records from linux/g95/x86 to AIX/xlf90_r/pSeries. As it happens, the file was made of real*4's and real*8's, and fortuitously, x86 and pSeries actually use the same kind of real's, just layed out in memory in a different order - hence there was no need to convert to ASCII or other neutral format, nor to get into "mantissa - exponent - radix - fieldwidths" nonsense.
/usr/local/bin/add-fortran-framing You must use exactly one of -r, -f or -o Usage: /usr/local/bin/add-fortran-framing [-r recordfile|-f fixedreclen|-o] -w word_size [-h] -r recordfile means to read a series of record lengths from file recordfile -f fixedreclen means to assume a fixed record length -o means to assume the file has a single record -w wordsize specifies the size of the integers used in the framing. Common values are 4 and 8 -b says to assume big endian byte ordering of the integers used for framing -l says to assume little endian byte ordering of the integers used for framing -h shows help
add-fortran-framing -o -w 4 -b < MLLATMSB > foo mv MLLATMSB MLLATMSB.original mv foo MLLATMSB ./read_lat_lon 75.01390839
You can e-mail the author with questions or comments: