OPEN Statement CONVERT Method

You can use this method to specify a non-native numeric format for each specified unit number. This method requires an explicit file OPEN statement to specify the numeric format of the file for that unit number.

This method takes precedence over the OPTIONS statement and the compiler option -convert keyword method, but has a lower precedence than the environment variable methods.

For example, the following source code shows how the OPEN statement would be coded to read unformatted VAXD numeric data from unit 15, which might be processed and possibly written in native little endian format to unit 20. (The absence of the CONVERT keyword or environment variables FORT_CONVERT20, FORT_CONVERT.dat, FORT_CONVERT_dat, or F_UFMTENDIAN indicates native little endian data for unit 20.)

OPEN (CONVERT='VAXD', FILE='graph3.dat', FORM='UNFORMATTED', UNIT=15)

 

.

 

OPEN (FILE='graph3_t.dat', FORM='UNFORMATTED', UNIT=20)

A hard-coded OPEN statement CONVERT keyword value cannot be changed after compile time. However, to allow selection of a particular format at run time, equate the CONVERT keyword to a variable and provide the user with a menu that allows selection of the appropriate format (menu choice sets the variable) before the OPEN occurs.

You can also select a particular format at run time for a unit number by using one of the environment variable methods (FORT_CONVERTn, FORT_CONVERT.ext, FORT_CONVERT_ext, or F_UFMTENDIAN), which take precedence over the OPEN statement CONVERT keyword method.