What are the COBOL host variable equivalent for various DB2 data types?

DB2DatabaseBig Data Analytics

The host variables are used to transfer the data from DB2 to program and vice versa.For each DB2 table column we have a COBOL equivalent host variable defined. The host variables can be generated automatically using the DCLGEN utility or we can explicitly give the host variables in the working storage section of the COBOL-DB2 program.

The COBOL equivalent of various DB2 data types is mentioned in the table below.

DB2 data typesCOBOL equivalent
SMALLINT - 2 bytesPIC S9(4) COMP
INTEGER - 4 bytesPIC S9(9) COMP
TIMESTAMP - 10 bytesPIC X(26)
CHAR - 5 bytesPIC X(5)
Published on 14-Sep-2020 17:57:03