Hex to integer in transfrmer stage
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 82
- Joined: Thu Dec 02, 2004 10:27 pm
- Location: INDIA
Hex to integer in transfrmer stage
Hello
I have a varchar which has three hexnumbers as input to transformer. I extract each hex number and use them as 3 output fields.
Input : 0000FE00230064
0000FE 0023 0064
fld 1 fld 2 fld 3
Result I need
254 35 100
How can I convert the individual fields to integer values in the transformer??
Thanks for your time and input
I have a varchar which has three hexnumbers as input to transformer. I extract each hex number and use them as 3 output fields.
Input : 0000FE00230064
0000FE 0023 0064
fld 1 fld 2 fld 3
Result I need
254 35 100
How can I convert the individual fields to integer values in the transformer??
Thanks for your time and input
dsxuserrio
Kannan.N
Bangalore,INDIA
Kannan.N
Bangalore,INDIA
-
- Participant
- Posts: 2
- Joined: Wed Jun 09, 2004 7:09 am
-
- Participant
- Posts: 36
- Joined: Wed Feb 16, 2005 5:20 pm
- Location: IL
Re: Hex to integer in transfrmer stage
this is Radix conversion
MX - converting hexadecimal to decimal
First # : ICONV(input[1,6],'MX')
Second #: ICONV(input[7,4],'MX')
Third #: ICONV(input[11,4],'MX')
use concatenation for all these
ICONV(input[1,6],'MX'):' ':ICONV(input[7,4],'MX'):' ':ICONV(input[11,4],'MX')
MX - converting hexadecimal to decimal
First # : ICONV(input[1,6],'MX')
Second #: ICONV(input[7,4],'MX')
Third #: ICONV(input[11,4],'MX')
use concatenation for all these
ICONV(input[1,6],'MX'):' ':ICONV(input[7,4],'MX'):' ':ICONV(input[11,4],'MX')
-
- Participant
- Posts: 82
- Joined: Thu Dec 02, 2004 10:27 pm
- Location: INDIA
dsxuserrio,
unfortunately the ICONV and OCONV functions only exist in the Server Transform stage , which is why you are getting this error.
You have a couple of choices in solving this. Easiest in terms of getting up and running is to use a BASIC transform stage in Px. The downside is that you are losing a lot of performance (which is why you are using Px in the first place, right?). But with that stage the ICONV and OCONV functions will work. Your second option is to code a small C program that does this cast() for you; then you can bind it into Px and call it from a transform stage. This is relatively easy and quick to do and will also perform faster in Px than the first solution.
unfortunately the ICONV and OCONV functions only exist in the Server Transform stage , which is why you are getting this error.
You have a couple of choices in solving this. Easiest in terms of getting up and running is to use a BASIC transform stage in Px. The downside is that you are losing a lot of performance (which is why you are using Px in the first place, right?). But with that stage the ICONV and OCONV functions will work. Your second option is to code a small C program that does this cast() for you; then you can bind it into Px and call it from a transform stage. This is relatively easy and quick to do and will also perform faster in Px than the first solution.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
That was a VERY fun challenge. I love questions like this -- as it help me expand my knowledge of EE.
Here is the answer:
"0x" : [input field].
Yup, you have to append 0x before your number in order for DataStage to recognize it as a Hex number. It will automatically be converted if the output field is defined as an Integer.
Here is the answer:
"0x" : [input field].
Yup, you have to append 0x before your number in order for DataStage to recognize it as a Hex number. It will automatically be converted if the output field is defined as an Integer.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 82
- Joined: Thu Dec 02, 2004 10:27 pm
- Location: INDIA
Unfortunately, I am not able to test my solution on 7.5. I did test it on 7.1r2, and it worked.
I did not do anything special (AsInteger() or anything like that) -- just plain straight varchar to integer conversion, doing the conversion with the values you provided. It produced the expected results.
Anyone else here with EE 7.5?
I did not do anything special (AsInteger() or anything like that) -- just plain straight varchar to integer conversion, doing the conversion with the values you provided. It produced the expected results.
Anyone else here with EE 7.5?