Support for I/O of little-endian data files

Technote (troubleshooting)


Problem(Abstract)

The XL Fortran runtime currently reads and writes only big-endian data files. This prevents XL Fortran users from exchanging unformatted data files with Fortran applications running on little-endian machines.

Resolving the problem

A new runtime option, ufmt_littleendian, allows XL Fortran users to specify unit numbers of unformatted data files on which little-endian I/O is to be performed. The little-endian format data in the specified unformatted files is converted, on-the-fly, during the I/O operation to/from the big-endian format used on AIX or Linux PowerPC machines where XL Fortran applications are running.

The ufmt_littleendian runtime options can be specified with the XLFRTEOPTS environment variable or the SETRTEOPTS procedure. Specifying the ufmt_littleendian runtime options with the SETRTEOPTS procedure will reset the value if it has been set previously by the XLFRTEOPTS environment variable or an early call to the SETRTEOPTS procedure. The resetting of the option will not affect units that have already been opened.


Syntax:

ufmt_littleendian=unit_list

where

units_list = units | units_list, units

units = unit | unit- | -unit | unit1-unit2

'unit' specifies the number of the logical unit on which the little-endian I/O is to be performed.

'unit-' specifies the range of units, starting from unit number unit to the highest possible unit number, on which the little-endian I/O is to be performed.

'-unit' specifies the range of units, starting from unit number 1 to unit number unit, on which the little-endian I/O is to be performed.

'unit1-unit2' specifies the range of units, starting from unit number 'unit1' to unit number 'unit2', on which the little-endian I/O is to be performed.

The unit number must be an integer, whose value is in the range 1 through 2147483647.

Units specified must be connected by an explicit or implicit OPEN for the UNFORMATTED form of I/O.

This runtime option does not work with internal files; internal files are always FORMATTED.


Notes:

1. The byte order of data of type CHARACTER is not swapped.

2. The compiler assumes that the internal representation of values of type REAL*4 or REAL*8 is IEEE floating-point format compliant. I/O may not work properly with an internal representation that is different.

3. The internal representation of values of type REAL*16 is inconsistent among different vendors. The compiler treats the internal representation of values of type REAL*16 to be the same as XL Fortran's. I/O may not work properly with an internal representation that is different.

4. Conversion of derived type data is not supported. The alignment of derived types is inconsistent among different vendors.

5. Discrepancies in implementations from different vendors may cause problems in exchanging the little-endian unformatted data files between XL Fortran applications running on AIX or Linux and Fortran applications running on little-endian systems. XL Fortran provides a number of options that help users port their programs to XL Fortran. If there are problems exchanging little-endian data files, check these options to see if they can help with the problem.

Rate this page:

(0 users)Average rating

Document information


More support for:

XL Fortran
Compiler

Software version:

10.1, 10.1.1

Operating system(s):

AIX, Linux

Software edition:

Advanced Edition, Enterprise Edition

Reference #:

1243120

Modified date:

2006-08-31

Translate my page

Machine Translation

Content navigation