× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Simon Coulter skrev den 01-09-2008 13:49:

Your COBOL program is fine. The SQL statement looks fine to me. Given that all the numbers are stuffed in the COOL program and they are all passed in from whatever invokes the stored procedure I would be examining the data being passed up from the Java application.

A 009120 ZONED(5,0) **INVALID DATA '4EF0F0F0F0'X
B 009126 ZONED(5,0) **INVALID DATA '4EF0F0F0F2'X
C 00912C ZONED(5,0) **INVALID DATA '4EF0F0F0F0'X
D 009132 ZONED(5,0) **INVALID DATA '4EF0F0F0F0'X

The hexadecimal for these values ought to be:
X'F0F0F0F0F0'
X'F0F0F0F0F2'
X'F0F0F0F0F0'
X'F0F0F0F0F0'

So look at why the Java application is not passing properly formatted NUMERIC data.
Thank you for your very detailed answers, which helps clarifying this to me (where have you found this by the way, it must be documented somewhere :).

I think I have failed to communicate, however, that what I am trying to get working is _this_ snippet:

CallableStatement cs = c.prepareCall("call tratest/ADD2NUM(?,?,?,?)");
log.info("Got callable statement");
for (int i = 0; i < 10000; i++) {
boolean doLog = (i % 100) == 0;
int a = 1 + i;
int b = 25 + i;
cs.setObject(1, new BigDecimal(a));
cs.setObject(2, new BigDecimal(b));
cs.registerOutParameter(3, cs.getParameterMetaData().getParameterType(3));
cs.registerOutParameter(4, cs.getParameterMetaData().getParameterType(4));
if (doLog)
log.info("Set parameters for " + i);
cs.execute();
if (doLog)
log.info("execute() called");
o1 = cs.getBigDecimal(3);
if (o1.longValue() != (a + b))
log.info("i: bad result");

o2 = cs.getBigDecimal(4);
if (doLog)
System.out.println(o1 + ", " + o1.getClass() + " " + o2 + ", " + o2.getClass());
}


So what I am trying to do is not as such calling _from_ Java but _through_ SQL, so it is essentially DB2/400 I want to talk correctly to my Cobol program. I can do this easily directly with a ProgramCall in Java but I wanted to see if there was any benefits in accessing our "you must go through THIS program to talk to our legacy system"-program using the pooling and caching mechanisms of DB2 and JDBC pools (plus it allows us to use any programming language with a database driver).

While discussing with you helpful folks I am playing with WSDCi to see if ILE Cobol gives better results or similar :)


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.