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



Thank you john... just what I needed.

PARAMETER STYLE GENERAL ;

I had SQL as the style. Changing it to general fixed the problem I was
having.

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 12:34:35 PM:

The following UDF calls the RPGLE procedure 'pDetermineDays()', which is
exported from service program RPTSTATE:

CREATE FUNCTION ISPGMPRD/RPTSTATE (
CTID DECIMAL(7, 0) ,
CTCK DECIMAL(1, 0) ,
STA@ CHAR(2) ,
SRNB NUMERIC(2, 0) ,
ARCY NUMERIC(4, 0) ,
CG1@ CHAR(1) ,
LOID DECIMAL(5, 0) ,
LOBR DECIMAL(4, 0) ,
OCDN DECIMAL(1, 0) )
RETURNS CHAR(2)
LANGUAGE RPGLE
SPECIFIC RPTSTATE
DETERMINISTIC
NO SQL
NO EXTERNAL ACTION
NOT FENCED
EXTERNAL NAME 'ISPGMPRD/RPTSTATE(pDetermineState)'
PARAMETER STYLE GENERAL ;

The procedure interface to 'pDetermineDays()':
D pDetermineState...
D PI LIKE(wISPFPCMDataDSN.PLRSCM)
D wCertificateNumber...
D LIKE(wISPFPCMDataDSN.CTIDCM)
D CONST
D wCertificateCheckDigit...
D LIKE(wISPFPCMDataDSN.CTCKCM)
D CONST
D wPropertyState...
D LIKE(wISPFPCMDataDSN.STA@CM)
D CONST
D wSalesRegionNumber...
D LIKE(wISPFPCMDataDSN.SRNBCM)
D CONST
D wApplicationReceivedYear...
D LIKE(wISPFPCMDataDSN.ARCYCM)
D CONST
D wCertificateGroup1Code...
D LIKE(wISPFPCMDataDSN.CG1@CM)
D CONST
D wOriginatingLenderID...
D LIKE(wISPFPCMDataDSN.LOIDCM)
D CONST
D wOriginatingLenderBranch...
D LIKE(wISPFPCMDataDSN.LOBRCM)
D CONST
D wOriginatingLenderBranchCheckDigit...
D LIKE(wISPFPCMDataDSN.OCDNCM)
D CONST

HTH

JJ


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of RNewton@xxxxxxxxxxxx
Sent: Tuesday, November 27, 2007 11:10 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: Wrap an RPG Procedure with an SQL External Procedure

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.



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


No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.8/1154 - Release Date:
11/27/2007
11:40 AM


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.8/1154 - Release Date:
11/27/2007
11:40 AM


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

This thread ...

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.