× 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 19-Aug-2016 03:24 -0700, Vernon Hamberg wrote:
On 8/19/2016 3:31 AM, Brian Parkins wrote:
On 18-Aug-2016 15:00 -0700, Vernon Hamberg wrote:
Every system also has SQL CLI - granted, not so simple as
embedded SQL, but it works well.

Every system also has the RUNSQL CL command - maybe another
approach?


Well, to avoid accusations of hyperbole, at least since some TR on IBM i 7.1

I am not sure that RUNSQL would work - not Query Management queries
- because neither returns a value directly to a program. That is, IF
a return value is needed.

Actually, for those few who remain willing and able to consume beyond 140-bytes at a time, my post in response to "And if you don’t have SQL?" showed _an actual example_ using RUNSQL as the SQL interpreter; as just _one_ way to obtain the effect of MAX of values from the SQL, without having the 57xxST1 SQL product installed to enable embedded SQL. The /return value/ was via a database file, of which the RPG [and typical coder] is able to obtain\consume quite easily:
[http://archive.midrange.com/rpg400-l/201608/msg00206.html] <-- best viewed using the fixed-font {A} button.

FWiW, since likely nobody would ever waste their time trying out the code snippet to actually _see_ the implementation functioning, I will reveal that sadly, the DB2 for i 7.1 seems unfit\incapable to handle what I coded, so the SQL shown, probably would have to change [e.g. to use the MAX scalar instead of row-values and MAX aggregate] to see the code function as alluded.


But I just thought about SQL stored procedures - I haven't looked at
prerequisites for that.

The CALL to a stored procedure has to be done with the SQL CALL, so EXEC SQL would need to be coded; thus the SQL pre-processor would need to convert that EXEC SQL into RPG.

Even so, the same issue exists with implementing a stored procedure that can generically effect a MAX( arg1, arg2, ... argN ); mainly, how to pass those arguments in a way that does not become overly difficult to code and maintain, such that just writing one's own specific routine in the original host language could be the most appropriate choice [whilst waiting indefinitely for the capability to appear in the host language itself, possibly arriving solely due to the RFE, and if so, then likely only appearing even farther into the future than if something already in the pipeline].


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.