Intel® Fortran Compiler 16.0 User and Reference Guide

Environment Variable FORT_CONVERTn Method

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.

When the appropriate environment variable is set when you open the file, the environment variable is always used because this method takes precedence over the other methods. For example, you might use this method to specify that a unit number will use a particular format instead of the format specified in the program (perhaps for a one-time file conversion).

For example, assume you have a previously compiled program that reads numeric data from unit 28 and writes it to unit 29 using unformatted I/O statements. You want the program to read nonnative big endian (IEEE floating-point) format from unit 28 and write that data in native little endian format to unit 29. In this case, the data is converted from big endian IEEE format to native little endian IEEE memory format when read from unit 28, and then written without conversion in native little endian IEEE format to unit 29.

Without requiring source code modification or recompilation of this program, the following command sequence sets the appropriate environment variables before running a program.

Linux:

setenv FORT_CONVERT28 BIG_ENDIAN
setenv FORT_CONVERT29 NATIVE

Windows:

set FORT_CONVERT28=BIG_ENDIAN 
set FORT_CONVERT29=NATIVE

The following figure shows the data formats used on disk and in memory when the program is run after the environment variables are set.

Sample Unformatted File Conversion

This method takes precedence over other methods.