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 (COMP) COBOL data items, and for different length character strings, such as from varying‑length Ingres character fields into COBOL alphabetic and alphanumeric data items.
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 conversions.
The following table shows the default type compatibility for each Ingres data type in UNIX and VMS. Note that some COBOL types are omitted from the table because they do not exactly match an Ingres type. Use of those types necessitates some runtime conversion, which may possibly result in some loss of precision.
Windows and UNIX:
There is no exact match for float, so use COMP
‑3.
Ingres types and their corresponding COBOL data types are listed in the following table:
*This type may not map to 8-byte integers with some COBOL compilers.
Note that Ingres stores decimal as signed. Thus, use a signed decimal variable if it interacts with an Ingres decimal type. Also, Ingres allows a maximum precision of 39 while COBOL allows only 18.