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.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.