convert Binary data to ascii format

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
go4it
Participant
Posts: 34
Joined: Wed Apr 23, 2008 5:49 am
Location: UK

convert Binary data to ascii format

Post by go4it »

Hi,

Could you please advice how to handle Binary and packed decimal data in Data Stage ?

I am trying to convert the Binary data into a readable format.

If this has been answered earlier please point me to correct direction.

With regards
M
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

There are various forms of "binary" and unless you know what type it is you won't be able to convert it. Is your source EBCDIC that you need to convert? Or is it packed decimal data?
go4it
Participant
Posts: 34
Joined: Wed Apr 23, 2008 5:49 am
Location: UK

Post by go4it »

They are all in EBCIDC and Binary format
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

There are numerous ways to do this. If you also have packed decimal data then the cmoplex flat file stage is best, otherwise just use a sequential file stage and specify that the data is EBCDIC in the format tab.
go4it
Participant
Posts: 34
Joined: Wed Apr 23, 2008 5:49 am
Location: UK

Post by go4it »

Hi Arndw,

Thank you, I have been able to use Seqential file stage to read the file that is EBCDIC (binary and packed decimals) in the Ascii format, but there are some transformation rules to split the binary data into two fields


e.g
Binary Data when viewed through Data Stage
{20 08 01 02 00 $ 00}

I have get the 8 bytes and put the ascii value into another column.

Is there a way to convert the EBCDIC data into Char value

Please advice.

With Regards
M
nagarjuna
Premium Member
Premium Member
Posts: 533
Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago

Post by nagarjuna »

Best way is to import COBOL copybooks into datastage and try to read the data ..
Nag
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

While BASIC transform stages have ASCII and EBCDIC functions the better way to solve this splitting would be to edit your metadata or COBOL definitions to split the data before reading it, this would be a COBOL "REDEFINES".
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

What are the transformation rules?

Is the same field being 'reused' to derive 2 output fields or will the one input field be split into two halves ?
go4it
Participant
Posts: 34
Joined: Wed Apr 23, 2008 5:49 am
Location: UK

Post by go4it »

Yes the same field is being reused, Can we using the transformation functions to convert the binary to ascii data using a BASIC Transformer ??
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yes you can, but using Complex Flat File stage is much easier.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
go4it
Participant
Posts: 34
Joined: Wed Apr 23, 2008 5:49 am
Location: UK

Post by go4it »

The main issue is we DONOT have any Cobol Copy Books, We have been given a spreadsheet with the fields with start positions and number of bytes, also there are lots of Arrays, redfinitions and Occour Depening on clauses that are not upto the Cobol Standards.

Also we have one single field that holds the Record Type and other info in Binary Format and the files are of Variable length format. And also the files donot have row or record delimiters and also donot have final delimiter.

E.g.

{20 08 01 02 00 $ 00}

The above binary field consists of Date (YYYYMMDD), Seqyuence Number and the Record Type. A single file can have as many different Record types.

I have taken an example file and used an external code to add row delimiters, then used Seq Stage to read teh file and then used BASIC Transformer to find the above details.

Could you'll please advice whether to go with CFF or Seq Stage. ?


With Regards
M
With Regards
M
Post Reply