Author |
Message
|
leo.yue |
Posted: Mon Apr 10, 2006 4:00 pm Post subject: [URGENT] TDS message model |
|
|
Acolyte
Joined: 20 Oct 2004 Posts: 52
|
There is a message.
Quote: |
<CR><LF>A1 C1234 D1234 F1234
<CR><LF> |
A1 is optional and it must start with 'A' or be 'ZZ'. 'C1234', 'D1234', 'F1234' are fixed length (5). These element are divided by space.
How can I do it? I have no sense about how to set 'A1' optional, maybe using regular expression.
really appreciate any help |
|
Back to top |
|
 |
vinbud117 |
Posted: Mon Apr 10, 2006 7:26 pm Post subject: |
|
|
Acolyte
Joined: 22 Jul 2005 Posts: 61
|
handle that in BLOB, ie before parsing... just check if the first two char is A1 in the filter node and then send it to the RCD... u can even have two diff message types, one with element for handling A1 and the other without that element... |
|
Back to top |
|
 |
elvis_gn |
Posted: Mon Apr 10, 2006 7:33 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi leo.yue,
If you have the time you should try out the choice in message sets.
Define groups with A1 or ZZ as the tags to the group
So if it finds A1 it will follow that structure or if its ZZ u can define another structure,....since for you the structures are same, just use choice for the simple fields A1 or ZZ....
Note: I only know this is concept, not sure if it works or how it works Thats why I said, "if you have the time".
Regards. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Apr 11, 2006 12:23 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
You can probably do this using the TDS parser without needing to use the BLOB domain at all. But your description of the message is incomplete:
Quote: |
A1 is optional and it must start with 'A' or be 'ZZ'. 'C1234', 'D1234', 'F1234' are fixed length (5) |
- is the 'A1' a tag for the fixed-length fields which follow, or is it part of the data?
- is it always 2 characters ( 'A2', 'AZ' etc ) or can its length vary?
- if the 'A1' is a 2-character tag, what are the other possibilities? |
|
Back to top |
|
 |
leo.yue |
Posted: Tue Apr 11, 2006 5:13 am Post subject: |
|
|
Acolyte
Joined: 20 Oct 2004 Posts: 52
|
thanks all.
Quote: |
- is the 'A1' a tag for the fixed-length fields which follow, or is it part of the data? |
'A1' is the part of the data
Quote: |
- is it always 2 characters ( 'A2', 'AZ' etc ) or can its length vary? |
its length range is 1 to 3
Quote: |
- if the 'A1' is a 2-character tag, what are the other possibilities? |
no, 'A1' is not a tag
Thanks kimbert.  |
|
Back to top |
|
 |
dsriksha |
Posted: Tue Apr 11, 2006 5:45 am Post subject: |
|
|
 Voyager
Joined: 27 Feb 2005 Posts: 95
|
I am still not that sharp in underastanding others message formats . But this may work.
Quote: |
<CR><LF>A1 C1234 D1234 F1234
<CR><LF> |
create 4 localelements say A, C, D, F
In localelemnt A create a choice element, then in choice element create a1, z1 local elements.  |
|
Back to top |
|
 |
granthmuk |
Posted: Tue Apr 11, 2006 7:13 am Post subject: |
|
|
 Apprentice
Joined: 16 May 2001 Posts: 38 Location: Edinburgh, Scotland
|
It may be worth looking at Regular Expressions to parse your message.
Do a search for
Quote: |
Regular Expressions |
in your toolkit help. |
|
Back to top |
|
 |
juddg |
Posted: Tue Apr 11, 2006 8:05 am Post subject: Try the following |
|
|
Apprentice
Joined: 22 Nov 2004 Posts: 33
|
Hi,
Try the following definition for a row.
Code: |
Sequence
Data Element Separation - Use Data Pattern
|
|
-- Sequence
| minOccurs - 0
| Data Element Separation - Use Data Pattern
| Data Pattern - (((A[^ ]{0,2})|ZZ) )
| Group Terminator - <SP>
| |
| |
| -- Element Name - Elem1
| Data Pattern - [^ ]*
|
|
-- Sequence
Data Element Separation - All Element Delimited
Data Pattern - .*
Delimiter - <SP>
|
|
-- Element Name - Elem2
|
-- Element Name - Elem3
|
-- Element Name - Elem4
|
Regards,
juddg. |
|
Back to top |
|
 |
elvis_gn |
Posted: Tue Apr 11, 2006 7:45 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi leo.yue,
If you know that spaces are always available, then use it as the delimiter.....U can use the first field as the Tag or as a field itself....Your ESQL might vary accordingly....you will have to forsee that.
There are many ways of doing it....
Hence I suggest you try them all and see which works.
Regards.
Last edited by elvis_gn on Mon Apr 17, 2006 1:45 am; edited 1 time in total |
|
Back to top |
|
 |
