|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Parent's delimiter in child element's group indicator |
« View previous topic :: View next topic » |
Author |
Message
|
dino |
Posted: Wed Sep 29, 2004 6:47 am Post subject: Parent's delimiter in child element's group indicator |
|
|
Newbie
Joined: 26 Sep 2004 Posts: 6
|
Hi
Is it possible to create a TDS message where the parent group's delimiter ( , ) is enclosed within child element's group indicator and TDS parser will treat comma as a normal character if it is within the group indicator.
Message (DES ="All Element Delimited", Delimiter=",")
group1 (Group Ind=" Group Terminator=" Delimiter="<NUL>")
element1
group2 (Group Ind=" Group Terminator=" Delimiter="<NUL>")
element2
element3
element4
Test Data
"There is a comma , in this field","Another comma , here",1234,5678
Result
Message
element1 = "There is a comma , in this field"
element2 = "Another comma , here"
element3 = 1234
element4 = 5678
I tried it in WBIMBv5 CSD03 but the TDS parser will truncate at the first occurance of comma. Any idea???
 |
|
Back to top |
|
 |
shanson |
Posted: Wed Sep 29, 2004 8:51 am Post subject: |
|
|
 Partisan
Joined: 17 Oct 2003 Posts: 344 Location: IBM Hursley
|
|
Back to top |
|
 |
dino |
Posted: Thu Sep 30, 2004 7:56 am Post subject: |
|
|
Newbie
Joined: 26 Sep 2004 Posts: 6
|
Hi shanson, thanks for replying. yes i did read that discussion. However, i was not able to replicate it in WBIMBv5 CSD03 successfully. This is what i did:
msg (msgType) DES=All Elements Delimited Delimiter=, Suppress=Never
|--char1grp (complexType)
|-----**ANONYMOUS** DES=Tagged Delimited Delimiter=", Length of Tag=1
|---------char1 (xsd:string) Tag="
|--dec2 (xsd:decimal)
|--int3 (xsd:int)
TestData = "A String,BString",1234.45,1234
When I run the msgflow in debug mode, I got the following error:
Message
|--Properties
|--MQMD
|--MRM
|----char1grp
|-------char1=A String
|--ImbRecoverableException caught from worker->parserNext.
For character field (element with xsd:string), i can only input the Tag field but not the delimiter field. The delimiter has to be set in a group.
I did not try using Data Pattern method as i dont know at which level (element or group) to set the Data Pattern.
Did I set up the TDS message wrongly?? or is the TDS parser in WMQI v2.1 different from v5? |
|
Back to top |
|
 |
shanson |
Posted: Fri Oct 01, 2004 4:34 am Post subject: |
|
|
 Partisan
Joined: 17 Oct 2003 Posts: 344 Location: IBM Hursley
|
You need to use 'Use Data Pattern' as the separation. You only need (one) complex type msgtyp - you don't need char1grp. |
|
Back to top |
|
 |
dino |
Posted: Wed Oct 06, 2004 8:15 am Post subject: |
|
|
Newbie
Joined: 26 Sep 2004 Posts: 6
|
Hi,
I have been trying on the Data Pattern for the past few days. However, i still encounter exception error. I have modify my TDS msg as follows.
msg (msgType) DES=All Elements Delimited Delimiter=, Suppress=Never
|--char1 (xsd:string) Data Pattern=([A-Z]*)|([A-Z]*,[A-Z]*)|([A-Z]*"[A-Z]*)
|--dec2 (xsd:decimal)
|--int3 (xsd:int)
when the parser reads "AB,CDE",1234.56,789, there is a ImbRecoverable Exception caught from worker->parseNext error.
Is the Data Pattern correct?? |
|
Back to top |
|
 |
wooda |
Posted: Thu Oct 07, 2004 1:47 am Post subject: |
|
|
 Master
Joined: 21 Nov 2003 Posts: 265 Location: UK
|
This can be modelled using data pattern at the top level.
Exactly what you do depends on the exact nature of the message.
Q. Are the double quotes optional ? I assume they appear when they are needed (ie when the data contains comma.)
Q. Could any of the fields have the double quotes ?
Q. Can you have escaped quotes in the data as well as around the data ?
Assuming that the quotes are optional and can appear around any field. Which is the most complicated scenario then try somthing like the following :
msg (msgType) DES =Use Data Pattern
|--field1Choice(field1ChoiceType) Data Pattern = (("([^"])*")|([^,])*)
DES=Tagged Delimited Delimiter=N/A
|--sequence DES=All Elements Delimited GI=" GT=" Delimeter=N/A
|--field1(xsd:string)
|--sequence DES=All Elements Delimited Delimeter=N/A
|--field1(xsd:string)
|--field2Choice(field2ChoiceType) Data Pattern = ,(("([^"])*")|([^,])*)
DES=Tagged Delimited Delimiter=N/A
GI=,
|--sequence DES=All Elements Delimited GI=" GT=" Delimeter=N/A
|--field2(xsd:string)
|--sequence DES=All Elements Delimited Delimeter=N/A
|--field2(xsd:string)
etc. Further fields to be included follow the same template as field2.
I have successfully used something very similar to model a CSV type message before. |
|
Back to top |
|
 |
wooda |
Posted: Thu Oct 07, 2004 1:51 am Post subject: |
|
|
 Master
Joined: 21 Nov 2003 Posts: 265 Location: UK
|
The formatting went a bit awry on my last post.
Here's what it should have looked like:
Code: |
msg (msgType) DES =Use Data Pattern
|--field1Choice(field1ChoiceType) Data Pattern = (("([^"])*")|([^,])*)
DES=Tagged Delimited Delimiter=N/A
|----sequence DES=All Elements Delimited GI=" GT=" Delimeter=N/A
|------field1(xsd:string)
|----sequence DES=All Elements Delimited Delimeter=N/A
|------field1(xsd:string)
|--field2Choice(field2ChoiceType) Data Pattern = ,(("([^"])*")|([^,])*)
DES=Tagged Delimited Delimiter=N/A
GI=,
|----sequence DES=All Elements Delimited GI=" GT=" Delimeter=N/A
|------field2(xsd:string)
|----sequence DES=All Elements Delimited Delimeter=N/A
|------field2(xsd:string) |
|
|
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
|
|
|
|