Author |
Message
|
mailtogowdhami |
Posted: Wed Jun 22, 2011 4:21 am Post subject: TDS issue |
|
|
Newbie
Joined: 22 Jun 2011 Posts: 7
|
hi friends ,
i need ur help to solve my issue
The following is the Message for which i need to create messageSet
For Example consider BKT,BKS,BKI and the numbers which are in BOLD are constant other values are variable.
BKT06,BKS24,BKS30,BKS39,BKS46,BKI63 are constant values
How to split it using MessageSet?
the fields are based on Fixed Length
<LF> is the end line character
The Structure for BKS24,BKS30,BKS39 varies
if i use Tagged Fixed Length , then i can only split it only with BKS but not BKS 24
If BKS24,BKS39 is mandatory and BKS30 is optional then the Structure of BKS39 will try to sit in the Structure of BKS30
PLZ provide a solution
BKT0000000406 000001 016X 065 AGTD00000000 00000000 00000000
BKS00000005241106120000010652409140113 27906016453306072FSFV 09991284 TKTTCAICAI 5ZSA9W
BKS00000006301106120000010652409140113 20000005160{0000000000{ JK 0000000084AQH 0000000150{0000005964H0000000000{ USD2
BKS00000007301106120000010652409140113 20000000000{0000000000{ XK 0000000252DEQ 0000000010{0000000000{0000000000{ USD2
BKS00000008301106120000010652409140113 20000000000{0000000000{ EG 0000000168CUR 0000000140{0000000000{0000000000{ USD2
BKS00000009391106120000010652409140113 2I 000000000000000{ 000000000000000{000000000000000{0000000000{ USD2
BKS00000010461106120000010652409140113 2 FEES / CHARGE APPLY TO ALL TICKETS PLEASE
BKS00000011461106120000010652409140113 2 VISITSAUDIAIRLINES.COM/T/
BKI00000012631106120000010652409140113 21O CAI DMM SV 0320 X 22JUN 1745 OK40K XRTSVR SV18995981
BKI00000013631106120000010652409140113 23O RUH CAI SV 0311 J 02JUL 0755 OK45K JRTSVR SV18995981
Thanks in Advance !!! |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jun 22, 2011 4:45 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
There are a couple of different ways to do it.
Your main message can either be a tagged-fixed length that models the BKT/BKS, and then contains another tagged-fixed length that models the 04/24/etc.
Or your main message can be a sequence of a tagged-fixed length that models the BKT/BKS, and then followed by another tagged-fixed length that models the 04/24/etc. |
|
Back to top |
|
 |
mailtogowdhami |
Posted: Wed Jun 22, 2011 4:51 am Post subject: |
|
|
Newbie
Joined: 22 Jun 2011 Posts: 7
|
Thanks for the Reply !!!
But the elements Structure for BKT06,BKS24,BKS30 etc are Different |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jun 22, 2011 5:04 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
mailtogowdhami wrote: |
Thanks for the Reply !!!
But the elements Structure for BKT06,BKS24,BKS30 etc are Different |
Yes, I agree. Tagged-Fixed Length can be used to model records that have different fixed lengths, as long as all records are actually fixed in length.
What I'm saying is think of it as BKT,BKS as separately from 06,24,30,etc.
If you really need to ensure that you only see an 06 inside a BKT, then you need to use the nested choice. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jun 22, 2011 6:54 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
You need something like this. Not tested, but this should set you on the right track.
Code: |
element name="message"
complexType dataElementSeparation="Tagged Fixed Length" TagLength="3"
element name="el_BKT" tag="BKT"
complexType dataElementSeparation="Tagged Fixed Length" TagLength="3"
sequence dataElementSeparation="Fixed Length"
element name="el_8_chars" length="8"
sequence dataElementSeparation="Tagged Fixed Length" tagLength="2"
element name="el_06" tag="06"
complexType dataElementSeparation="Fixed Length"
element name="el_06.1" length="6"
element name="el_06.2" length="2"
...
element name="el_BKS" tag="BKS"
complexType dataElementSeparation="Tagged Fixed Length" TagLength="3"
sequence dataElementSeparation="Fixed Length"
element name="el_8_chars" length="8"
choice dataElementSeparation="Tagged Fixed Length" tagLength="2"
element name="el_24" tag="24"
complexType dataElementSeparation="Fixed Length"
element name="el_24.1" length="6"
element name="el_24.2" length="2"
...
element name="el_30" tag="30"
...
element name="el_39" tag="39"
...
element name="el_46" tag="46"
...
element name="el_BKI" tag="BKI"
complexType dataElementSeparation="Tagged Fixed Length" TagLength="3"
sequence dataElementSeparation="Fixed Length"
element name="el_8_chars" length="8"
sequence dataElementSeparation="Tagged Fixed Length" tagLength="2"
element name="el_63" tag="63"
complexType dataElementSeparation="Fixed Length"
element name="el_63.1" length="6"
element name="el_63.2" length="2"
...
|
|
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jun 22, 2011 6:58 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
kimbert wrote: |
You need something like this. Not tested, but this should set you on the right track. |
It's a start, but it appears to be missing choices.
So it will model the exact message shown, but will not allow TDS to use the tags to resolve the type of the element that is presented regardless of the order.
I say this to mention it to mailtogowdhami, not to suggest that kimbert has said anything wrong. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jun 22, 2011 7:22 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Good point. I was assuming that
- BKT is a header element that always occurs first,
- BKS is a body with different inner elements ( 24,30,39,46 ). There is an inner choice for the different inner elements.
- BKI is a trailer element that always occurs last
If BKT, BKS and BKI can occur in any order, just set the Composition property on the outermost complex type to 'Choice'. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jun 22, 2011 7:26 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
kimbert wrote: |
Good point. I was assuming that
- BKT is a header element that always occurs first,
- BKS is a body with different inner elements ( 24,30,39,46 ). There is an inner choice for the different inner elements.
- BKI is a trailer element that always occurs last
If BKT, BKS and BKI can occur in any order, just set the Composition property on the outermost complex type to 'Choice'. |
I was assuming that there were more possibilities for subtypes of BKT and BKI than the one shown, and you didn't indicate that BKS or BKI can repeat. |
|
Back to top |
|
 |
mailtogowdhami |
Posted: Wed Jun 22, 2011 8:51 pm Post subject: |
|
|
Newbie
Joined: 22 Jun 2011 Posts: 7
|
Thanks for the reply !!!
this is what i did
<xsd:complexType name="BKS39_Element_tag_BKS">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsStructRep dataElementSeparation="TaggedFixedLength" messageSetDefaultRep="Text1" tagLength="3"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="SMSG_BKS39_try" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsElemRep length="8" messageSetDefaultRep="Text1" precision="-1" tag="BKS"/>
[BKS00000009391106120000010652409140113 2I 000000000000000{ 000000000000000{000000000000000{0000000000{ USD2
SMSG_BKS39_try will have value 00000009]
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="BKS39_Element_tag_39">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsStructRep dataElementSeparation="TaggedFixedLength" messageSetDefaultRep="Text1" tagLength="2"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="STNQ_try_Remain" type="BKS39_try_Remain">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsElemRep messageSetDefaultRep="Text1" precision="-1" tag="39"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="BKS39_Reamining_Elements">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsStructRep groupTerminator="<LF>" messageSetDefaultRep="Text1"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="DAIS">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="6"/>
<xsd:pattern value="[0-9]*"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="TRNN">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="6"/>
<xsd:pattern value="[0-9]*"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
.
.
.
.
The issue is,
BKS24 occurance is 1-1 BKS 30 occurance is 0-n BKS39 occurance is 1-n
in this case, if BKS 30 is not present in the input message, the messageset has in the order BKT06,BKS24,BKS30,BKS39,BKS46.... will check for TAG BKS first coz the first element tag for both BKS 30,39 is BKS(if the tags BKS,BKT are different then there is no issues but here we have same tag BKS for many times). then it will go for the second element tag where the second element tag for both differs as 30,39. after the messageset parse the second element it understands tat this is not for 39and it actually goes to BKS 39 which is present in the messageset,
here comes the problem since the first element in the messageset is parsed in BKS 30, it is expecting for the remaing elements in that group which is not actually present , so exception is thrown |
|
Back to top |
|
 |
mailtogowdhami |
Posted: Wed Jun 22, 2011 8:54 pm Post subject: |
|
|
Newbie
Joined: 22 Jun 2011 Posts: 7
|
The Structure for each BKS varies so i cant club tat into single group
Please bare with me
Im new to MB !!!  |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jun 23, 2011 1:21 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You need to stop thinking of them as BKS 29 and BKS 30. and etc.
You have an outer structure that controls how many times and in what order you see ANY KIND OF BKS, BKT, and BKI records.
You then have an inner structure in each of those that controls how many times, in what order, and what the structure of each 39, 24, etc. records will occur.
That should help you figure this out better. And, again, it is okay if a 39 record has a different length (structure) than a 29 record, as long as both are either Tagged-Fixed Length. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jun 23, 2011 3:39 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
The TDS parser can parse your data format OK, but it will be very difficult ( perhaps impossible ) to encode these rules:
Quote: |
BKS24 occurance is 1-1 BKS 30 occurance is 0-n BKS39 occurance is 1-n |
...in the TDS message model. The problem is that the identifier is not positioned at the start of the BKS structure.
You may have to settle for this:
- The MRM parser parses any valid input.
- BKS24, BKS30, BKS39 etc are all modelled as 'BKS' ( see my suggested model ). The contents are different, and the message flow can inspect the name of the child element to see which variant of BKS it is dealing with.
- The MRM parser accepts some invalid inputs without complaining. For instance, it will not complain if there is more than one BKS24, and it will not complain if there are 0 occurrences of BKS39.
If you need to enforce the logical validation rules, you could do that using some ESQL/Java/XPath/PHP later in the flow. |
|
Back to top |
|
 |
mailtogowdhami |
Posted: Thu Jun 23, 2011 3:51 am Post subject: |
|
|
Newbie
Joined: 22 Jun 2011 Posts: 7
|
Thanks Kimbert u understood my issue !!!
wt i did to solve this issue is , i Removed the values present in between BKS and 39
[BKS00426455391106130360940654032434240 2I 0000000000000000 0000000000000000000000000000000000000000000 YER0
] as BKS391106130360940654032434240 2I 0000000000000000 0000000000000000000000000000000000000000000 YER0
using ESQL and used BKS 39 as TAG in the MessageSet
Thanks mqjeff !!!
u guys took so much pain to solve my issue !!!  |
|
Back to top |
|
 |
|