Link to home
Start Free TrialLog in
Avatar of ArshadAQ
ArshadAQ

asked on

Invoking DB2 Stored Procedure using Java PreparedStatement

I am having a problem with Java Client for DB2 stored procedure. I am using PreparedStatement and setting data using setString() function. In some cases when I have large buffer size the data is getting misaligned on the mainframe side due to some binary/invalid chars getting appended before the string.

Following is the Stored Procedure I/O Structure:

Field Name     DATA TYPE     INPUT/OUTPUT     SIZE
_____________________________________________________
HDRCNTL             VARCHAR          INPUT          300
INORDERNO     CHAR          INPUT          9
INGENL          CHAR          INPUT          91
INDATA          VARCHAR          INPUT          29942
COMMAREA     VARCHAR          OUTPUT          400
_____________________________________________________

I am using setString() to set all the input data elements. The data received on mainframe has 2 additional chars in the beginning of INDATA string. I tried using setBytes() also and that doesn't work either. I am looking for solution to avoid the 2 chars getting on mainframe DB2.


Thanks much.
ASKER CERTIFIED SOLUTION
Avatar of asharma2
asharma2

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vemul
vemul

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- points to asharma2

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

vemul
Cleanup Volunteer
Comment from expert accepted as answer

Computer101
E-E Admin