Reading RAW Data from DB2

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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Why do you think that's "non-readable"? I can read it perfectly well in your post.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sreewin7
Participant
Posts: 41
Joined: Tue Sep 14, 2010 8:48 pm

Post by sreewin7 »

I agree with ray and i was able to read data from db2 to seq file with the same process.

Can you please re check from your end and let us know.

Best of luck.
rohit_mca2003
Participant
Posts: 41
Joined: Wed Oct 08, 2008 9:19 am

Reading RAW Data from DB2

Post by rohit_mca2003 »

Thanks for replies.

When I am saying that non-readable then I mean to say that data in sequential file should be in ASCII character set and meaningful. Finally this data has to go to Data Warehouse and we can not store data in this format.
Actually DB2 source tables have few field defined as RAW, other fields are either DECIMAL or STRING type. So need help to read RAW data with other fields as well.
Please let me know if I need to set any thing in sequential file stage or need to use any other datatype (other than VarBinary) or any type conversion.

Thanks.
Rohit
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Might be worth applying a RAWTOHEX function (or the DB2 equivalent).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rohit_mca2003
Participant
Posts: 41
Joined: Wed Oct 08, 2008 9:19 am

Reading RAW Data from DB2

Post by rohit_mca2003 »

Thanks Ray.

Upon checking there is function available in DB2 RAWTOHEX but when I used this function in SQL then I am getting error with job abort.

Process meta data not available in database
Parallel job reports failure (code 139)

When I checked DB2 table definition for RAW column, it is like below:

NAME FOR COLUMN CUSNM CHAR (18) FOR BIT DATA DEFAULT ' ' NOT NULL

Can you please help me how can I define this column in ODBC stage (using ODBC stage to read DB2 data) and in Sequential file stage.

Thanks.
Rohit
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

How did you define the receiving column (in DataStage metadata) when you used the RAWTOHEX function?

Given that the original is CHAR(18), I'd suggest CHAR(36) or VARCHAR(36) would be appropriate - you'll be getting two hex characters per byte.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rohit_mca2003
Participant
Posts: 41
Joined: Wed Oct 08, 2008 9:19 am

Reading RAW Data from DB2

Post by rohit_mca2003 »

Hi Everyone,

Thanks for your valuable comments. This issue is resolved now, though we have to take different way to resolve.

We were not able to use any function either ROWTOHEX or CAST. May be this is because of we are using (forcibly) ODBC EE stage. Job was aborting.

To resolve this, I have stored binary data in one sequential file and then reding it again as TEXT and export this data as EBCDIC to ASCII. As of now this approach has worked so I will take this as workaround.

Thanks Again.
Rohit
Post Reply