Dear All,
I have one field(Interest_Rate) in my ardent which is a decimal value.But when i am writing into a file i require that number as S9(10)V9(8) format (COBOL format ie Sign in Front)...
For example if THE Interest_Rate is say '4.5678' then it should be formatted as '000000000456780000' .
Please help me how to use the OCONV() or FMT() funtion for the same.
I Tried using
IF (Interest_Rate < 0) Then
"-" : OCONV(ABS(Interest_Rate) * 100000000, "MR0(%18)")
Else
" " : OCONV(ABS(Interest_Rate) * 100000000, "MR0(%18)")
But the above mentioned thing is not working for me...
Thanks & Regards,
K.S.Rajan.
Number Formatting Issue using OCONV()
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
Try this:
fmt(input.amount*100000000, "R0%18")
The multiplier removes all the decimal points and the right justify with % padding puts the number into the right hand side of 18 zeros.
fmt(input.amount*100000000, "R0%18")
The multiplier removes all the decimal points and the right justify with % padding puts the number into the right hand side of 18 zeros.
Certus Solutions
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You still need an If construct to handle the leading sign, since this needs to be prepended AFTER the formatting. For example:
Code: Select all
If input.amount < 0 Then "-" : Fmt(Abs(input.amount)*100000000,"R0%18") Else Fmt(input.amount*100000000,"R0%18")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.