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 » XML to FLAT FILE

Post new topic  Reply to topic
 XML to FLAT FILE « View previous topic :: View next topic » 
Author Message
tank_n_spank
PostPosted: Mon Sep 29, 2014 4:16 am    Post subject: XML to FLAT FILE Reply with quote

Apprentice

Joined: 02 Sep 2014
Posts: 37

Hello,

So I have converted a flat file to XML by reading the entire file and getting it parsed against the message set and then sending the data to the queue in XML format. However, what would the reverse steps be to achieve that - XML file or message in queue to a flat file? Do I need to change/create my message set to run against the XML file and display the values in a file using FILE Output node? I presume it will be simply mapping the raw values and just creating the file?

Kind regards,
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Sep 29, 2014 4:34 am    Post subject: Reply with quote

Grand High Poobah

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

Have you thought about using DFDL?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
tank_n_spank
PostPosted: Mon Sep 29, 2014 4:36 am    Post subject: Reply with quote

Apprentice

Joined: 02 Sep 2014
Posts: 37

I am using it for FLAT File to XML. Should I use it again for XML to FLAT FILE?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Sep 29, 2014 4:39 am    Post subject: Reply with quote

Grand High Poobah

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

you should.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Mon Sep 29, 2014 5:06 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

DFDL is both a parser and a writer. The DFDL schema defines the physical format and the logical structure. The DFDL parser can convert from bitstream to tree, or from tree to bitstream using the same model.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
tank_n_spank
PostPosted: Mon Sep 29, 2014 5:55 am    Post subject: Reply with quote

Apprentice

Joined: 02 Sep 2014
Posts: 37

Got it.
Back to top
View user's profile Send private message
tank_n_spank
PostPosted: Tue Sep 30, 2014 1:57 am    Post subject: Reply with quote

Apprentice

Joined: 02 Sep 2014
Posts: 37

So,

It is not picking up my value now. But I do get the text file with the test values, just not my actual values.

Can someone please ELI5?


Code:

SET OutputRoot.DFDL.MyDFDLMessage.*:body.*:body_elem1 = COALESCE(NULLIF(RefInput.body_elem1,'No String Available'), 'test1');
         SET OutputRoot.DFDL.MyDFDLMessage.*:body.*:body_elem2 = COALESCE(NULLIF(RefInput.body_elem2,'No String Available'), 'test_value');
         SET OutputRoot.DFDL.MyDFDLMessage.*:body.*:body_elem3 = COALESCE(NULLIF(RefInput.body_elem3,'No String Available'), 'test_value3');

SET FILE_NAME = 'Local Test' ||'.txt';
         SET OutputLocalEnvironment.Destination.File.Name = FILE_NAME;
         
         PROPAGATE TO TERMINAL 'out' ENVIRONMENT OutputLocalEnvironment;
         SET OutputLocalEnvironment.Destination.File.Name = FILE_NAME;
         PROPAGATE TO TERMINAL 'out1' ENVIRONMENT OutputLocalEnvironment;
         END;         



If you spot anything that could be optimized/improved, please do share your thoughts, thank you.

Edit; This is the error I am getting now:

CTDP3000E: Unexpected end of data at byte offset '<MISSING INSERT 0>' while parsing element '<MISSING INSERT 1>'. The parser encountered the end of the data stream or the end of a parent element.
Back to top
View user's profile Send private message
tank_n_spank
PostPosted: Tue Sep 30, 2014 7:23 am    Post subject: Reply with quote

Apprentice

Joined: 02 Sep 2014
Posts: 37

Do I have to use

Code:

SET OutputRoot.XMLNSC.MyDFDLMessage.*:body.*:body_elem1 = COALESCE(NULLIF(RefInput.body_elem1,'Strin'), 'test1');


if I want to get the variable from the xml file? It doesn't work, as I get an exception - The root element is required in a well-formed document.[/code]
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Sep 30, 2014 1:00 pm    Post subject: Reply with quote

Grand High Poobah

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

Don't know why you're using a NULLIF. Isn't that just about the same as using COALESCE? ...

And when using the DFDL parser on the output make sure you set the right values on OutputRoot.Properties... (message format, message type, etc...)

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Tue Sep 30, 2014 1:06 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I'm confused.

The error is a parsing error, meaning it's an error trying to read or work with the input message.

So the code is failing because the input tree is not parsed correctly, not because the code is doing something wrong.
Back to top
View user's profile Send private message
tank_n_spank
PostPosted: Wed Oct 01, 2014 12:13 am    Post subject: Reply with quote

Apprentice

Joined: 02 Sep 2014
Posts: 37

Fixed it, cheers.
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 » XML to FLAT FILE
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.