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 IndexWebSphere Message Broker SupportConverting DFDL fragment to BLOB

Post new topicReply to topic
Converting DFDL fragment to BLOB View previous topic :: View next topic
Author Message
TKIY
PostPosted: Wed Nov 21, 2018 6:09 am Post subject: Converting DFDL fragment to BLOB Reply with quote

Novice

Joined: 23 Aug 2016
Posts: 17

I have a somewhat complex DFDL created that contains a set of repeating records. I have the requirement to separate each of these records and place them, individually, into text files.

Using ASBITSTREAM converts the DFDL to BLOB as expected but each file created has the entire DFDL structure, not the specific elements selected.

This is what I am working with right now:

Code:
DECLARE ackStream BLOB ASBITSTREAM(InputRoot.DFDL.ns:Group[counter] CCSID InputRoot.Properties.CodedCharSetId ENCODING InputRoot.Properties.Encoding);
         
SET OutputRoot.BLOB.BLOB = ackStream ;


The output, however includes the whole structure, not the specific instance of the 'Group' element as I would expect.

Any hints?
Back to top
View user's profile Send private message
rekarm01
PostPosted: Wed Nov 21, 2018 10:39 am Post subject: Re: Converting DFDL fragment to BLOB Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1322

TKIY wrote:
The output, however includes the whole structure, not the specific instance of the 'Group' element as I would expect.

The DFDL parser doesn't support a FolderBitStream option, but one alternative is to create a separate DFDL schema for ASBITSTREAM(), describing just the 'Group' sub-tree.
Back to top
View user's profile Send private message
TKIY
PostPosted: Wed Nov 21, 2018 10:58 am Post subject: Re: Converting DFDL fragment to BLOB Reply with quote

Novice

Joined: 23 Aug 2016
Posts: 17

rekarm01 wrote:
TKIY wrote:
The output, however includes the whole structure, not the specific instance of the 'Group' element as I would expect.

The DFDL parser doesn't support a FolderBitStream option, but one alternative is to create a separate DFDL schema for ASBITSTREAM(), describing just the 'Group' sub-tree.


Right, makes sense. I'll give that a shot.
Back to top
View user's profile Send private message
rekarm01
PostPosted: Wed Nov 21, 2018 2:28 pm Post subject: Re: Converting DFDL fragment to BLOB Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1322

Another alternative that wouldn't require a separate schema is to define 'Group' as a global element, and indicate the desired model and message, either in the Properties header, or in the ASBITSTREAM() SET/TYPE clauses, as needed.
Back to top
View user's profile Send private message
timber
PostPosted: Fri Nov 23, 2018 5:11 am Post subject: Reply with quote

Sentinel

Joined: 25 Aug 2015
Posts: 891

Quote:
Another alternative that wouldn't require a separate schema is to define 'Group' as a global element, and indicate the desired model and message, either in the Properties header, or in the ASBITSTREAM() SET/TYPE clauses, as needed.
I was just about to say the same thing. But you should create a message definition from that global element - otherwise the DFDL parser might not recognise it as a valid starting point for a message.
Back to top
View user's profile Send private message
TKIY
PostPosted: Mon Nov 26, 2018 5:41 am Post subject: Reply with quote

Novice

Joined: 23 Aug 2016
Posts: 17

Creating the dedicated message worked from the perspective of copying a single instance to a new message, but ASBITSTREAM is having trouble serializing it. One problem down, one more added on to the pile.

Thanks for the help!
Back to top
View user's profile Send private message
TKIY
PostPosted: Thu Nov 29, 2018 10:20 am Post subject: Reply with quote

Novice

Joined: 23 Aug 2016
Posts: 17

Just wanted to say I got this fully working finally. Many thanks @rekarm01 and @timber.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Nov 29, 2018 12:44 pm Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25365
Location: Ohio, USA

TKIY wrote:
Just wanted to say I got this fully working finally.


Care to share your solution for the benefit of future readers? And, obviously, well done.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
TKIY
PostPosted: Fri Nov 30, 2018 5:33 am Post subject: Reply with quote

Novice

Joined: 23 Aug 2016
Posts: 17

Resolved the ASBITSTREAM issue after I realized that the initial element I was creating in the output root was incorrect. I was creating the first element within the 'Group' subtree without creating the subtree first.

Creating a message which contained only the 'Group' subtree and using ASBITSTREAM was the correct solution.

Code:
CREATE LASTCHILD OF OutputLocalEnvironment.Variables DOMAIN 'DFDL' ;
         
SET OutputLocalEnvironment.Variables.DFDL.ns:GROUP_MSG.ns:"GROUP" = InputRoot.DFDL.ns:MAIN_MESSAGE.ns:SUBTREE.ns:"GROUP"[counter] ;
         
DECLARE ackStream BLOB;
         
SET ackStream = CAST(ASBITSTREAM(OutputLocalEnvironment.Variables.DFDL.ns:GROUP_MSG) AS BLOB CCSID 819);
         
SET OutputRoot.BLOB.BLOB = ackStream ;
Back to top
View user's profile Send private message
rekarm01
PostPosted: Mon Dec 03, 2018 6:14 pm Post subject: Re: Converting DFDL fragment to BLOB Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1322

TKIY wrote:
Code:
... CAST(ASBITSTREAM(OutputLocalEnvironment.Variables.DFDL.ns:GROUP_MSG) AS BLOB CCSID 819) ...

CAST(BLOB AS BLOB) is unnecessary here; it has no effect because ASBITSTREAM() already returns a BLOB. Also, CAST() does not use the CCSID parameter unless converting to/from CHARACTER.
Back to top
View user's profile Send private message
TKIY
PostPosted: Tue Dec 04, 2018 6:20 am Post subject: Re: Converting DFDL fragment to BLOB Reply with quote

Novice

Joined: 23 Aug 2016
Posts: 17

rekarm01 wrote:
TKIY wrote:
Code:
... CAST(ASBITSTREAM(OutputLocalEnvironment.Variables.DFDL.ns:GROUP_MSG) AS BLOB CCSID 819) ...

CAST(BLOB AS BLOB) is unnecessary here; it has no effect because ASBITSTREAM() already returns a BLOB. Also, CAST() does not use the CCSID parameter unless converting to/from CHARACTER.


Good to know, I'll clean that up.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker SupportConverting DFDL fragment to 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.