The Fortran language standard specifies little about the storage of data types.
You can achieve the highest transportability of your data by formatting it as 8-bit character data. Use a standard character set, such as the ASCII standard, for encoding your character data. Although this practice is less efficient than using binary data, it will save you from shuffling and converting your data.
Data storage in different computers uses a convention of either little endian or big endian storage. The storage convention generally applies to numeric values that span multiple bytes, as follows:
Little endian storage occurs when:
The least significant bit (LSB) value is in the byte with the lowest address.
The most significant bit (MSB) value is in the byte with the highest address.
When porting nonnative data, consider the following:
Vendors might use different units for specifying the record length (RECL specifier) of unformatted files. While formatted files are specified in units of characters (bytes), unformatted files are specified in longword units for Intel® Fortran (default) and some other vendors.
There are a number of methods for specifying a nonnative numeric format for unformatted data:
Set an environment variable for a specific unit number before the file is opened. The environment variable is named FORT_CONVERTn, where n is the unit number.
You can use this method to specify a nonnative numeric format for each specified unit number. You specify the numeric format at run time by setting the appropriate environment variable before an implicit or explicit OPEN to that unit number.
This little-endian-big-endian conversion feature is intended for Fortran unformatted input/output operations. It enables the development and processing of files with little-endian and big-endian data organization.
The F_UFMTENDIAN environment variable is processed once at the beginning of program execution. Whatever it specifies for specific units or for all units continues for the rest of the execution.