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 » Extracting data from a BLOB

Post new topic  Reply to topic
 Extracting data from a BLOB « View previous topic :: View next topic » 
Author Message
DELLIPIZ
PostPosted: Fri Nov 19, 2004 8:21 am    Post subject: Extracting data from a BLOB Reply with quote

Acolyte

Joined: 08 Oct 2003
Posts: 70

Hi,

My input is in BLOB. (Message Domain = BLOB). It is really legacy data, but since I won't know what the structure is, I am treating it as a BLOB, instead of an MRM.

I need to capture certain positions of that data.

For example, I need to extract data in position 5. So I tried putting
SET OutputRoot = SUBSTRING(InputRoot FROM 5 FOR 1);

But it's failing when I run it. Any idea how I could extract data from a BLOB?

Thanks!

-Lori
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Nov 19, 2004 8:31 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You can access the BLOB field you are interested in at InputRoot.BLOB.BLOB, not at InputRoot.

Or at InputBody.BLOB.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
DELLIPIZ
PostPosted: Fri Nov 19, 2004 8:54 am    Post subject: Reply with quote

Acolyte

Joined: 08 Oct 2003
Posts: 70

I tried this and it didn't work:

SET OutputRoot = SUBSTRING(InputBody.BLOB FROM 1 FOR 4);

to try to get the first four positions.

What did I do wrong?

Thanks!
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Nov 19, 2004 9:02 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You can't assign directly to OutputRoot either.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
kirani
PostPosted: Fri Nov 19, 2004 10:03 am    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Depending on your output message format you need to code your ESQL. For example, if the output message format is XML then the ESQL code would be,
Code:

SET OutputRoot.XML.MyData = SUBSTRING(CAST(InputRoot."BLOB"."BLOB" AS CHAR CCSID InputRoot.Properties.CodedCharSetId) FROM 5 FOR 1);

_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Fri Nov 19, 2004 10:24 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I think SUBSTRING is supposed to work on all of the "character" types, including BLOB.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
kirani
PostPosted: Fri Nov 19, 2004 11:02 am    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Yes, but he will HEX character if he uses SUBSTRING on BLOB. I think he wants the actual CHARACTER/data from the message.
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
Tibor
PostPosted: Tue Nov 23, 2004 3:13 pm    Post subject: Reply with quote

Grand Master

Joined: 20 May 2001
Posts: 1033
Location: Hungary

kirani wrote:
Depending on your output message format you need to code your ESQL. For example, if the output message format is XML then the ESQL code would be,
Code:
SET OutputRoot.XML.MyData = SUBSTRING(CAST(InputRoot."BLOB"."BLOB" AS CHAR CCSID InputRoot.Properties.CodedCharSetId) FROM 5 FOR 1);


I would recommend to change the order of CAST and SUBSTRING depending on the length of input.

Code:
SET OutputRoot.XML.MyData = CAST(SUBSTRING(InputRoot."BLOB"."BLOB" FROM 5 FOR 1) AS CHAR CCSID InputRoot.Properties.CodedCharSetId) ;


Tibor
Back to top
View user's profile Send private message
kirani
PostPosted: Tue Nov 23, 2004 11:23 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

I think it will throw exception if the order is changed with current code.
It will work only if you put FROM 5 FOR 2 instead of FROM 5 FOR 1.
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
Tibor
PostPosted: Wed Nov 24, 2004 12:52 am    Post subject: Reply with quote

Grand Master

Joined: 20 May 2001
Posts: 1033
Location: Hungary

kirani wrote:
I think it will throw exception if the order is changed with current code.
It will work only if you put FROM 5 FOR 2 instead of FROM 5 FOR 1.

Kiran,

The function SUBSTRING works correctly on BLOB and results BLOB, that's why I recommend it for first step. The atomic element is the byte inside a BLOB, so odd positioning is allowed.

Another reason is the speed: any operation on a BLOB value is far faster than othen types. Our brokers have to work with very big messages and I prefer BLOB type based processing in this case as far as possible.

Tibor
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Extracting data from a BLOB
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.