Converting EBCDIC Binary data type to ASCII

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
patonp
Premium Member
Premium Member
Posts: 110
Joined: Thu Mar 11, 2004 7:59 am
Location: Toronto, ON

Converting EBCDIC Binary data type to ASCII

Post by patonp »

Hi Folks,

I've searched the forum about this, and although there are lots of mentions of binary data conversions, none appears to capture my specific case.

I am reading a stream of EBCDIC data as VarBinary. I know that at a pre-defined position and length (i.e. REC_IN[11,4]), there is data that would be defined as a binary datatype if I were to split the file using a CFF. I would like to convert this data to ASCII numeric or varchar.

What function(s) can I use to perform this?

Thanks!

Peter
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Post by meena »

Hi,
It looks like decimal datatype at CFF ( for : REC_IN[11,4]), ). If it is decimal you can use "DecimalToString" (for Varchar data type).
I am reading a stream of EBCDIC data as VarBinary. I know that at a pre-defined position and length (i.e. REC_IN[11,4]), there is data that would be defined as a binary datatype if I were to split the file using a CFF. I would like to convert this data to ASCII numeric or varchar.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You can use the SDK functions that convert binary COBOL datatypes to do this. Do you know what sort of binary data you have?
patonp
Premium Member
Premium Member
Posts: 110
Joined: Thu Mar 11, 2004 7:59 am
Location: Toronto, ON

Post by patonp »

ArndW wrote:You can use the SDK functions that convert binary COBOL datatypes to do this. Do you know what sort of binary data you have?
We seem to be thinking along similar lines. As a matter of fact, I've used the DataTypePicComp function to successfully read packed data, and I was hoping that there would be a similar function for binary data.

I'm not certain specifically which type of binary data I have, although when I read the file using a CFF stage, it comes through correctly. Does that tell us anything about the nature of the binary data?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

In that case it is probably unsigned COMP-3, but I'm just guessing. If you could post the HEX values plus the correct numeric representation I could tell you, though.
ratikmishra1
Charter Member
Charter Member
Posts: 42
Joined: Wed Aug 18, 2004 2:49 pm

Post by ratikmishra1 »

Typically comp is binary for integer. Try using "DataTypePicComp". In version 6.0 it used to work only for int types (max 4 bytes). May be the limitation is still there. If your input is 8 bytes long you might consider using "DataTypePicComp2".
patonp
Premium Member
Premium Member
Posts: 110
Joined: Thu Mar 11, 2004 7:59 am
Location: Toronto, ON

Post by patonp »

Thanks folks! You were absolutely correct - DataTypePicComp did exactly what I needed.
Post Reply