## Numeric To Decimal Using %replace possibly

1810 pts.
Tags:
AS/400
AS/400 commands
This should be an easy question. My brain is fried and can not figure this out. I'm close but I'm sure one of you has a good solution. Hours# is 5 position 2 decimal. Data coming in is 7 position numeric (NO decimal). The last 2 positions are the decimal positions. I need to get the data coming in to a numeric 2 decimal filed. Free format..only. I can do it in fixed with a move. I have been trying with a %replace but I think I'm limited b/c of the deciaml positions. DHours# S 5 2 Thanks

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

Hi,

Wouldn’t dividing by 100 give you the result you want?

Regards,

Martin Gilbert.

______________________________________________________________________________________
Sorry — you’ve probably solved this 15 different ways
I’m just a couple of weeks late and I know you didn’t want to do math
But this equation will round the Input70 to a 5-2 rounded on the quarter hours

QuarterHrs52 = INT(((Input70 / 100) *4 )+ 0.5) / 4

Phil
_______________________________________________________________________________________

## Discuss This Question: 6 Replies

Thanks. We'll let you know when a new response is added.
• That will work and I'm doing that for now. But I wanted to use %replace just for fun. I do that lots...lol
report
• In the 'old days' with RPGII is was recommended not to do a division in a case like this; - us multiply instead ... (reasons: less proces to do the task !!! and smaller objectcode !!! ). In todays freeform:
```
result = indata * .01;
```
result: 5.2 indata: 7.0