At 10:22 -0600 on 07/14/2012, Steve Comstock wrote about Re: COBOL packed decimal:

I think he's saying keep amounts in pennies as binary fields.
Convert to dollars + decimal point + cents when you display
these fields.

That works for addition and subtraction. It gets more complex when you need to do multiplication (such as computing interest). That involves shifting and rounding after the multiplication. IOW: To do 6%, multiply by 6 and then shift 2 positions to get back to pennies (after adding 50 to round up/down).

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to