Host variable datatypes must be compatible with the datatypes of the corresponding database columns. So, before writing your application program, check the datatypes of the database columns.
The following rules apply to datatypes:
When you use any of the host variables in the “To: COBOL Datatype” column as input or output, the appropriate conversions occur automatically.
Indicator variables must be of usage COMP, COMP-3, COMP-4, COMP-5, BINARY, or a variant of DISPLAY. They must have a picture string of S9(4) or equivalent.
You can use any value with PIC S9(1-9) COMP. If decimal truncation occurs, no truncation message results. Instead, a SQLCA or SQLSTATE error message results, which specifically indicates digital truncation.
For example, if you select the value “1234” into a PIC S9(4), no truncation message occurs because the value fits in the given bytes. However, if you select “1234567” into PIC S9(3), a truncation message results because the value does not fit in the given bytes.