× 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 18 Mar 2013 14:30, Jeff Young wrote:
I have a character representation of a numeric field whose value is
'0009671180'. This represents 96.71180

When I attempt to convert it back to a decimal value, I get the
following message:
Message ID . . . . . . : RNX0103 <<SNIP>> An arithmetic operation
resulted in a value which is too large to fit in the target. <<SNIP>>

The code I am using is:
<snip>
D Work_Rate S 63 15
...
/Free
...
Monitor;
Work_Rate = (%Dec(Oh@AirRate : 10 : 5) / 100000);

The above request should be instead:

Work_Rate = ( %Dec(Oh@AirRate: 10 : 0 ) / 100000 ) ;

Or could request more explicitly for a 10P05-compatible result:

Work_Rate = %Dec( %Dec(Oh@AirRate: 10 : 0 )
/ 100000 ) : 10 : 5 ) ;

$Air_Rate = Work_Rate;
On-Error;
$Air_Rate = *Zero;
EndMon;
</snip>

Since I made my work field more than large enough to hold the
result, why am I receiving this error?

The decimal value 9671180 can not fit into a 10P05 temporary result, which is what the %Dec('0009671180':10:5 ) is asking to happen, and what the RNX0103 is diagnosing; i.e. the significant digits, decimal value 96, would need to be truncated, and that is overflow.

The request should instead be %Dec('0009671180':10:0) to ensure a full 10-digit decimal integer number can /fit/ in the temporary result, and then divide that value by 100000 which makes a value compatible with storing in a 10P05 [or 63P15] variable. Thus an unedited string of 10 digits should always fit into anything 10P05 or larger.

Note that if the character representation is not always all-digits, then a different approach may be more desirable; well, depending on how the data gets into the alpha field may also make a different approach more desirable.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.