Author |
Message
|
vadivel |
Posted: Mon Mar 22, 2004 4:59 pm Post subject: MRM message parsing |
|
|
 Voyager
Joined: 05 Aug 2002 Posts: 79 Location: US
|
Hi,
I have a fixed length message with the following structure.
<LineNumber><DataCode><RecordIdentifier><Data fields....>
The record Identifier identifies the type of record.
In one file I can have 4 different types of records which are uniquely identified by the record identifier field, but the fields preceding them are always of fixed legth.
How do you parse this kind of a message using MRM parser.
Thanks & Regards
Vels |
|
Back to top |
|
 |
Missam |
Posted: Mon Mar 22, 2004 6:34 pm Post subject: |
|
|
Chevalier
Joined: 16 Oct 2003 Posts: 424
|
you need to construct a TDS message to parse your data.
can you post some of your sample data here.how is your line numbers actually represent in your data.is it also a fixed length. |
|
Back to top |
|
 |
vadivel |
Posted: Tue Mar 23, 2004 12:12 am Post subject: |
|
|
 Voyager
Joined: 05 Aug 2002 Posts: 79 Location: US
|
Ya the line number is also fixed length.
The sample data is something like this:
00000010101abcd0123456789efg
00000020102adfasdfkkdhkjeidfdk
00000030102dadafkllasdsdafhfds
00000040102dssafjeiursdafkncdk
00000050109dasgfkjasdglkasdffg
Here the first 7 digit is line number, following 3 digit is data code and the next digit is the record identifier (1-Header, 2-Detail, 9-Trailer). The data following are some other fields.
I want to identify the record based on the record identifier and parse the following fields accordingly.
Please let me know if you need any other input.
Thanks & Regards
Vadivel S. |
|
Back to top |
|
 |
fjcarretero |
Posted: Tue Mar 23, 2004 1:58 am Post subject: |
|
|
Voyager
Joined: 13 Oct 2003 Posts: 88
|
Hi,
If Header, Detail & Trailer have different lengths, you will need multipart messages.
Cheers
Felipe |
|
Back to top |
|
 |
vadivel |
Posted: Tue Mar 23, 2004 2:11 am Post subject: |
|
|
 Voyager
Joined: 05 Aug 2002 Posts: 79 Location: US
|
No they are of the same length.
But the fields in them vary.
Regards
Vels |
|
Back to top |
|
 |
fjcarretero |
Posted: Tue Mar 23, 2004 2:32 am Post subject: |
|
|
Voyager
Joined: 13 Oct 2003 Posts: 88
|
Hi,
Then you can use a choice or multipart messages.
Basically, you have to create a type and in the composition label choose 'choice' or 'message' (depending on choice or multipart).
The broker parses the message until it finds the field corresponding to the type that you have defined as choice/message. Then in the ESQL you have to decide the what type of message is coming (reading the record identifier field). When you reference the first field after the record identifier field of the specific type (ie Header, Detail or Trailer), the broker will parse the rest of the message.
Hope this helps
Felipe |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Mar 23, 2004 4:36 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
fjcarretero wrote: |
If Header, Detail & Trailer have different lengths, you will need multipart messages. |
I don't think that's true if you're using TDS modelling. The stuff before the Tag has to be the same length, but everything after the tag up to the group delimiter can be different lengths. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
fjcarretero |
Posted: Tue Mar 23, 2004 5:25 am Post subject: |
|
|
Voyager
Joined: 13 Oct 2003 Posts: 88
|
You are right!.
I was only thinking about CWF.
Cheers
Felipe |
|
Back to top |
|
 |
Missam |
Posted: Tue Mar 23, 2004 6:53 am Post subject: |
|
|
Chevalier
Joined: 16 Oct 2003 Posts: 424
|
Quote: |
I was only thinking about CWF |
You can't do it using CWF.use need to go with TDS only.
HI vadivel
you better have a look on this link.its almost same as your requirement.
http://www.mqseries.net/phpBB2/viewtopic.php?t=14071&highlight=
First parse the entire message using TDS and in a compute node you can identify the field record identifier and based on that you can play your ESQL code. |
|
Back to top |
|
 |
fjcarretero |
Posted: Tue Mar 23, 2004 7:02 am Post subject: |
|
|
Voyager
Joined: 13 Oct 2003 Posts: 88
|
Quote: |
You can't do it using CWF.use need to go with TDS only |
Believe me, you can. |
|
Back to top |
|
 |
Missam |
Posted: Tue Mar 23, 2004 8:08 am Post subject: |
|
|
Chevalier
Joined: 16 Oct 2003 Posts: 424
|
Quote: |
Believe me, you can |
i believe if you have a message with data in multiple line(delimter of each line <CR><LF>.we should go with TDS rather than CWF.
if you still believe you can do it using CWF.can you provide us a working example |
|
Back to top |
|
 |
kimbert |
Posted: Thu Mar 25, 2004 5:17 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Just to clear up this point:
If you use TDS, you can get the entire message parsed automatically. (The record identifier is modelled as either a tag or a group indicator, and the TDS parser uses it to automatically resolve the choice)
If you use CWF, you can still process the message, but your ESQL has to interpret the record identifier and resolve the choice. CWF cannot *automatically* resolve choices, because it does not have the concept of 'tags'. |
|
Back to top |
|
 |
Missam |
Posted: Thu Mar 25, 2004 7:06 am Post subject: |
|
|
Chevalier
Joined: 16 Oct 2003 Posts: 424
|
Hi kimbert,
If you look into Working With Messages manual.You can get a clear picture what you can do with CWF and TDS. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Mar 25, 2004 9:08 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Sam : What I posted is correct. Why do you think the WWM manual would help? |
|
Back to top |
|
 |
vadivel |
Posted: Tue Mar 30, 2004 12:15 am Post subject: |
|
|
 Voyager
Joined: 05 Aug 2002 Posts: 79 Location: US
|
hi all,
Thanks for all the suggestions and tips..
I was able to parse the message using TDS.
Thanks & Regards
Vadivel S. |
|
Back to top |
|
 |
|