leo.yue |
Posted: Wed Apr 12, 2006 7:23 am Post subject: |
|
|
Acolyte
Joined: 20 Oct 2004 Posts: 52
|
thanks for your reply.
juddg, I just tired your suggestion based on the following message.
Quote: |
<CR><LF>01 A1 C1234 D1234 F1234
<CR><LF>02
A1 is optional
|
I changed your definition as follows (added 'Group Indicator - <CR><LF>01' in the sequence):
Code: |
Sequence
Data Element Separation - Use Data Pattern
-- Sequence
minOccurs - 0
Data Element Separation - Use Data Pattern
Data Pattern - (((A[^ ]{0,2})|ZZ) )
Group Indicator - <CR><LF>01
Group Terminator - <SP>
-- Element Name - Elem1
Data Pattern - [^ ]*
-- Sequence
Data Element Separation - All Element Delimited
Data Pattern - .*
Delimiter - <SP>
-- Element Name - Elem2
-- Element Name - Elem3
-- Element Name - Elem4
|
Then, MRM paser generated an Error. |
|
Back to top |
|
 |
juddg |
Posted: Wed Apr 12, 2006 8:45 am Post subject: |
|
|
Apprentice
Joined: 22 Nov 2004 Posts: 33
|
Hi,
If I understand this format correctly <CR><LF>01<SP> will always appear at the beginning of the line but the A1 part is optional. In which case I suggest you try removing the Group Indicator from the inner sequence and put the Group Indicator <CR><LF>01<SP> on the outer sequence.
Regards,
juddg. |
|
Back to top |
|
 |
leo.yue |
Posted: Wed Apr 12, 2006 5:24 pm Post subject: |
|
|
Acolyte
Joined: 20 Oct 2004 Posts: 52
|
juddg, got it. Thanks.
If there is not <sp> between <CR><LF>01 and A1, just like:
Quote: |
<CR><LF>01A1 C1234 D1234 F1234
<CR><LF>02
A1 is optional |
Can I put <CR><LF>01 at the Group Indicator in the inner sequence? I tried it, but it does not work. |
|
Back to top |
|
 |
juddg |
Posted: Thu Apr 13, 2006 1:01 am Post subject: |
|
|
Apprentice
Joined: 22 Nov 2004 Posts: 33
|
Hi,
Whether there is a space after the <CR><LF>01 is not the issue. The first inner sequence is intended to consume just the optional A1 element followed by the space. That is what the regular expression (((A[^ ]{0,2})|ZZ) ) does. If you want this sequence to have a Group Indicator of <CR><LF>01 you will need to modify the regular expression to match the <CR><LF>01. For instance (\r\n01((A[^ ]{0,2})|ZZ) ). However this will only work correctly if the <CR><LF>01 is optional along with the A1 which I think is probably not the case. Am I right in thinking that if the A1 element is missing the line will look like?
Quote: |
<CR><LF>01C1234 D1234 F1234
|
If this is the case and you have the Group Indicator on the inner sequence you would need to modify the data pattern on the inner sequence to be (\r\n01(((A[^ ]{0,2})|ZZ) )?) so that it will match <CR><LF>01A1 or just <CR><LF>01 if A1 is missing. You should also set the minOccurs of the inner sequence to 1. Then you should change the minOccurs of Elem1 to be 0 and its data pattern to be [^ ]+. So if A1 is missing the inner sequence data pattern will match <CR><LF>01. This will then be treated as the Group Indicator of the sequence and as there is no data left the data pattern on Elem1 will not match so it will be handled as missing.
I hope this helps,
Regards,
juddg. |
|
Back to top |
|
 |
leo.yue |
Posted: Thu Apr 13, 2006 3:56 am Post subject: |
|
|
Acolyte
Joined: 20 Oct 2004 Posts: 52
|
juddg, you are so cool.
But I tried the following message
Quote: |
<CR><LF>01C1234 D1234
<CR><LF>F1234 |
MRM can not work normally (certainly, I have changed the message definition accordingly). I tried to update the regular expression, but... |
|
Back to top |
|
 |
juddg |
Posted: Thu Apr 13, 2006 4:26 am Post subject: |
|
|
Apprentice
Joined: 22 Nov 2004 Posts: 33
|
Hi,
Although I am happy to help you, each time I provide a suggestion you change the scenario slightly. Do you have a complete description of what you are attempting to model? In the latest scenarion the last element has been delimited by a <CR><LF> not <SP> which has caused the parse to fail. In the following post:
http://www.mqseries.net/phpBB2/viewtopic.php?t=28403
I provided you with an example of how to parse elements that maybe delimited by <SP> or <CR><LF>.
Regards,
juddg. |
|
Back to top |
|
 |
|