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



David,

Untested code (but I can't see why it wouldn't work:

P @max B Export
D PI 30P 9
D p1 30P 9 Const
D p2 30P 9 Const
D p3 30P 9 Const Options(*Nopass)
D p4 30P 9 Const Options(*Nopass)
D p5 30P 9 Const Options(*Nopass)
*---------------------------------------------------------------------
D out S 30P 9
*---------------------------------------------------------------------
/free

out = p1;
if p2 > out;
out = p2;
endif;
if %parms > 2;
if p3 > out;
out = p3;
endif;
if %parms > 3;
if p4 > out;
out = p4;
endif;
if %parms > 4;
if p5 > out;
out = p5;
endif;
endif;
endif;
endif;

return out;

begsr *pssr;
return 0;
endsr;

/end-free

This allows up to 5 parameters, so you can use it like this:

myvar = @max( var1 : var2 : var3 );

Almost the exact same code (with > replaced with <) can be used for a @min
function, obviously.

Put it into a module and then bind it into a service program - I have one
with generic functions like this, which is in a 'global' binding directory
so it can be bound to every program that needs it easily.

Rory

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.