Page 1 of 1

Posted: Tue Sep 30, 2003 11:08 am
by kduke
L. Duarte

I would treat this as a string and substring it.

result = '000' : field1[1,2] : '.' : field1[3,3]

Kim.


Kim Duke
DsWebMon - Monitor DataStage over the web
www.Duke-Consulting.com

Posted: Tue Sep 30, 2003 11:46 am
by jseclen
Hi L.Duarte,

You can make a routine with this code, you must to define arguments

YourString = the string to format
"MD3Z" = The number of decimals (3 is the number, if you want another value, change it)
"9'0'R" = this is output format (9 is the long of the output string, 0 is the fill value, R is the side of the original string)

Ans = Fmt(Oconv(YourString, "MD3Z"), "9'0'R")

INPUT OUTPUT
01500 ->> 00001.500
00990 ->> 00000.990
01000 ->> 00001.000


Miguel Seclen
Lima - Peru

Posted: Tue Sep 30, 2003 5:17 pm
by ray.wurlod
An alternative for the FMT function is to use a background.
FMT(number, "R%9") lays down a background of nine zeroes then superimposes the value of number, right justified, over that background. I believe this is marginally more efficient (in terms of machine cycles) than using a fill character.

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518

This post was made purely in the interest of exploring alternatives. The solutions already posted are perfectly OK.