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
Zeros Left
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 133
- Joined: Wed Mar 05, 2003 4:19 pm
- Location: Lima - Peru. Sudamerica
- Contact:
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
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
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
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.