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



Sorry, Thorbjørn, but you won't be getting a COBOL PIC 9(5) to work
correctly. Please see
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/rzajp/rzajpequiv
sqlcobol.htm. NUMERIC(5, 0) is equivalent to specifying

PIC S9(5)

which is exactly what you're seeing in the dump. Note the S in front of the
9(5). This means that you are requesting a leading sign byte which is
exactly what you're getting.

From the page above, it looks like there is no way to pass a 9(5) to a COBOL
program using SQL. :(

HTH,
Gary


-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Thorbjørn Ravn Andersen
Sent: Monday, September 01, 2008 2:27 AM
To: Java Programming on and around the iSeries / AS400
Subject: Re: JDBC CallableStatement, plain Program Call, and output
parameters...

...+
===

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

COMMENT ON SPECIFIC PROCEDURE TRATEST."add2num OPM"
IS 'test jdbc-opm programcall' ;

===

and here is the Cobol code (I use WSDCi 7.0 to call the compiler):

===
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 full text retreived with "D" in the inquery message (just for
completeness):

===
MCH1202 exception in program ADD2NUM in TRATEST at MI instruction number
0035 COBOL statement number 14.
FORMATTED DATA DUMP FOR PROGRAM ADD2NUM.TRATEST 11:16:12
01.09.08
NAME OFFSET ATTRIBUTES
VALUE

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

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 mentioned I need to get the PIC(5) mask to work properly. If I
cannot get rid of the sign, I can live with only being able to stuff a
sign + four digits in the area if I can get the result properly back
from C and D :)

I'd still appreciate any hints or suggestions :)

--


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.