Convert EBCDIC Hexcode to EBCDIC Character

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
major
Premium Member
Premium Member
Posts: 167
Joined: Mon Nov 26, 2007 12:21 am

Convert EBCDIC Hexcode to EBCDIC Character

Post by major »

Is there any way to convert EBCDIC hexadecimal Code to EBCDIC related character in Datastage?

For example : C9 ---> I
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Can you be more specific as to what you are doing? Typically this would be coming from a flat file and the CFF stage would be used and would translate that for you.
-craig

"You can never have too many knives" -- Logan Nine Fingers
major
Premium Member
Premium Member
Posts: 167
Joined: Mon Nov 26, 2007 12:21 am

Post by major »

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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

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
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Exactly what I was thinking of... didn't run off and look up any specifics, however.
-craig

"You can never have too many knives" -- Logan Nine Fingers
major
Premium Member
Premium Member
Posts: 167
Joined: Mon Nov 26, 2007 12:21 am

Post by major »

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.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

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"
major
Premium Member
Premium Member
Posts: 167
Joined: Mon Nov 26, 2007 12:21 am

Post by major »

Thanks Arnd!.

When i tried with "ASCII(ICONV("C9","MX"))" I'm getting some garbage values instead of 'I'.

I tried with ASCII(Char(ICONV(Arg1,"MX")) -- It returns the value as Ci instead of I.

Is there any options to convert this from EBZeeDIC Hex to EBZeeDic Character?

Thanks
Major
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

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"))
major
Premium Member
Premium Member
Posts: 167
Joined: Mon Nov 26, 2007 12:21 am

Post by major »

Arnd : The OConv and IConv resulted the same number. But when i extract the equivalent character for the decimal to ASCII.. I can able to extract it. But from Ascii to EBCIDIC could not retrieve the exact character.
Post Reply