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

Software/Hardware used:

As400

Asked:
Last updated:

## Discuss This Question: 12 Replies

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. Tombusiness problemthat you are really trying to solve. Now there are new values that slightly change what the problem is. So far, we still don't know what your real problem is. And so far, the likely best way to handle your problem hasn't been shown. Doing division with exponentiation is almost certainly not the right way. Consider this example code (also available at Value extraction (ILE RPG) for a month): D ds1 ds D Tot 15 2 inz( 0 ) D ds2 ds D v1 15 0 inz( 80906140000 ) D t1 11 2 overlay( v1 ) D ds3 ds D v2 15 0 inz( 42777557000 ) D t2 11 2 overlay( v2 ) D dec s 1s 0 inz( 6 ) /free Tot = t1 ; Tot = t2 ; *inlr = *on ; return ; /end-free You can run it in debug and check the value of Tot after both calculations. Note that the 'dec' variable isn't needed at all for this. If dec changes for different values in this program, the problem again becomes different and a different 'best' solution can be determined. The entrie calculation is simply [ Tot = t1 ]. No division needed, no exponentiation and no integer/decimal/truncation/rounding problem. Many times faster, too. Whenever a new series of digits is placed in v1 or v2, the result should be what you need. But it's appropriate only for whatseems to beyour problem. We don't yet know what you're trying to do. Tom