× 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.



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.
Thanks!

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?

The full output of D) to the inquery message:
====
MCH1202 exception in program ADD2NUM in TRATEST at MI instruction number 0035 COBOL statement number 14. FORMATTED DATA DUMP FOR PROGRAM ADD2NUM.TRATEST 10:12:11 29.08.08 NAME OFFSET ATTRIBUTES VALUE
A 009120 ZONED(5,0)
**INVALID DATA '00010F0002'X
B 009123 ZONED(5,0)
**INVALID DATA '00025F0000'X
C 009126 ZONED(5,0)
**INVALID DATA '00000F0000'X
D 009129 ZONED(5,0)
**INVALID DATA '00000F0000'X
STATIC STORAGE FOR PROGRAM ADD2NUM.TRATEST BEGINS AT OFFSET 072240 IN THE PROGRAM STATIC STORAGE AREA (PSSA) AUTOMATIC STORAGE FOR PROGRAM ADD2NUM.TRATEST BEGINS AT OFFSET 000080 IN THE PROGRAM AUTOMATIC STORAGE AREA (PASA) ====

As you can see A starts with 00010 (which is the 10 I sent it), and B starts with 00025. The cobol program is rather simple.

===
IDENTIFICATION DIVISION.

PROGRAM-ID. ADD2NUM.
AUTHOR. TRA.
DATE-WRITTEN. AUG 2008.

ENVIRONMENT DIVISION.

DATA DIVISION.

WORKING-STORAGE SECTION.

LINKAGE SECTION.
01 A PIC 9(5).
01 B PIC 9(5).
01 C PIC 9(5).
01 D PIC 9(5).

PROCEDURE DIVISION USING A, B, C, D.

MAIN SECTION.

MAIN-BEGIN.

COMPUTE C = A + B.
COMPUTE D = A * B.

MAIN-EXIT.
STOP RUN.
===

and the Operation navigator generated SQL looks like:

===
CREATE PROCEDURE TRATEST.ADD2NUM (
IN A DECIMAL(5) ,
IN B DECIMAL(5) ,
OUT C DECIMAL(5) ,
OUT D DECIMAL(5) )
LANGUAGE COBOL
SPECIFIC TRATEST."add2num OPM"
NOT DETERMINISTIC
NO SQL
CALLED ON NULL INPUT
EXTERNAL NAME 'TRATEST/ADD2NUM'
PARAMETER STYLE GENERAL ;
===

I'd appreciate a hint :)


Thanks in advance,


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.