Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

z/OS stored procedure doesn't return value

3 views
Skip to first unread message

N61...@gmail.com

unread,
Apr 4, 2008, 10:11:49 AM4/4/08
to
I'm running a java program on a PC which calls z/OS SQL stored
procedure. The stored procedure returns an integer which should
contain "2", but is always "0".

I (pre)compile the stored procedure from the PC using "IBM Data
Studio" which automatially refreshes the WLM proc.

Is there something simple I'm missing? Do I need to stop/start the
DB2 procedure?

Thank you in advance,
Serenity

Background -
Running UDB V9.5 on PC
Running DB2 v8.1 on z/OS 1.5

Java snippet -
cstmt = con.prepareCall("CALL SCRATCHDB.SAMPLEPROCEDURE(?)");
cstmt.registerOutParameter(1, Types.INTEGER);
cstmt.execute();
int AwCrap = cstmt.getInt(1);
System.out.println("SAMPPROC output - " + AwCrap);

Stored procedure -
CREATE PROCEDURE SAMPLEPROCEDURE
(OUT RETURN_THIS_DAMNIT INTEGER )
RESULT SETS 1
LANGUAGE SQL
EXTERNAL NAME SAMPPROC
FENCED
COLLID SCRATCHDB
WLM ENVIRONMENT WLMENV1
RUN OPTIONS 'NOTEST(NONE,*,*,*)'
BEGIN
DECLARE RETURN_THIS_DAMNIT INTEGER DEFAULT 1;
SET RETURN_THIS_DAMNIT = 2;
END

Running hte java program displays -
SAMPPROC output - 0

Knut Stolze

unread,
Apr 7, 2008, 8:24:29 AM4/7/08
to
N61...@gmail.com wrote:

This declaration here is shadowing the input parameter. You're sure you
want to do this?

> SET RETURN_THIS_DAMNIT = 2;
> END

Try this procedure:

CREATE PROCEDURE SAMPLEPROCEDURE (OUT return_this_damnit INTEGER)
LANGUAGE SQL
BEGIN
SET return_this_damnit = 2;
END@

This one works fine for me.

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany

0 new messages