Michael,
I am not sure what you are doing is exactly the same, but I tried the
returns keyword anyways. It doesn't work for an external procedure that I
can tell or find in the docs. I guess that is only a supported feature when
creating an SQL function, not an external procedure.
I hope someone can shed some light on this. I am thinking about calling
IBM! eek.
Thanks,
Robert Newton
EDPS
Electronic Data Processing Services
Software Engineer
rnewton@xxxxxxxxxxxxxxxxx
This communication is confidential and is intended to be privileged. If
there is a problem with this transmission, please contact the sender. If
the reader of this message is not the intended recipient, or the employee
or agent responsible to deliver it to the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.
Michael_Schutte@b
obevans.com
Sent by: To
rpg400-l-bounces@ RPG programming on the AS400 /
midrange.com iSeries <rpg400-l@xxxxxxxxxxxx>
cc
11/27/2007 11:54 Subject
AM Re: Wrap an RPG Procedure with an
SQL External Procedure
Please respond to
RPG programming
on the AS400 /
iSeries
<rpg400-l@midrang
e.com>
That's funny... I'm trying this out for the first time today and having an
issue.
But with your's where is the RETURNS in your SQL Function.
My issue is that it doesn't matter what I return... I'm getting a decimal
data-error.
Create Function SCRLIBTST/VOLUMEVARIANCE
(T1_Volume Dec(15,0),
T1_MixByStore Dec(17,4),
T1_UnitPrice Dec(17,4),
T1_NetTotal Dec(17,4),
T1_SumVolume Dec(15,0),
T2_Volume Dec(15,0),
T2_NetTotal Dec(17,4),
T2_SumVolume Dec(15,0)
)
Returns Dec(17,4)
LANGUAGE RPGLE
SPECIFIC SCRLIBTST/VOLUMEVARIANCE
DETERMINISTIC
NO SQL
RETURNS NULL ON NULL INPUT
NO EXTERNAL ACTION
NOT FENCED
EXTERNAL NAME 'SCRLIBTST/SCRGKPICP(VOLUMEVARIANCE)'
PARAMETER STYLE SQL ;
P VolumeVariance B Export
D VolumeVariance PI 17p 4
D T1_Volume 15p 0 Const
D T1_MixByStore 17p 4 Const
D T1_UnitPrice 17p 4 Const
D T1_NetTotal 17p 4 Const
D T1_SumVolume 15p 0 Const
D T2_Volume 15p 0 Const
D T2_NetTotal 17p 4 Const
D T2_SumVolume 15p 0 Const
D SMV S 17 4
D SQV S 17 4
D SUM S 17p 4
D nActiveInBoth S N
/Free
nActiveInBoth = T1_SumVolume <> 0 And T2_SumVolume <> 0;
SMV = SalesMixVariance(nActiveInBoth:T1_MixByStore:T1_UnitPrice:
T2_Volume:T2_SumVolume);
SQV = SalesQuantityVariance(nActiveInBoth:T1_NetTotal:T1_MixByStore:
T1_Volume:T1_UnitPrice:T2_NetTotal:T2_SumVolume);
SUM = SMV + SQV;
SUM = 1;
Return SUM;
/End-Free
P VolumeVariance E
Michael Schutte
Admin Professional
Bob Evans Farms, Inc.
"The Secret's the Sauce! Enjoy our new Bob-B-Q Pulled Pork Knife & Fork
Sandwich!"
rpg400-l-bounces@xxxxxxxxxxxx wrote on 11/27/2007 11:44:24 AM:
Hi all,
I am working on a service program that will need to be called from both
SQL
and other RPG bound applications. I have created the SQL external
procedure
to call one of the RPG procedures in the service program like so:
CREATE PROCEDURE LIBRARY.CALLRPGPROC (
IN APARM CHAR(12) )
LANGUAGE RPGLE
SPECIFIC LIBRARY.SRVPGM01
NOT DETERMINISTIC
MODIFIES SQL DATA
CALLED ON NULL INPUT
EXTERNAL NAME 'LIBRARY/SRVPGM(RPGPROCEDURE)'
PARAMETER STYLE SQL ;
The RPG procedure looks like this:
d rpgProcedure...
d pi N
d pr_aparm 12a const
When I run the SQL proc however, I get the following error:
MCH3601 unmonitored by XIG11S600 at statement 0000000445
(pointer not set for location referenced)
Statement 445 of the RPG proc is the return:
000445 return true;
I have searched the archives, google, and IBM docs but have not been
successful in finding information on how to call an RPG service program's
procedure that returns a value, from within an SQL external procedure.
Has
anyone ever found any mention of this anywhere? Is it possible, or do I
have to change my service programs to use inout parms rather than
returning
a value just so that I can wrap it with an SQL proc?
Thanks in advance,
Robert Newton
EDPS
Electronic Data Processing Services
Software Engineer
rnewton@xxxxxxxxxxxxxxxxx
This communication is confidential and is intended to be privileged. If
there is a problem with this transmission, please contact the sender. If
the reader of this message is not the intended recipient, or the employee
or agent responsible to deliver it to the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.