Thorbjørn Ravn Andersen wrote:
Coy Krill skrev den 26-08-2008 17:59:
Our software vendor has several RPGLE programs that they use like an API. Here is the code I use to wrap one of their more useful ones. It basically make an SQL reference to the external program and tells SQL how the parameters work etc. This should get you started.

I am getting near :) I can invoke my program but it crashes. I have destilled the problem to being that I need integer values in a PIC 9(5) field (which apparently is a ZONED(5,0) when I answer D to the inquery message in QSYSOPR), and that DECIMAL seems not to initialize it properly and CHAR(5) wasn't what I thought :) Chapter 6 in "Stored Procedures, Triggers, and User-Defined Functions on DB2 Universal Database for iSeries" did not make it clear for me, so perhaps one on the list can nudge me in the right direction?

Ah, the joys of numeric data. You have two options:

In the SQL, specify NUMERIC rather than DECIMAL. This will make the parameters zoned decimal.

In the COBOL, specify COMP-3 on your variables. This will make the values packed.

To summarize:
PIC 9(5) = NUMERIC(5,0)
PIC 9(5) COMP-3 = DECIMAL(5, 0)

It gets a little trickier with signed data. I would lean towards NUMERIC to avoid any issues.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

This mailing list archive is Copyright 1997-2022 by 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.