Current Revision posted to Visual COBOL Knowledge Base by evank on 4/9/2015 2:46:55 PM
Problem:
Usually in a COBOL program we define the host variable as COMP to map directly onto the INT DB2 data type. When a variable is defined as COMP in the linkage section of a COBOL DB2 stored procedure for LUW, and you try to pass a numeric value to this variable from a COBOL program, you may get a value different from what you have passed.
Resolution:
DB2 is passing in the data to the stored procedure as little-endian on an Intel system. Defining the variable as COMP-5 in the linkage section of the COBOL DB2 stored procedure program solves the problem. See attachment for an example of a COBOL DB2 stored procedure and a COBOL program that calls it.
SI2807407