3. Embedded QUEL for COBOL : COBOL Variables and Data Types : Data Type Conversion
 
Share this page                  
Data Type Conversion
A COBOL data item must be compatible with the Ingres value it represents. Numeric Ingres values can be set by and retrieved into COBOL numeric and numeric edited items, and Ingres character values can be set by and retrieved into COBOL character data items, that is, alphabetic, alphanumeric, and alphanumeric edited items.
Data type conversion occurs automatically for different numeric types, such as from floating-point Ingres database column values into integer COBOL variables, and for character strings, such as from varying-length Ingres character fields into fixed-length COBOL character string buffers.
Ingres does not automatically convert between numeric and character types, such as from Ingres integer fields into COBOL alphanumeric data items. You must use the Ingres type conversion functions, the Ingres ascii function, or the COBOL STRING statement to effect such conversion.
The following table shows the default type compatibility for each Ingres data type. Note that some COBOL types are omitted from the table because they do not exactly match a Ingres type. Use of those types necessitates some runtime conversion, which may possibly result in some loss of precision.
UNIX: There is no exact match for float, so use COMP-3.