12.6.9 CONVERT Specifier

The CONVERT specifier indicates a nonnative numeric format for unformatted data. It takes the following form:

CONVERT = fm

fm
Is a scalar default character expression that evaluates to one of the following values:


'LITTLE_ENDIAN'1  Little endian integer data 2 and IEEE® floating-point data. 3 
'BIG_ENDIAN' 1   Big endian integer data 2 and IEEE floating-point data. 3 
'CRAY'   Big endian integer data 2 and CRAY® floating-point data of size REAL(8) or COMPLEX(8). 
'FDX'   Little endian integer data 2 and Compaq VAXTM floating-point data of format F_floating for REAL(4) or COMPLEX(4), D_floating for size REAL(8) or COMPLEX(8), and IEEE X_floating for REAL(16) or COMPLEX(16). 
'FGX'   Little endian integer data 2 and Compaq VAX floating-point data of format F_floating for REAL(4) or COMPLEX(4), G_floating for size REAL(8) or COMPLEX(8), and IEEE X_floating for REAL(16) or COMPLEX(16). 
'IBM'   Big endian integer data 2 and IBM® System\370 floating-point data of size REAL(4) or COMPLEX(4) (IBM short 4), and size REAL(8) or COMPLEX(8) (IBM long 8). 
'VAXD'   Little endian integer data 2 and Compaq VAX floating-point data of format F_floating for size REAL(4) or COMPLEX(4), D_floating for size REAL(8) or COMPLEX(8), and H_floating for REAL(16) or COMPLEX(16). 
'VAXG'   Little endian integer data 2 and Compaq VAX floating-point data of format F_floating for size REAL(4) or COMPLEX(4), G_floating for size REAL(8) or COMPLEX(8), and H_floating for REAL(16) or COMPLEX(16). 
'NATIVE'   No data conversion. This is the default. 

1 INTEGER(1) data is the same for little endian and big endian.
2 Of the appropriate size: INTEGER(1), INTEGER(2), INTEGER(4), or INTEGER(8)
3 Of the appropriate size and type: REAL(4), REAL(8), REAL(16), COMPLEX(4), COMPLEX(8), or COMPLEX(16)

You can use CONVERT to specify multiple formats in a single program, usually one format for each specified unit number.

When reading a nonnative format, the nonnative format on disk is converted to native format in memory. If a converted nonnative value is outside the range of the native data type, a run-time message appears.

There are other ways to specify numeric format for unformatted files: you can specify an OpenVMS logical name, the command line qualifier /CONVERT, or OPTIONS/CONVERT. The following shows the order of precedence:

Method Used  Precedence 
An OpenVMS logical name  Highest 
OPEN (CONVERT=) 
   .   
OPTIONS/CONVERT 
   .   
The /CONVERT qualifier  Lowest 

The /CONVERT qualifier and OPTIONS/CONVERT affect all unit numbers used by the program, while logical names and OPEN (CONVERT=) affect specific unit numbers.

The following example shows how to code the OPEN statement to read unformatted CRAY numeric data from unit 15, which might be processed and possibly written in native little endian format to unit 20:

 OPEN (CONVERT='CRAY', FILE='graph3.dat', FORM='UNFORMATTED',
1     UNIT=15)
     .
     .
     .
 OPEN (FILE='graph3_native.dat', FORM='UNFORMATTED', UNIT=20)

For More Information:


Previous Page Next Page Table of Contents