# Environment Variable FORT_CONVERT.ext or FORT_CONVERT_ext Method

Use this method to specify a non-native numeric format for each specified file name extension (suffix). Specify the numeric format at run time by setting the appropriate environment variable before an implicit or explicit OPEN to one or more unformatted files. Use the format FORT_CONVERT.ext or FORT_CONVERT_ext (where ext is the file extension or suffix). The FORT_CONVERT.ext environment variable is checked before FORT_CONVERT_ext environment variable (if ext is the same).

For example, assume you have a previously compiled program that reads numeric data from one file and writes to another file using unformatted I/O statements. You want the program to read nonnative big endian (IEEE floating-point) format from a file with a .dat file extension and write that data in native little endian format to a file with an extension of .data. In this case, the data is converted from big endian IEEE format to native little endian IEEE memory format (IEEE binary32 and IEEE binary64) when read from file.dat, and then written without conversion in native little endian IEEE format to the file with a suffix of .data, assuming that environment variables FORT_CONVERT.DATA and FORT_CONVERTn (for that unit number) are not defined.

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

Example
    // Linux*
      setenv FORT_CONVERT.DAT BIG_ENDIAN
    // Windows*
      set FORT_CONVERT.DAT=BIG_ENDIAN

The FORT_CONVERTn method takes precedence over this method. When the appropriate environment variable is set when you open the file, the FORT_CONVERT.ext or FORT_CONVERT_ext environment variable is used if a FORT_CONVERTn environment variable is not set for the unit number.

The FORT_CONVERTn and the FORT_CONVERT.ext or FORT_CONVERT_ext environment variable methods take precedence over the other methods. For instance, 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).

You can set the appropriate environment variable using the format FORT_CONVERT.ext or FORT_CONVERT_ext. If you also use Intel® Fortran on Linux* systems, consider using the FORT_CONVERT_ext form, because a dot (.) cannot be used for environment variable names on certain Linux* command shells. If you do define both FORT_CONVERT.ext and FORT_CONVERT_ext for the same extension (ext), the file defined by FORT_CONVERT.ext is used.

On Windows* systems, the file name extension (suffix) is not case-sensitive. The extension must be part of the file name (not the directory path).

Parent topic: Specifying the Data Format