Convert EBCDIC Hexcode to EBCDIC Character
Moderators: chulett, rschirm, roy
Convert EBCDIC Hexcode to EBCDIC Character
Is there any way to convert EBCDIC hexadecimal Code to EBCDIC related character in Datastage?
For example : C9 ---> I
For example : C9 ---> I
Thanks Craig for looking into this.
Requirement : I have a column from DB2 which has converted from Timestamp to Hexadecimal (16). The column has again suppressed into char( 8 ) for the target database (ADABAS) which has EBCDIC charset. Whenever i perform insert in datastage, this column has resulted with the truncation of 8 characters only. I need this 16 character HX to be converted into Binary Coded one. Pls suggest if you have any idea on this.
I'm not doing anything with CFF Stage.
Requirement : I have a column from DB2 which has converted from Timestamp to Hexadecimal (16). The column has again suppressed into char( 8 ) for the target database (ADABAS) which has EBCDIC charset. Whenever i perform insert in datastage, this column has resulted with the truncation of 8 characters only. I need this 16 character HX to be converted into Binary Coded one. Pls suggest if you have any idea on this.
I'm not doing anything with CFF Stage.
Thanks for the clarification. I'm not in a position to be able to help with that, have you checked to see if there are any PX functions that might serve here? Or failing that, a Server function you could leverage in a Server Shared Container, perhaps?
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
As Craig has mentioned, going the BASIC transform stage or server container might be your best choice here. The OCONV() function has a number of conversions that do exactly what you are looking for.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Thanks Arnd & Craig. I am trying it make simple as per your suggestions.
I have used Basic transformer to translate the Hex to equivalent EBCDIC character. Below are the steps :
ICONV(VAR, 'MX') -- Returns the Decimal value of the Hex code
Char() -- Returns the equivalent Ascii character value
Ascii() -- Returns the EBCDIC character value.
but I am getting weird results in some of the cases, where C9 returns as Ci (hope so meaning capital I) Instead of 'I' and in some other cases, the special characters were translated as '?'.
Even though the proper NLS setting has been made.
I have used Basic transformer to translate the Hex to equivalent EBCDIC character. Below are the steps :
ICONV(VAR, 'MX') -- Returns the Decimal value of the Hex code
Char() -- Returns the equivalent Ascii character value
Ascii() -- Returns the EBCDIC character value.
but I am getting weird results in some of the cases, where C9 returns as Ci (hope so meaning capital I) Instead of 'I' and in some other cases, the special characters were translated as '?'.
Even though the proper NLS setting has been made.
Since the functions you are using are all single-byte/single-character based ones, the NLS settings shouldn't play a role.
ASCII(ICONV("C9","MX")) should be "I"
ASCII(ICONV("C9","MX")) should be "I"
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
I'm away from a datastage machine, but you could use the MCX code to convert your hexadecimal representation to decimal:
ASCII(ICONV(OCONV("C9","MCX"))
ASCII(ICONV(OCONV("C9","MCX"))
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>