Negative Values in Decimal
Moderators: chulett, rschirm, roy
Negative Values in Decimal
Hi,
We are having an input file where the negative decimal value is of the following format:
Eg: 123.00 -
We need to convert this to -123.00
Is there any simple function that we can achieve this?
Thanks
Sue :D
We are having an input file where the negative decimal value is of the following format:
Eg: 123.00 -
We need to convert this to -123.00
Is there any simple function that we can achieve this?
Thanks
Sue :D
-
- Participant
- Posts: 40
- Joined: Tue Nov 11, 2008 5:49 am
Re: Negative Values in Decimal
i am not sure if any separate function for achiving your result but try the below
use the substring function
column[(len(column)-1),1]:column[1,(len(column)-1)]
Thanks,
Ram.s
use the substring function
column[(len(column)-1),1]:column[1,(len(column)-1)]
Thanks,
Ram.s
Knowledge is Fair,execution is matter!
You can use a transform or routine , Arg1 will be the input decimal column.. Assuming Server Jobs : )
Code: Select all
Ans = If Oconv(Arg1,"MC/N") Matches "...-..."
Then Fmt(-1*Trim(Arg1,"-","A"),"R2") Else Arg1
-
- Participant
- Posts: 246
- Joined: Mon Jun 30, 2008 3:22 am
- Location: New York
- Contact:
-
- Participant
- Posts: 246
- Joined: Mon Jun 30, 2008 3:22 am
- Location: New York
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Premium Member
- Posts: 892
- Joined: Thu Oct 16, 2003 5:18 am
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Something likeshould do it.
Code: Select all
Iconv(InLink.TheDecimal, "MD2-")
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.
-
- Participant
- Posts: 246
- Joined: Mon Jun 30, 2008 3:22 am
- Location: New York
- Contact:
This is great. I never thought it would handle a trailing sign, though I use "MD" a lot. Thanks Ray.ray.wurlod wrote:Something likeshould do it. ...Code: Select all
Iconv(InLink.TheDecimal, "MD2-")
Arun