Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ucselx!bionet!agate!usenet.ins.cwru.edu!ysub!psuvm!cjs From: CJS@psuvm.psu.edu Newsgroups: comp.lang.rexx Subject: Re: Dollarizing Message-ID: <91120.082553CJS@psuvm.psu.edu> Date: 30 Apr 91 12:25:53 GMT References: Organization: Penn State University Lines: 32 Too bad ARexx doesn't have a FORMAT function. I would have thought it was in all implementations. However, to simplify your "dollarize" routine: dollarize: procedure arg l '.' r . /* left of decimal; right of decimal */ return l'.'left(r, 2, '0') To add rounding, perhaps this will do: dollarize: procedure arg l '.' r . /* left of decimal; right of decimal */ parse var r r +2 next +1 . if next <> '' then /* more than 2 places? */ if next > 4 then do /* should we round up? */ r = r + 1 if r = 100 then do /* did it overflow? */ l = l + 1 r = 0 end end return l'.'left(r, 2, '0') That rounding method is not quite perfect, and doesn't do negative values correctly, but it is simple.