Comments on: How to capture decimal value of numeric fld
http://itknowledgeexchange.techtarget.com/itanswers/how-to-capture-decimal-value-of-numeric-fld/
Thu, 30 Oct 2014 16:08:07 +0000hourly1By: philpl1jb
http://itknowledgeexchange.techtarget.com/itanswers/how-to-capture-decimal-value-of-numeric-fld/#comment-112462
Thu, 18 Oct 2012 23:21:21 +0000http://itknowledgeexchange.techtarget.com/itanswers/how-to-capture-decimal-value-of-numeric-fld/#comment-112462Oh sorry … RPG III .. why would you do that? Is this another interview question? . But if you must, check out the DIV and MVR commands. If you divide by 1 the Remainder (MVR) would be the decimal.
]]>By: philpl1jb
http://itknowledgeexchange.techtarget.com/itanswers/how-to-capture-decimal-value-of-numeric-fld/#comment-112460
Thu, 18 Oct 2012 23:13:27 +0000http://itknowledgeexchange.techtarget.com/itanswers/how-to-capture-decimal-value-of-numeric-fld/#comment-112460Or perhaps an EVAL statement like:DecVal = Val – %int(Val)
]]>By: TomLiotta
http://itknowledgeexchange.techtarget.com/itanswers/how-to-capture-decimal-value-of-numeric-fld/#comment-112459
Thu, 18 Oct 2012 23:06:22 +0000http://itknowledgeexchange.techtarget.com/itanswers/how-to-capture-decimal-value-of-numeric-fld/#comment-112459Well, sorry about the formatting. This editor makes very little sense.

The @CVT field is defined over positions 1-5 with 3 decimal fraction positions. It’s zoned decimal. Both @FRAC and FRAC also have 3 decimal positions and are zoned decimal. @FRAC is defined starting position 3 of the DS because that’s where the fractional portion of @CVT begins. @CVT is where your numeric value will be placed for conversion to just the fractional portion.

Tom
]]>By: TomLiotta
http://itknowledgeexchange.techtarget.com/itanswers/how-to-capture-decimal-value-of-numeric-fld/#comment-112458
Thu, 18 Oct 2012 23:00:33 +0000http://itknowledgeexchange.techtarget.com/itanswers/how-to-capture-decimal-value-of-numeric-fld/#comment-112458It depends on exact circumstances, but using data structure subfields will get your exact requirement handled.
I DS
I 1 53@CVT
I 3 53@FRAC
I DS
I 1 33FRAC
C Z-ADD5.78 @CVT
C Z-ADD@FRAC FRAC
C*** DO CALCS WITH FRAC…
C SETON LR
Define the subfields to hold the largest numbers of digits, including fractional digits, that your program needs to handle. Make sure that the two intermediate subfields (@CVT and @FRAC) are defined as zoned decimal.

(We’ll see how the “code” looks after it gets posted.)