|
WholeNum = %int(OriginalNum);
Fraction = OriginalNum - WholeNum;
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Sam_L
Sent: Wednesday, July 10, 2013 5:50 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Split Number into whole and fractional parts
I have an 12,5 decimal field. I need to split it into the whole number and
the fractional part, two fields, one 7,0 and the other 5,5.
Put another way, if the original field is 1234567.98765 I want to end up
with two field, one 1234567 and the other 0.98765.
Is there an elegant way to do this in RGP /free at V7R1?
The original RPG IV fixed format code did it with two Z-ADDs. (Without
comments and meaningful field names, so very hard to understand.)
Thanks,
Sam
I could create a procedure, probably using multiplication and %REM.
I have an aversion to data structures for things like this, though if I put
it in a procedure it would be fairly clear.
As an Amazon Associate we earn from qualifying purchases.
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.