|
date: Tue, 3 Nov 2015 16:51:24 -0600
from: "Englander, Douglas" <Douglas_Englander@xxxxxxxxxxxxx>
subject: Re: SQL Functions in RPG
Mike,
I have an RPG program that reads each record in a subset of a file
(positioning via SETLL) and as it reads it determines whether or not it
should process the record further. The program runs for a long time, of
course, and I was hoping to speed it up a bit using SQL.
One of the criteria it checks is up to 5 values of a field that a user
could key in. Those values could be a "wildcard" type value. The logic in
the RPG to process this is quite original. In my view, it is way too
complicated for a plain SELECT statement, so that is why I wanted to use a
function that returns a "0" or "1" to tell SQL whether to include the row
or not. I have done this before with a similar function in service program
and it works very well. But since this logic is unique to this program
only, I did not want to encapsulate it into a service program, so that is
why I was wondering if there was a way to create a SQL function that
references a subprocedure in a program.
Based on what I have read, I am thinking of putting a "CREATE FUNCTION" in
the RPG program in *INZSR, referencing that function in the SELECT
statement, and then dropping it when I am done with the program (at LR
time).
Thank you for all the replies!!
Doug
As an Amazon Associate we earn from qualifying purchases.
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.