COBOL DB2 stored procedure integer parameter gets incorrect value

0 Likes
over 6 years ago

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

db2sp.zip

Comment List
Anonymous
Related Discussions
Recommended