To COBOL integers
Assignment to COBOL integer variables uses the full size of the integer.
Thus, the value placed in the COBOL data item might be out of the range of values.
COBOL supports some data types with no SQL equivalent (BINARY decimal and DISPLAY decimal data items, for example). In most cases, you can use COBOL statements to convert between the unsupported COBOL data types and the data types that SQL supports.
For DB2® for z/OS®, the only BINARY numeric variables allowed as HOST variable are integer binary variables. The only DECIMAL host variables supported by SQL are packed decimal host variables.
Example 1: If COL1 contains a value of 12345, the following
statements cause the value 12345 to be placed in A,
even though A has been defined with only 4 digits:
01 A PIC S9999 BINARY.
EXEC SQL SELECT COL1
INTO :A
FROM TABLEX
END-EXEC.
Example 2: The following COBOL statement results in 2345
being placed in A:
MOVE 12345 TO A.