Hi,
The SQL scalar functions MIN() and MAX() can also be used within RPG to find
the highest or lowest value from a list of values:
Example:
Exec SQL Set :MyMinVal = Min(1, -17, 35, 4, -2, 0);
Exec SQL Set :MyMinDate = Min(Date('2009-01-03'), Date('2009-02-18'),
:Date('2008-12-31'));
Exec SQL Set :MyMaxChar = Max('ABC', 'A', ' XY', 'A34579');
Exec SQL Set :MyMaxVal = Max(:HstVar1, :HstVar2, :HostVar3, :HostVar4);
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von Carel Teijgeler
Gesendet: Wednesday, 22. April 2009 17:01
An: rpg400-l@xxxxxxxxxxxx
Betreff: Re: Function to find the greatest or smallest value
If you have not searched the manuals (i.e. the Index of the RPG Reference),
you should have first, but no, you have to write your own.
If the values come from a PF (table), use SQL and the MIN/MAX-functions.
With regards,
Carel Teijgeler
*********** REPLY SEPARATOR ***********
On 22-4-2009 at 16:21 David FOXWELL wrote:
Given 2 or more values, is there a BIF or something in RPG that will
return the highest of those values?
As an Amazon Associate we earn from qualifying purchases.