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 » Message Model

Post new topic  Reply to topic
 Message Model « View previous topic :: View next topic » 
Author Message
murdeep
PostPosted: Wed Nov 03, 2004 4:38 pm    Post subject: Message Model Reply with quote

Master

Joined: 03 Nov 2004
Posts: 211

My company is new to WBI. We are doing proof of concept to determine if it will be used extensively. My manager has assigned me a task that he thinks is easy but I have doubts.

We have a sequential file that is being read by a MQseries application. The entire file is sent as a single message to a queue that a WBI V5 message flow will process. My task is to take the message in WBI and parse it.

I have read the literature and also reviewed support pacs (IA96) but am not being succesfull at my task.

The sequential file is composed of 5 different types of records that appear in any order, any number of times. Each record in the file is a different fixed length. Each record has a starting tag that is unique for each record type. The tag is not the same length for each record. For example 1 record type has a tag 5 bytes long and another record is 3.

I haved tried to create a TDS message format but have run into problems. Here is what I have done.

For each record I created a complex type defined as fixed length. To each of these complex type I defined local elements. I didn't create a local element for the tag. Each of these complex types represents a type of record in the sequential file.

I then create a complex type that will represent the whole message. It is defined as tagged fixed length and to it I add 5 local elements. For each local element I add I set its type to one of the fixed length types I created earlier. Now here is my problem. I want to set the tag for each element added to my complex type but the tags must be all the same length. So i have problems. How do I do this. Isn't tagged fixed length mean a tag followed by a fixed length record?

Regards,

Murdeep
Back to top
View user's profile Send private message
kman
PostPosted: Wed Nov 03, 2004 11:09 pm    Post subject: Reply with quote

Partisan

Joined: 21 Jan 2003
Posts: 309
Location: Kuala Lumpur, Malaysia

hmmm. I am not sure I understand this. But I would think I would set it up as XML. And since the input file, is actually a message with tags, that should qualifies as XML.
Again, I am not sure of this.
If the tag's name is fixed, then you can parse it.
Back to top
View user's profile Send private message Yahoo Messenger
shanson
PostPosted: Thu Nov 04, 2004 2:56 am    Post subject: Reply with quote

Partisan

Joined: 17 Oct 2003
Posts: 344
Location: IBM Hursley

TDS Tagged Fixed Length is absolutely the correct approach to start with. The one problem to crack is the variable length tags. Are your tags followed by a 'tag/data separator'? If so you can specify this separator instead of the length. Otherwise I think you will have to model the tag as a local element, and use TDS Use Data Pattern to parse it using regular expressions.
Back to top
View user's profile Send private message
murdeep
PostPosted: Thu Nov 04, 2004 3:56 am    Post subject: Reply with quote

Master

Joined: 03 Nov 2004
Posts: 211

The tags have nothing that indicates there ending point. The Use Data Pattern is an option I did not think about. I will try this option to see if it allows me to recognize the different tags. I don't understand why there isn't a model that allows tagged records where the tags are diferent lengths based on the record. I was looking at group indicators, is that a possible solution?

Regards,

Murdeep
Back to top
View user's profile Send private message
shanson
PostPosted: Thu Nov 04, 2004 4:21 am    Post subject: Reply with quote

Partisan

Joined: 17 Oct 2003
Posts: 344
Location: IBM Hursley

It's a CATCH 22. The parser needs to identify the records in the bitstream, which it does by looking at the tags. To correctly parse a tag it needs to know when the tag ends - you need a length or a terminating character.
Back to top
View user's profile Send private message
murdeep
PostPosted: Thu Nov 04, 2004 4:34 am    Post subject: Reply with quote

Master

Joined: 03 Nov 2004
Posts: 211

If I tell the parser then tag is ABC the why would I also need to specify a length or a terminator? It seems rather daft that I can't explicily define the tag. This is why I was looking at groups and perhaps a group indicator.

Regards,

Murdeep
Back to top
View user's profile Send private message
shanson
PostPosted: Thu Nov 04, 2004 4:57 am    Post subject: Reply with quote

Partisan

Joined: 17 Oct 2003
Posts: 344
Location: IBM Hursley

If you follow your logic, how can the parser distinguish a tag of ABC from a tag of AB followed by data C? It can't. The only safe way to parse this is to supply a tag length or a tag data separator, or to use regular expressions where you can look ahead into the data following the tag in order to resolve potential ambiguities.
Back to top
View user's profile Send private message
murdeep
PostPosted: Thu Nov 04, 2004 12:57 pm    Post subject: Reply with quote

Master

Joined: 03 Nov 2004
Posts: 211

I have successfully managed to parse the message using a combination of fixed length and use data pattern. Each record was modelled as a fixed length. I then created a complex type representing the message and modelled it a 'use data pattern'. Each record was added as a local element to the complex type and assigned a 'use data pattern'.

For example one of my records was 150 bytes long. The tag was comprised of the first two fields in the record. These two fileds are 8 bytes in total. Together they would contain 0150REC1. So the 'use data pattern' was denoted as '(0150REC1).{142}' The (0150REC1) tells the parser to look for the occurence of '0150REC1' in the data stream. The .{142} tells the parser to treat the next 142 bytes as the rest of the record. I had to do this kind of patterning for each record type. Once I did this I could parse the entire message.

I still have doubts about how I should be setting the min and max occurences of each record type since I do not know in advance how many of each record type I will get in a message. I also don't know in which order the records will occur. I foresee many hours of testing.

Thanks for everyones help.

Regards,

Murdeep
Back to top
View user's profile Send private message
shanson
PostPosted: Fri Nov 05, 2004 1:23 am    Post subject: Reply with quote

Partisan

Joined: 17 Oct 2003
Posts: 344
Location: IBM Hursley

That's good news Murdeep. As for the occurrences, you have two possibilities:

1) If all occurrences of a given record occur contiguously, then you can simply make the complex type an 'unorderedSet' instead of a 'sequence', and give each of your record elements minOccurs=0 and maxOccurs=-1 (unbounded).

2) If the occurrences of a given record can be interspersed between other types of records, then what you actually have is a repeating choice. Make the complex type a 'choice' then set minOccurs=0 and maxOccurs=-1 on the complex type itself (not the record elements).
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 » Message Model
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.