# Methods of Specifying the Data Format

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_CONVERT n, where n is the unit number.

- Set an environment variable for a specific file name extension before the file is opened. The environment variable is named FORT_CONVERT.ext or FORT_CONVERT_ext, where ext is the file name extension (suffix).

- Set an environment variable for a set of units before the application is executed. The environment variable is named F_UFMTENDIAN.

- Specify the CONVERT keyword in the OPEN statement for a specific unit number.

- Compile the program with an OPTIONS statement that specifies the CONVERT=keyword qualifier. This method affects all unit numbers using unformatted data specified by the program.

- Compile the program with the appropriate compiler option, which affects all unit numbers that use unformatted data specified by the program. Use the convert compiler option.

If none of these methods are specified, the native LITTLE_ENDIAN format is assumed (no conversion occurs between disk and memory).

Any keyword listed in Supported Native and Nonnative Numeric Formats can be used with any of these methods, except for the Environment Variable F_UFMTENDIAN Method, which supports only LITTLE_ENDIAN and BIG_ENDIAN.

If you specify more than one method, the order of precedence when you open a file with unformatted data is below:

1. Check for an environment variable (FORT_CONVERT n) for the specified unit number (applies to any file opened on a particular unit).

2. Check for an environment variable (FORT_CONVERT.ext is checked before FORT_CONVERT_ext) for the specified file name extension (applies to all files opened with the specified file name extension).

3. Check for an environment variable (F_UFMTENDIAN) for the specified unit number (or for all units).

   ### Note

   This environment variable is checked only when the application starts executing.

4. Check the OPEN statement CONVERT specifier.

5. Check whether an OPTIONS statement with a CONVERT:keyword qualifier was present when the program was compiled.

6. Check whether the convert compiler option was present when the program was compiled.

Parent topic: Specifying the Data Format

## See Also

convert
Environment Variable F_UFMTENDIAN Method
Environment Variable FORT_CONVERT.ext or FORT_CONVERT_ext Method
Environment Variable FORT_CONVERTn Method
OPEN Statement CONVERT Method
OPTIONS Statement Method
Supported Native and Nonnative Numeric Formats