Hi ,
Can any one tell me how to convert Character to Decimal Value . For example if i have A , it should convert to 65 . and if i have Aa it should convert to 6597.
Any help is really appreciated
Thanks in advance
Character to Number
Moderators: chulett, rschirm, roy
Hi ,leomauer wrote:Use Seq function for each character in string:
Seq(<strig>[1,1]):Seq(<strig>[2,1]):Seq(<strig>[3,1]) and so on.
Thanks for your quick reply , but the logic above is for each character and i want for multiple characters. I mean , i dont know the input , the input might be abc for 1 row and sdfge for 2nd , so if that is the case how do i consider . So if i consider the above logic that u said ,after all the characters are converted to decimal do i need to trim all zeroes since "" is converted to zero r8?
thanks in advance
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You've been using DataStage for quite a while now (based on your DSXchange profile) and really should be acquiring these skills.
If you have Unicode data, then use Uniseq() rather than Seq() function.
Code: Select all
FUNCTION RSunny(aTheString)
vLenString = Len(aTheString)
Ans = ""
For vChPos = 1 To vLenString
Ans := Seq(aTheString[vChPos,1])
Next vChPos
RETURN(Ans)
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.