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



You could just describe the field in your d specs as a 12.5 signed field
and then redefine the integer and decimal portion as different fields.

On Wednesday, July 10, 2013, Sam_L wrote:

Ah ha! Looks promising...

Thanks.

On 7/10/2013 9:00 PM, Roger Harman wrote:
WholeNum = %int(OriginalNum);
Fraction = OriginalNum - WholeNum;



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx <javascript:;> [mailto:
rpg400-l-bounces@xxxxxxxxxxxx <javascript:;>]
On Behalf Of Sam_L
Sent: Wednesday, July 10, 2013 5:50 PM
To: rpg400-l@xxxxxxxxxxxx <javascript:;>
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 <javascript:;>
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx <javascript:;>
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.

This thread ...

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.