ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » how to convert BLOB into character which is readable

Post new topic  Reply to topic
 how to convert BLOB into character which is readable « View previous topic :: View next topic » 
Author Message
mqlover
PostPosted: Fri Dec 28, 2012 12:31 am    Post subject: how to convert BLOB into character which is readable Reply with quote

Disciple

Joined: 25 Jul 2010
Posts: 176

Hi,

I have written below statements to convert BLOB into CHAR

SET OutputRoot.MRM.RqID = CAST(SUBSTRING(InputRoot.BLOB.BLOB FROM 26 FOR 24) AS CHAR CCSID InputRoot.Properties.CodedCharSetId ENCODING InputRoot.Properties.Encoding) ;

The result is in this "4040 40E3 E2E3 F1F0 F1F".
How do I convert into a format which is readable becasuse when I insert this record into database, this would be the unique key to query from the database.

Thanks
Back to top
View user's profile Send private message
kash3338
PostPosted: Fri Dec 28, 2012 1:08 am    Post subject: Re: how to convert BLOB into character which is readable Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

mqlover wrote:

Code:

SET OutputRoot.MRM.RqID = CAST(SUBSTRING(InputRoot.BLOB.BLOB FROM 26 FOR 24) AS CHAR CCSID InputRoot.Properties.CodedCharSetId ENCODING InputRoot.Properties.Encoding) ;


The result is in this "4040 40E3 E2E3 F1F0 F1F".
How do I convert into a format which is readable becasuse when I insert this record into database, this would be the unique key to query from the database.


What's your actual input? Where are you storing it in DB? In this code you have assigned it to a OutputRoot.
Back to top
View user's profile Send private message Send e-mail
visasimbu
PostPosted: Fri Dec 28, 2012 1:10 am    Post subject: Re: how to convert BLOB into character which is readable Reply with quote

Disciple

Joined: 06 Nov 2009
Posts: 171

mqlover wrote:
Hi,
SET OutputRoot.MRM.RqID = CAST(SUBSTRING(InputRoot.BLOB.BLOB FROM 26 FOR 24) AS CHAR CCSID InputRoot.Properties.CodedCharSetId ENCODING InputRoot.Properties.Encoding) ;

Thanks


Why are you taking the substring from the BLOB ?
Back to top
View user's profile Send private message Send e-mail
mqlover
PostPosted: Fri Dec 28, 2012 1:42 am    Post subject: how to convert BLOB into character which is readable Reply with quote

Disciple

Joined: 25 Jul 2010
Posts: 176

Hi,

I am getting input msg as BLOB and I am populating a message set which has the parameter RqID. This message set is later used in subsequent flow for inserting records into DB.
When I checked in DB I found this field in Hex format which is not helpful. How do I convert into readable format.

Thanks
Back to top
View user's profile Send private message
visasimbu
PostPosted: Fri Dec 28, 2012 5:35 am    Post subject: Re: how to convert BLOB into character which is readable Reply with quote

Disciple

Joined: 06 Nov 2009
Posts: 171

mqlover wrote:


When I checked in DB I found this field in Hex format which is not helpful. How do I convert into readable format.

Thanks


What is the CCSID from Inputroot ?

Code:

SET char = CAST(SUBSTRING(InputRoot.BLOB.BLOB FROM 26 FOR 24) AS CHAR CCSID InputRoot.Properties.CodedCharSetId ENCODING InputRoot.Properties.Encoding) ;

Still I could not get the substring statement in the code.
Back to top
View user's profile Send private message Send e-mail
kash3338
PostPosted: Fri Dec 28, 2012 9:52 am    Post subject: Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

Try this,

Code:

DECLARE tempBLOB BLOB SUBSTRING(InputRoot.BLOB.BLOB FROM 26 FOR 24);
DECLARE tempCHAR CAST(tempBLOB AS CHARACTER CCSID InputRoot.Properties.CodedCharSetId ENCODING InputRoot.Properties.Encoding);

SET OutputRoot.MRM.RqID = tempCHAR;


You can check the trace for the values of tempBLOB and tempCHAR.

