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 » Build DFDL tree from BLOB

Post new topic  Reply to topic Goto page 1, 2  Next
 Build DFDL tree from BLOB « View previous topic :: View next topic » 
Author Message
nelson
PostPosted: Thu May 07, 2015 10:41 am    Post subject: Build DFDL tree from BLOB Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

Hi All,

I'm trying yo save the DFDL tree and in the future build it again. This looks silly (bacause I'm not storing the DFDL tree nowhere), but should work I think and demonstrates my issue:

Code:

CREATE LASTCHILD OF OutputRoot DOMAIN('DFDL')
               PARSE(ASBITSTREAM(InputRoot.DFDL OPTIONS RootBitStream) ENCODING InputRoot.MQMD.Encoding CCSID InputRoot.MQMD.CodedCharSetId SET '' TYPE '{}:MYMSG' OPTIONS RootBitStream);


The tree is never created properly... I've tried a lot of combinations and options, but it always fails:

Code:
DFDL
   MYMSG
         CHARACTER:DFDL parsing errors have occurred


I need some help on how to store the DFDL tree and then how to send it to the CREATE statement...

Any help is very appreciated.

Thanks a lot for your help.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu May 07, 2015 11:10 am    Post subject: Reply with quote

Grand High Poobah

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

Consider doing it the same way you would parse an XMLNSC tree...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
maurito
PostPosted: Fri May 08, 2015 12:08 am    Post subject: Re: Build DFDL tree from BLOB Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

Your inputroot is already parsed ( as DFDL ), so you only need to save as bitstream, for example:
Code:

SET envRef.Message  = ASBITSTREAM(InputRoot.DFDL.*:* CCSID propRef.CodedCharSetId ENCODING propRef.Encoding);


where propRef is a reference to the input Properties folder

you will need to parse when restoring to DFDL

or you can save the already parsed message by creating a folder with the DFDL parser associated to it, and then copy directly from input root to that folder.

to restore your as bistream saved message:
Code:

CREATE LASTCHILD OF OutputRoot DOMAIN('DFDL') PARSE(savedmsg,0,0,'','{}:yourmessage','',RootBitStream);


Note that in the ASBITSTREAM you need to specify ccsid and encoding so that it knows how to deal with endianess, etc., and probably that is the cause of your error.
Back to top
View user's profile Send private message
Simbu
PostPosted: Fri May 08, 2015 2:05 am    Post subject: Reply with quote

Master

Joined: 17 Jun 2011
Posts: 289
Location: Tamil Nadu, India

https://developer.ibm.com/answers/questions/189314/how-can-i-convert-a-blob-formatted-message-to-dfdl/?smartspace=integration-bus
Back to top
View user's profile Send private message
nelson
PostPosted: Fri May 08, 2015 4:42 am    Post subject: Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

Thank to all for your suggestions. It finally worked this way:

Code:
DECLARE inCCSID INT InputProperties.CodedCharSetId;
DECLARE inEncoding INT InputProperties.Encoding;
DECLARE inBitStream BLOB ASBITSTREAM(InputRoot.DFDL, inEncoding, inCCSID);
DECLARE inBitStreamStr CHARACTER SUBSTRING(CAST(inBitStream AS CHARACTER) FROM 3 FOR  LENGTH(inBitStreamStr) - 3);   
...
...
...
DECLARE newBlob BLOB CAST(inBitStreamStr AS BLOB);
CREATE LASTCHILD OF OutputRoot DOMAIN('DFDL') PARSE(newBlob ENCODING InputRoot.MQMD.Encoding CCSID InputRoot.MQMD.CodedCharSetId SET '' TYPE '{}:MyMsg');


The issue was how to store the BLOB as string in memory and then restore it to BLOB again.

Regards.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri May 08, 2015 5:18 am    Post subject: Reply with quote

Grand High Poobah

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

nelson wrote:


Code:

DECLARE inBitStream BLOB ASBITSTREAM(InputRoot.DFDL, inEncoding, inCCSID);
DECLARE inBitStreamStr CHARACTER SUBSTRING(CAST(inBitStream AS CHARACTER) FROM 3 FOR  LENGTH(inBitStreamStr) - 3);   


