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



On 3/10/11 11:52 AM, Mike Wills wrote:
A web search shows me how to use stored procedures to call RPG, but
I want to call a stored procedure from RPG with one out parameter.
We are currently doing `call MPRLIB/SP_VERIFYHOURS (:key, :reply)`
but it doesn't seem to be working. key is defined as IN and reply is
defined as OUT. What are we missing?


Here is a working example, FWiW:

<code>

create procedure testx (in p1 date, out p2 smallint)
language sql
begin
if p1=current date then set p2=1; else set p2=0;
end if;
end

CRTSQLRPGI CALL_TESTX SRCFILE(QRPGLESRC) SRCMBR(CALL_TESTX) COMMIT(*NONE) OBJTYPE(*PGM) REPLACE(*YES) /* of below source */

D DT S D inz(*SYS)
D DI S 3i 0 inz(-1)

C/Exec SQL
C+ Set Option Commit=*NONE, DatFmt=*ISO
C/End-Exec

C/Exec SQL
C+ call testx (:dt,:di)
C/End-Exec

/free
*inlr = *on;

STRDBG CALL_TESTX /* set bkp on set inlr */

CALL CALL_TESTX /* eval DI at bkp shows 1; unless passing midnight between INZ() and CALL :-) then eval DI would show 0 */

</code>

Regards, Chuck

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