Also, from which system does your input BLOB data come from? You can use the InputRoot.Properties only if the bytes contained in the blob actually represent characters in the CCSID that is in InputRoot.Properties, else, you need to specify a CCSID that indicates the code page that translates the byte values into character value of your input message.
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Sat Dec 29, 2012 11:49 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I am getting input msg as BLOB and I am populating a message set which has the parameter RqID. This message set is later used in subsequent flow for inserting records into DB.
I don't understand. You cannot 'populate' a message set. It is a static description of a message format. Please describe what your message flow is doing, and *why*.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Dec 29, 2012 12:05 pm    Post subject: Re: how to convert BLOB into character which is readable Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

mqlover wrote:
Hi,

I have written below statements to convert BLOB into CHAR

SET OutputRoot.MRM.RqID = CAST(SUBSTRING(InputRoot.BLOB.BLOB FROM 26 FOR 24) AS CHAR CCSID InputRoot.Properties.CodedCharSetId ENCODING InputRoot.Properties.Encoding) ;

The result is in this "4040 40E3 E2E3 F1F0 F1F".
How do I convert into a format which is readable becasuse when I insert this record into database, this would be the unique key to query from the database.

Thanks

wrong length.
Looking at this in EBCDIC would give it possibly meaning...
would it be possible that the CCSID does not adequately describe the data??
Anyways I would not do a substring and then cast... you should do the opposite: cast and then substring...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqlover
PostPosted: Sun Dec 30, 2012 8:18 pm    Post subject: how to convert BLOB into character which is readable Reply with quote

Disciple

Joined: 25 Jul 2010
Posts: 176

Hi,

Thanks for the reply.
As mentioned I first did the CAST and later took the SUBSTRING. Still am getting the same string.

I am doing the conversion as below.

SET Environment.Variables.RqID = CAST(InputRoot.BLOB.BLOB AS CHAR CCSID InputRoot.Properties.CodedCharSetId ENCODING InputRoot.Properties.Encoding );
SET OutputRoot.MRM.RqID = SUBSTRING(Environment.Variables.RqID FROM 26 for 24);

Am I doing something wrong here? Is there a better way to do this. Am i putting the CCSID wrong?

Thanks
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Dec 30, 2012 8:50 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

From the look of your results, your data may also not be what you expect it to be...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kash3338
PostPosted: Sun Dec 30, 2012 9:51 pm    Post subject: Re: how to convert BLOB into character which is readable Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

mqlover wrote:

Code:
SET Environment.Variables.RqID = CAST(InputRoot.BLOB.BLOB  AS CHAR CCSID InputRoot.Properties.CodedCharSetId ENCODING InputRoot.Properties.Encoding );
SET OutputRoot.MRM.RqID = SUBSTRING(Environment.Variables.RqID FROM 26 for 24);



What do you get in this Environment Variable? Do you have a trace? Again I quote the same as above,

Quote:
Also, from which system does your input BLOB data come from? You can use the InputRoot.Properties only if the bytes contained in the blob actually represent characters in the CCSID that is in InputRoot.Properties, else, you need to specify a CCSID that indicates the code page that translates the byte values into character value of your input message.
Back to top
View user's profile Send private message Send e-mail
mattfarney
PostPosted: Mon Dec 31, 2012 4:29 pm    Post subject: Reply with quote

Disciple

Joined: 17 Jan 2006
Posts: 167
Location: Ohio

Assuming I am reading your test data right, your message was:
___TST101 where _ is a whitespace.

Your message appears to be in EBCDIC.
You may actually want to convert it to the local CCSID to get printable windows/unix characters (assuming that's where your database will be).

-mf
Back to top
View user's profile Send private message
mqlover
PostPosted: Tue Jan 01, 2013 5:41 pm    Post subject: how to convert BLOB into character which is readable Reply with quote

Disciple

Joined: 25 Jul 2010
Posts: 176

I am just temporarily storing my string for which CAST is done in Environment variables. We are not supposed to use the trace logs .
So do I have to convert using the CCSID which Database requires?

Thanks
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jan 01, 2013 11:43 pm    Post subject: Re: how to convert BLOB into character which is readable Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

mqlover wrote:
I am just temporarily storing my string for which CAST is done in Environment variables. We are not supposed to use the trace logs .
So do I have to convert using the CCSID which Database requires?

Thanks

First use RFHUtils and verify the setup of the message:
  • content is bytes or hex representation of bytes
  • CCSID of message matches content
  • Format of message matches content


Then just use MQInput node with parser and message type, no convert.

Finally convert the output message to UTF-8 before storing into the DB.
On DB retrieval request transformation from UTF-8

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » how to convert BLOB into character which is readable
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.