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



This is craziness. There is no way I am going to jump into the SQL precompiler, or CLI, or any other language, particularly CL, just to get a %min or %max function in RPG. It is far easier to just code:

fld = value1;
if fld < value2;
fld = value2;
endif;

But still you are going to have to think a little bit to decide (as you come across it in the source) if it is a %min or a %max function. Which is it? I'm sure you can determine the answer. But it would be far easier if I simply could write:

fld = %max(value1: value2);

Which one took you longer to figure out?

And yes I could write a sub-procedure that would cover 90%, maybe even 99% of the cases that I would come across, but that one time in a hundred that it didn't work because I can't use operation descriptors to decide what the scale and precision of the number, or if it is an integer, or a float, just irks me. It is a simple thing what is the problem with asking for it.

P.S. Every language except embedded SQL would have the same problem that RPG has. Namely the call is strongly typed, down to the precision and scale of the parameters and return value. So I can't cover every possible option in a single sub-procedure regardless of the language.

Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx


-----CRPence <crpbottle@xxxxxxxxx> wrote: -----
To: rpg400-l@xxxxxxxxxxxx
From: CRPence <crpbottle@xxxxxxxxx>
Date: 08/19/2016 01:26PM
Subject: Re: Where to post ideas for RPG


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&#8217;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 ...

Follow-Ups:
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.