Certain predefined FORTRAN data types correspond to DB2® database column types. Only these FORTRAN data types can be declared as host variables.
The following table shows the FORTRAN equivalent of each column type. When the precompiler finds a host variable declaration, it determines the appropriate SQL type value. The database manager uses this value to convert the data exchanged between the application and itself.
SQL Column Type1 | FORTRAN Data Type | SQL Column Type Description |
---|---|---|
SMALLINT |
INTEGER*2 | 16-bit, signed integer |
INTEGER |
INTEGER*4 | 32-bit, signed integer |
REAL2 |
REAL*4 | Single precision floating point |
DOUBLE3 |
REAL*8 | Double precision floating point |
DECIMAL(p,s) |
No exact equivalent; use REAL*8 | Packed decimal |
CHAR(n) |
CHARACTER*n | Fixed-length character string of length n where n is from 1 to 254 |
VARCHAR(n) |
SQL TYPE IS VARCHAR(n) where n is from 1 to 32 672 | Variable-length character string |
LONG VARCHAR5 |
SQL TYPE IS VARCHAR(n) where n is from 32 673 to 32 700 | Long variable-length character string |
CLOB(n) |
SQL TYPE IS CLOB (n) where n is from 1 to 2 147 483 647 | Large object variable-length character string |
CLOB locator variable4 |
SQL TYPE IS CLOB_LOCATOR | Identifies CLOB entities residing on the server |
CLOB file reference variable4 |
SQL TYPE IS CLOB_FILE | Descriptor for file containing CLOB data |
BLOB(n) |
SQL TYPE IS BLOB(n) where n is from 1 to 2 147 483 647 | Large object variable-length binary string |
BLOB locator variable4 |
SQL TYPE IS BLOB_LOCATOR | Identifies BLOB entities on the server |
BLOB file reference variable4 |
SQL TYPE IS BLOB_FILE | Descriptor for the file containing BLOB data |
DATE |
CHARACTER*10 | 10-byte character string |
TIME |
CHARACTER*8 | 8-byte character string |
TIMESTAMP(p) |
CHARACTER*19 to CHARACTER*32 | 19 to 32 byte character string |
XML |
SQL_TYP_XML |
There is no XML support for FORTRAN; applications are able to get the describe type back but will not be able to make use of it. |
Note:
|