|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Catching undefined elements in UnorderedSet |
« View previous topic :: View next topic » |
Author |
Message
|
micke2meter |
Posted: Fri May 09, 2008 4:19 am Post subject: Catching undefined elements in UnorderedSet |
|
|
Newbie
Joined: 11 Oct 2006 Posts: 2
|
I have a problem with a TDS EDI message set where I can expect to receive undefined tags anywhere in the message whithout parser error.
I have defined a message as UnorderedSet including 5 different elements; TAG1, TAG2, TAG3, TAG4 and UNKNOWN.
TAG1 = Tagged Delimited, Delimiter "," and Tag "TAG1"
TAG2 = Tagged Delimited, Delimiter "," and Tag "TAG2"
TAG3 = Tagged Delimited, Delimiter "," and Tag "TAG3"
TAG4 = Tagged Delimited, Delimiter "," and Tag "TAG4"
UNKNOWN = Tagged Delimited, Delimiter "<CR><LF>" and Data Pattern "[A-Z]{4}" This should catch all undefined tags.
Each of the elements above contains a string element named DATA that can appear multiple times.
Example message:
TAG1
1,2,3,,,4
TAG3
,,,,,3
TAG2
1,2,3,4,,
TAG?
Unknown data in this tag,,,2,
TAG4
,4,,,,4
When parsing the message the result is:
MRM
+ TAG1 // Correct
| +- DATA = 1
| +- DATA = 2
| +- DATA = 3
| +- DATA =
| +- DATA =
| +- DATA = 4
+ TAG3 // Correct
| +- DATA =
| +- DATA =
| +- DATA =
| +- DATA =
| +- DATA =
| +- DATA = 3
+ TAG2 // Correct
| +- DATA = 1
| +- DATA = 2
| +- DATA = 3
| +- DATA = 4
| +- DATA =
| +- DATA =
+ UNKNOWN // Correct
| +- DATA = TAG?
| +- DATA = Unknown data in this tag,,,2,
+ UNKNOWN // Incorrect!!!! Should be TAG4
| +- DATA = TAG4
| +- DATA = ,4,,,,4
The probleme here is that every tag occuring after an unknown tag is parsed as UNKNOWN when I want it to be parsed as the defined TAG4 as it is.
If i make the first tag in the message an unknown tag (like "TAGX"), then every tag in the message will be parsed as UNKNOWN.
Also, if I set the first element in the message set definition the UNKNOWN element the result is also every tag parsed as UNKNOWN.
I expect the parser to search the defined elements fron the first element to the last for all tags.
But when it finds any tag matching the UNKNOWN element then all tags after that one is also recognized as UNKNOWN, how could that be ...
Thanks |
|
Back to top |
|
 |
kimbert |
Posted: Mon May 12, 2008 1:05 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
UnorderedSet is the wrong option here. You need a repeating choice, with UNKNOWN as the last option in the choice. |
|
Back to top |
|
 |
micke2meter |
Posted: Mon May 12, 2008 3:01 am Post subject: |
|
|
Newbie
Joined: 11 Oct 2006 Posts: 2
|
kimbert wrote: |
UnorderedSet is the wrong option here. You need a repeating choice, with UNKNOWN as the last option in the choice. |
Yes, this will fix the parsing. I have tried it, but then there's another problem as I see it. I need restrictions on occurencies, is that even possible when using choice? For example, TAG1 [0..1], TAG2 [1..-1], TAG3 [1..1], TAG4 [1..1] and UNKNOWN [0..-1]. Could this be done? |
|
Back to top |
|
 |
kimbert |
Posted: Mon May 12, 2008 11:42 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
OK, I understand the problem now, but I can't think of a way to make the MRM parser do what you require. The only thing i can suggest is to use a repeating choice, and apply the validation in your ESQL. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon May 12, 2008 11:44 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Um... This should be possible with a choice of sequences, where each sequence holds a choice of one repeating element? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kimbert |
Posted: Mon May 12, 2008 3:11 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Jeff's suggestion is worth a try. I discounted it, but maybe I was too hasty. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|