10.6.7 CONVERT Keyword

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

CONVERT = fm
fm
Is a character expression with one of the following values:

Option  Description 
'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*16. 
'FDX'   Little endian integer data[2] and Digital VAX floating-point data of format F_floating for REAL*4 or COMPLEX*8, D_floating for size REAL*8 or COMPLEX*16, and IEEE X_floating for REAL*16.
'FGX'   Little endian integer data[2] and Digital VAX floating-point data of format F_floating for REAL*4 or COMPLEX*8, G_floating for size REAL*8 or COMPLEX*16, and IEEE X_floating for REAL*16.
'IBM'   Big endian integer data[2] and IBM System\370 floating-point data of size REAL*4 or COMPLEX*8 (IBM short 4), and size REAL*8 or COMPLEX*16 (IBM long 8). 
'VAXD'   Little endian integer data[2] and Digital VAX floating-point data of format F_floating for size REAL*4 or COMPLEX*8, D_floating for size REAL*8 or COMPLEX*16, and H_floating for REAL*16. 
'VAXG'   Little endian integer data[2] and Digital VAX floating-point data of format F_floating for size REAL*4 or COMPLEX*8, G_floating for size REAL*8 or COMPLEX*16, and H_floating for REAL*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 (Alpha only)
[3] Of the appropriate size and type: REAL*4, REAL*8, REAL*16, 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 a Tru64 UNIX environment variable or the compiler option CONVERT (or OPTIONS/CONVERT). The order of precedence is Tru64 UNIX environment variable, OPEN (CONVERT=), OPTIONS/CONVERT, and then compiler option CONVERT. The CONVERT compiler option and OPTIONS/CONVERT affect all unit numbers used by the program, while environment variables 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