Out of curiosity, why switch to Character and why skip the first 3 bytes?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
nelson
PostPosted: Fri May 08, 2015 5:38 am    Post subject: Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

fjb_saper wrote:
nelson wrote:


Code:

DECLARE inBitStream BLOB ASBITSTREAM(InputRoot.DFDL, inEncoding, inCCSID);
DECLARE inBitStreamStr CHARACTER SUBSTRING(CAST(inBitStream AS CHARACTER) FROM 3 FOR  LENGTH(inBitStreamStr) - 3);   


Out of curiosity, why switch to Character and why skip the first 3 bytes?


When I cast the BLOB to CHARACTER " X' " is concatenated to the start of the string and " ' " at the end, so when you try to cast this string again to BLOB it says that the string is not valid.... Is there a better way to do this?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri May 08, 2015 5:46 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Why do you need to cast it to character?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri May 08, 2015 5:48 am    Post subject: Reply with quote

Grand High Poobah

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

nelson wrote:

When I cast the BLOB to CHARACTER " X' " is concatenated to the start of the string and " ' " at the end, so when you try to cast this string again to BLOB it says that the string is not valid.... Is there a better way to do this?


And you expected anything different? When you cast a BLOB to CHARACTER without specifying any CCSID, what you get is a hex representation of the BLOB. (Default).
I would have expected something like
Code:
DECLARE inBitStreamStr CHARACTER CAST(inBitStream AS CHARACTER inEncoding, inCCSID);

if what you wanted was the String representation of the bitstream... assuming of course that the bitstream only contains characters...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
nelson
PostPosted: Fri May 08, 2015 6:10 am    Post subject: Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

fjb_saper wrote:
nelson wrote:

When I cast the BLOB to CHARACTER " X' " is concatenated to the start of the string and " ' " at the end, so when you try to cast this string again to BLOB it says that the string is not valid.... Is there a better way to do this?


And you expected anything different? When you cast a BLOB to CHARACTER without specifying any CCSID, what you get is a hex representation of the BLOB. (Default).
I would have expected something like
Code:
DECLARE inBitStreamStr CHARACTER CAST(inBitStream AS CHARACTER inEncoding, inCCSID);

if what you wanted was the String representation of the bitstream... assuming of course that the bitstream only contains characters...


In fact, your statement generates something like:

Code:
"X'1234.....1324'"


The string that I need is:

Code:
"1234....1234"


Since
Code:
CAST(inBitStreamStr AS BLOB ...)


says inBitStreamStr is invalid, it works fine with the second string.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri May 08, 2015 6:40 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

nelson wrote:
The string that I need is:

Code:
"1234....1234"


Why do you need it as a string?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri May 08, 2015 6:46 am    Post subject: Reply with quote

Grand High Poobah

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

Looks to me like you are doing some unholy comparison here:
byte[] to hex String => look for some String value...

That really should have been in ESQL check if BLOB a is in BLOB b...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
nelson
PostPosted: Fri May 08, 2015 7:10 am    Post subject: Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

mqjeff wrote:
nelson wrote:
The string that I need is:

Code:
"1234....1234"


Why do you need it as a string?


I'm storing this value in a Hashtable in Java...
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri May 08, 2015 7:43 am    Post subject: Reply with quote

Grand High Poobah

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

nelson wrote:
mqjeff wrote:
nelson wrote:
The string that I need is:

Code:
"1234....1234"


Why do you need it as a string?


I'm storing this value in a Hashtable in Java...
?? ?? ??
As a value or a key?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
nelson
PostPosted: Fri May 08, 2015 7:44 am    Post subject: Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

fjb_saper wrote:
nelson wrote:
mqjeff wrote:
nelson wrote:
The string that I need is:

Code:
"1234....1234"


Why do you need it as a string?


I'm storing this value in a Hashtable in Java...
?? ?? ??
As a value or a key?


As a value
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Build DFDL tree from 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.