Quantcast
Channel: Visual COBOL Knowledge Base
Viewing all articles
Browse latest Browse all 214

COBOL DB2 stored procedure integer parameter gets incorrect value

$
0
0
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

db2sp.zip


Viewing all articles
Browse latest Browse all 214

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>