## Modify the result after a division with multiples of 10

2505 pts.
Tags:
AS/400
I have an expression like this Total = Quantity/10**decimal. If I have value 000080906140000 in quantity and decimal has 6, my result is 0000000080906.13. But I want it as 0000000080906.14. Is it possible?

Software/Hardware used:
As400

Thanks. We'll let you know when a new response is added.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

## Discuss This Question: 12 Replies

Thanks. We'll let you know when a new response is added.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
• Is it possible?   Probably. But we need to know what language you're using and what the data definitions are. The definitions need to be changed and a minor adjustment must made to the expression.   Tom
report
• It is RPG, and total is declared as (15,2)
report
• Okay, but what is its data type? Also, the definitions of decimal and Quantity are needed. -- Tom
report
• Total is a Zoned field D Total       S             15S 2  Decimal Zoned field (1,0) Quantity is Zoned field (15,0)
report
• The exponentiation and the division introduce tiny changes in the middle of the calculation. The direct way to fix this calculation:
eval(H) Total = Quantity/10**decimal
The best way, though, depends on what you're actually trying to do. It'd be best just to skip calculation entirely and to extract the value directly.   Tom
report
• oh.. now when the Quantity is 000042777557000 and decimal is 6. total is  comming as  0000000042777.56
report
• if what you are trying to do is just shift by decimal number of places, if you use the following code, it will cause the calculation to work without the subtle decimal position issues:total = quantity/%int(10**decimal);
report