MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » February 1998

Re: CVTILERPG


  • Subject: Re: CVTILERPG
  • From: Hans Boldt <boldt@xxxxxxxxxx>
  • Date: Tue, 24 Feb 1998 18:16:15 -0500

fixed

I'm a little unclear of what's happening.  In your original note, you say
you keep getting the run-time message that the result is too small to hold
the result.  But, here you say that you are concerned about getting too
many decimal places.  These are two separate things.  The run-time
message signals numeric overflow, where high-order digits are lost.
No run-time message is issued when decimal places are lost.  I wouldn't
worry much about too many decimal places resulting from the division.

I would worry more about getting the RNX0103 exception!

But if you really don't want those extra digits here's a little trick you can
use (provided you have at least V3R7).  If you want the division to give
you a value with a precision of say decimal(12,2), code the divide as:

        C                            EVAL          num = %dec(a/b: 12: 2)

This technique is mainly useful if you have a division nested deep inside
some complex expression.  For a simple case like this, I'd just leave it
as "a/b" and not worry about the extra decimal places.

(BTW, could you sign your notes?  There is a bug in our mail s/w
somewhere that chops off the email address of the poster.  All I see is
that your note came from midrange-l!)

Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com


---------------------- Forwarded by Hans Boldt/Toronto/IBM on 98-02-24 15:18
---------------------------


owner-midrange-l@midrange.com on 98-02-24 14:02:33
Please respond to MIDRANGE-L@midrange.com @ internet
To: MIDRANGE-L@midrange.com @ internet
cc:
Subject: Re: CVTILERPG



YOU WROTE:

>Why didn't you use CVTRPGSRC to convert your programs?

I used another utility that converts more of the source just to allow me to
see RPGIV, and get use to using it.  I have found out I can suppress my
choice not to convert certain functions to evals by prompting the command.


>overflow so much.  (99% of the time?!?)


I am not truncating the higher end, but with division you can divide 2
numbers and end up with "10" decimals places and I do not care to have it
that precise, I only need it out to 2 decimal places for example.  That is
why I want to truncate.





+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@midrange.com".
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---



+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@midrange.com".
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---






Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot 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 here. If you have questions about this, please contact