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

Option #1
- Rewrite the Stored Proc as a User Defined Table Function. While a
regular UDF can only return a single value, a UDTF can return one or more
rows containing 1 or more columns...

Option #2
- wrap the stored proc call in a UDF that only returns the value you are
interested in.

Option #3
- build a new SQL or RPG proc that makes the stored proc call and uses the
output in the subsequent SQL.


On Mon, Apr 18, 2022 at 2:27 PM K Crawford <kscx3ksc@xxxxxxxxx> wrote:

I have a stored procedure that I want to use in a SQL where clause.
Something like this. I know this doesn't work.

Select * from myLib.TableRRR R
where R.PlnYr = (CPLnyer of call myLib.SPGETCPLNY ('AS',5,0,0,0,0,' '))

I want R.PlnYr to equal the output parameter #4 of the procedure call.
The stored procedure is fairly straightforward.
INOUT client char(2)
,INOUT rnum numeric(7,0)
,INOUT LPlnYer numeric(4,0)
,INOUT CPlnYer numeric(4,0)
,INOUT NPlnYer numeric(4,0)
,INOUT SrchDate numeric(8,0)
,INOUT found char(1)
When I call this via ACS-RSS this is my results in the message tab:
call myLib.spgetcplny ('AS', 5, 0,0,0,0,' ')
Return Code = 0
Output Parameter #1 (CLIENT) = AS
Output Parameter #2 (RNUM) = 5
Output Parameter #3 (LPLNYER) = 2021
Output Parameter #4 (CPLNYER) = 2022
Output Parameter #5 (NPLNYER) = 2023
Output Parameter #6 (SRCHDATE) = 20220418
Output Parameter #7 (FOUND) = Y
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

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