Methods of Specifying the Data Format

There are five methods of specifying a nonnative numeric format for unformatted data. 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.

The five methods you can use to specify the type of nonnative (or native) format are as follows:

  1. Setting 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.
  2. Setting 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).
  3. Compiling 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.
  4. Specifying the CONVERT keyword in the OPEN statement for a specific unit number.
  5. Compiling the program with the appropriate compiler option (DF command /convert: keyword or visual development environment equivalent), which affects all unit numbers that use unformatted data specified by the program.

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

  1. Check for an environment variable (FORT_CONVERTn) 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 the OPEN statement CONVERT specifier.
  4. Check whether an OPTIONS statement with a /CONVERT=keyword qualifier was present when the program was compiled.
  5. Check whether the compiler option /convert:keyword was present when the program was compiled.

The following sections describe each method: