Hi guys, I've been assigned with a task of rounding a decimal value to a scale (number of digits to the right of decimal point) and this scale actually stored in a file and they can vary based on the currency which are also stored in the same file. I tried to use %DECH or SQL function i.e ROUND to accomplice this but the scale parameter which accepted by these two functions has to be specified in number instead of an variable. So, I thought of using the java class BigDecimal which has a method called setScale and the scale parameter can be accepted as variable by this method. I've coded my RPG program to call this setScale method and to my suprise, the result seems to be correct sometimes and sometimes are not. For an example, when I pass a value of 588.985777 (this field has been defined as 23,9) and the scale has a value of 2 (which actually comes from a file) and ROUND_HALF_UP as a rounding method, the result shows a value of 588.990000000. This result to me is correct. But, if I pass the same value with a scale of 3, I get a result of 588.985999999. The weird thing this works sometimes and sometimes not. I even coded the garbage collecting routines as well. I don't know where the problem lies. I've pasted here the entire program for you guys to scrutinized and please let me know whether there are any other alternative to round a value by using a varying scale.