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 » Complex message set

Post new topic  Reply to topic
 Complex message set « View previous topic :: View next topic » 
Author Message
loju
PostPosted: Wed Dec 12, 2012 12:00 am    Post subject: Complex message set Reply with quote

Newbie

Joined: 11 Dec 2012
Posts: 6

Hello,

I need to do a complex message set and I have some problem with it. My message set must be a repetition of groups of data and each group of data contains:

    1 header line (tag M)
    1 carton line (tag C)
    several details lines (tag D)


The identification of line type is done by a tag in the 9th position in the line. For example:

Code:
[8 chars] M [X lines]\r\n
[8 chars] C [X lines]\r\n
[8 chars] D [X lines]\r\n
[8 chars] D [X lines]\r\n
[8 chars] M [X lines]\r\n
[8 chars] C [X lines]\r\n
[8 chars] D [X lines]\r\n
[8 chars] D [X lines]\r\n
[8 chars] D [X lines]\r\n
[8 chars] D [X lines]\r\n
[8 chars] D [X lines]\r\n
...


I have defined a complex type message of type "VariableLengthElementsDelimited" delimiter <CR><LF> and group terminator <CR><LF>, a complex type data of type "TaggedDelimited" with delimiter <CR><LF> tabLength=1 and then a type t_prefix to store the 8 first chars of each lines and 3 types header, carton an detail with tag M, C, D.



The parsing is done correctly for each lines but there is only one data group as I don't know how to deal with the separation.



How can I do with group separations ?

Thanks in advance.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Dec 12, 2012 4:43 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You shouldn't do it with group separators.

You should do it with a repeating choice, which is tagged/delimited and contains a single and non-repeating instance of Header, Carton and Detail.

The tag will allow the parser to determine which type of record has occurred.
Back to top
View user's profile Send private message
loju
PostPosted: Wed Dec 12, 2012 5:09 am    Post subject: Reply with quote

Newbie

Joined: 11 Dec 2012
Posts: 6

Thanks for your answer.

Yes, the choice will give me either a header, a carton or a detail but it won't provide me grouping no ?

What I expect to have is :

Code:
<data>
    <header>
    <carton>
    <detail>
    ...
</data>
<data>
    <header>
    <carton>
    <detail>
    ...
<data>
...


The choice won't build me data tag no ?

The problem is that the 8 chars in the beginning aren't the same along the file so I cannot use grouping. The only one thing which give me an indication of group is that we have a new header line.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Dec 12, 2012 5:22 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

why would you think that adding a choice after prefix would alter the higher level structure?
Back to top
View user's profile Send private message
loju
PostPosted: Wed Dec 12, 2012 5:32 am    Post subject: Reply with quote

Newbie

Joined: 11 Dec 2012
Posts: 6

No, you are right.

I just say that what I want is just changing the higher structure (data), that's all

I was just telling this because I didn't understand why you were talking about choice.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Dec 12, 2012 5:40 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

loju wrote:
I just say that what I want is just changing the higher structure (data), that's all


Okay. But I disagree.

I believe you should put header/carton/detail into a choice structure as I described.

It will then allow you to construct the message you want.

Except for the fact that one message with two root <data> tags is not actually valid XML...
Back to top
View user's profile Send private message
loju
PostPosted: Wed Dec 12, 2012 5:48 am    Post subject: Reply with quote

Newbie

Joined: 11 Dec 2012
Posts: 6

I understand what you want to say and yes, this must be better to do it with choice for tagged part.

In fact the result is not directly XML, my sample is only for representation. I read this flat file and need to do a mapping to XML structure. This data (grouping) element will so help me to loop over input.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Dec 12, 2012 7:54 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

loju : I think I understand the requirement. Your input data format is just a 'flat' list of lines. But you want a message tree in which each 'item' is held in a separate instance of the 'data' element.

I assume that you are using v6 or v7. If you were on v8 you would be using DFDL and having a much easier time

As mqjeff says, the easy way is to use a repeating choice. However, it is possible to do what you are requesting - just a lot harder. If you want to pursue that goal, post again and I will give you some hints.
Back to top
View user's profile Send private message
loju
PostPosted: Wed Dec 12, 2012 10:47 am    Post subject: Reply with quote

Newbie

Joined: 11 Dec 2012
Posts: 6

Hello Kimbert,

Yes, you have understood what I want. I am very interested with your harder solution because unfortunately, I cannot update to V8.

(prefix is useless for me, it was just to apply tag on the rest of lines, ideally, it must be included into header, carton and detail)

Many thanks.
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Dec 17, 2012 8:07 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Apologies for the delay.
You need to set Data Element Separation to 'Use Data Pattern' on the complex type that contains the lines, and then use a data pattern that looks something like this:
Code:
.*(8)H[^\r|(\r^\n)]*\r\n

This will match any line that has an 'H' in column 9, including the terminating \r\n.
The regex looks complex, but it needs to be. MRM TDS insists that a data pattern must match *all* of the item that is being selected. So this would only return 9 characters
Code:
.*(8)H
and so would lead to a parsing exception.

btw, these data patterns have not been tested, so you will almost certainly have to tweak them until they work.
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Dec 17, 2012 8:21 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

In addition to the advice in the previous post, you will need to change the structure of your message definition to ensure that a new Data element is started when a header line is encountered.
More details on that another time...
Back to top
View user's profile Send private message
loju
PostPosted: Wed Dec 19, 2012 1:53 am    Post subject: Reply with quote

Newbie

Joined: 11 Dec 2012
Posts: 6

Thanks Kimbert,

I've tried with Data Pattern but I cannot parse line successfully. I just added a preliminary step which place my tags in the first position in each line, with this, I am able now to use Tagged delimited mode.

I will try again with pattern but I didn't found a way to use it for now.

Regards,
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 » Complex message set
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.