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



Steve,

Why do you need temp? Why not:

Monitor
answer = CalculateRate(19.4:3245.5623);
On-Error RESULT_OVERFLOW;
ReportError(Result to Large)
EndMon;

Another option is passing length and precision as parameters:
answer = CalculateRate(19.4:3245.5623:%len(answer):%decpos(answer));
The function than has to calculate maximum (and minimum) values and check
whether the result is valid. You can make the parameters optional and
assume default values when they are not passed.

Joep Beckeringh


rpg400-l-bounces@xxxxxxxxxxxx wrote on 07-09-2009 04:33:02:

Am I right in assuming you are suggesting that in the calling
program declare a temp field of size of 31, 9. Use this with the
utility function and finally copy the data returned in the temp
field into the real variable ie. A var of size 14, 4 (or any other
size 10, 3 or 7, 4 etc)

For example:
Calling Program:
D answer S 14, 4
D temp S 31, 9

temp = CalculateRate(19.4:3245.5623);
Monitor
answer = temp;
On-Error RESULT_OVERFLOW;
ReportError(Result to Large)
EndMon;

I think that seems to work how I would like. Cheers.

I would be interested to hear what other methods people would
suggest? I'm starting to think if I wanted it to be completely
modular and completely independent of precision and scale (and avoid
temp fields) I would need to declare a standard decimal precision
across the board ie. All decimal variables are declared to be 31, 9
(much like Java/C# etc does in the background with it's standard
variable type anyway). Due to legacy apps this isn't really an
option so I think Chandana's suggestion is a good compromise.

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.