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 » Simple flatfile to XML convert

Post new topic  Reply to topic
 Simple flatfile to XML convert « View previous topic :: View next topic » 
Author Message
K_A
PostPosted: Fri Nov 12, 2004 5:45 am    Post subject: Simple flatfile to XML convert Reply with quote

Apprentice

Joined: 10 Nov 2004
Posts: 32

Hi

I have a flat file as input, I want to convert it to XML. The Flatfile is quite complex, with a lot of different segments (record types).

I do have a message set, with one message fo each record type. I know I could have it work with a lot of eSQL coding, but since the structures are changing now and then I would like to come away from the ESQL stuff, or to minimise it (in order to have good maintainability).

My question1: Which is the BEST way of converting this kind of message to XML? Reset ContentDescriptor? Mapping Node? Is a mapping node overkill for this?

My question2: I will create a numer of XML messages, one for each segment and then a trailer record. At the end of the flow I then need to put it all together in some way. In what way can I store messages awating the trailer record? Do I need to involve database or can I use the Environment in some way?
Back to top
View user's profile Send private message
vennela
PostPosted: Fri Nov 12, 2004 6:02 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

Quote:
My question2: I will create a numer of XML messages, one for each segment and then a trailer record. At the end of the flow I then need to put it all together in some way. In what way can I store messages awating the trailer record? Do I need to involve database or can I use the Environment in some way?

Isn't Aggregate node a solution for this kind?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jefflowrey
PostPosted: Fri Nov 12, 2004 6:35 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You only need the Aggregation nodes when you have to process data across multiple invocations of a message flow, or across multiple message flows.

It sounds like this is not the case, as the input is a single MQ message.

K_A, you may not be able to accomplish this without using ESQL. That said, it depends. Are you running version 5 at FP4? Then you can use static Java methods instead. You can also use the Mapping Nodes if you are running any FP level of version 5 (but you should be running *at least* FP3) - but only if you have defined an output XML message set.

You can use a ResetContentDescriptor node, but you may not like the XML that is produced. You can influence the XML that is produced by adding an XML physical layer to your message set, and then setting the appropriate physical properties.

Or you can dynamically create XML using ESQL.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
K_A
PostPosted: Sat Nov 13, 2004 4:23 am    Post subject: Trouble Reply with quote

Apprentice

Joined: 10 Nov 2004
Posts: 32

Hi

I do have WBIMB 5.0, fp 4 on all components.

I have problems with the ResetContentDescriptor method. here's what I try to do.

1. I read one message from an MQInput, as BLOB: The message contains a lot of segments, in a row.
2. I have a Compute node where I have esql code to extract each segment and PROPAGATING them one by one.
3. Now I have a ResetContentDescriptor, where i set Message Set, Message type and Message format. I set Message format to CWF1, which is an existing one on referred msgset.
This parsing works fine. I can see in the flow debugger that the MRM message is coming out nicely, with no errors.
4. Now I have a second ResetContentDescriptor, where I reset only the message format, to XML1. Also this layer exists on the msg set.
Here it fails. In the message tree in the flow debugger I can se an empty row, with just "XML", and a second row saying "XML parsing errors have occured". I can also see that it has managed to retain the namnes of the message set, typ and format, but still, failing parse.

The message is coming to the out queue in flat record format, with no XML tags.

In the usertrace it all looks OK.

This drives me crazy, I have already spent far too many hours on this one. Can anyone please give me a clue??
Back to top
View user's profile Send private message
kirani
PostPosted: Sat Nov 13, 2004 11:19 pm    Post subject: Reply with quote

Jedi Knight

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

Why do you have two RCD nodes one after another? first for converting it to CWF format and second for converting it to XML format.
Instead of adding second RCD node in your message flow try using a compute node with this property,
Code:

SET OutputRoot.Properties.MessageFormat = 'XML1';

_________________
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
K_A
PostPosted: Mon Nov 15, 2004 2:01 am    Post subject: Reply with quote

Apprentice

Joined: 10 Nov 2004
Posts: 32

I followed your advice and somthing strange happened:

After the RCD to CWF (that works) I added a compute with the following esql:

CREATE COMPUTE MODULE FU_TO_XML_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
-- CALL CopyMessageHeaders();
SET OutputRoot.Properties.MessageFormat = 'XML1';
CALL CopyEntireMessage();
RETURN TRUE;
END;

CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;

CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE;


No error messages, but in the flow debugger, after this Comput I can see that the propertis has changed to XML1, but the message body is still MRM!

What can be wrong?
Back to top
View user's profile Send private message
K_A
PostPosted: Mon Nov 15, 2004 5:46 am    Post subject: Stupid me Reply with quote

Apprentice

Joined: 10 Nov 2004
Posts: 32

OK, lets forget about the whole thing.

Off course it will not work in example provided!

I have solved the problem now. The way I hade to do it was to first have an RCD to set to CWF1, and then a Compute node that set the format to XML1. I can read from the manual, tha an RCD obviously cannot reset from one domain to another.
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 » Simple flatfile to XML convert
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.