|  | 
 
  
    | RSS Feed - WebSphere MQ Support | RSS Feed - Message Broker Support |  
 
  
	|    |  |  
  
	| TDS Parsing | « View previous topic :: View next topic » |  
  	| 
		
		
		  | Author | Message |  
		  | kirankinnu | 
			  
				|  Posted: Mon Jul 07, 2008 5:33 am    Post subject: TDS Parsing |   |  |  
		  |  Centurion
 
 
 Joined: 12 Jun 2004Posts: 128
 Location: Chicago, IL
 
 | 
			  
				| Hi, We have a requirement to parse the message in TDS format. The input format is
 A|sdfgdg|dfgdsgd|dfgdg|12345
 B|34567|56765757|q4242425|34646
 B|983454|345645645|sdfghjkfgbd|sdfhsgvbdfbg
 B|3459346534|353785345|23534554654|sdgrydfhbdfb
 A|dfgsdfg|sdhhghg|sgdvdvd|235346546
 B|sgubjsdfg|sdfgbjhdgdb|sdghbdfj|skgjbgjbfd
 B|dsfgdg|dfgdg|dfgdfgd|dfgdgd
 .
 .
 .
 .
 For each Header starting with A there r a set of line Items starting with B. But we are not sure how many. This is how I defined the Message Set
 
 For Header: All Elements Delimited, Group Terminator: <CR> , Delimiter: |
 For Line Item: All Elements Delimited, Delimiter: |
 I am stuck over here, When I mention these properties, we are able to  only parse the first set. Please do advice how to proceed from here.
 
 Thank You,
 Kiran
 |  |  
		  | Back to top |  |  
		  |  |  
		  | sridhsri | 
			  
				|  Posted: Mon Jul 07, 2008 5:59 am    Post subject: |   |  |  
		  | Master
 
 
 Joined: 19 Jun 2008Posts: 297
 
 
 | 
			  
				| From you message, it appears that they are tagged and delimited. 
 I would assume that A and B are tags. So, I would create a complex type with two elements (A of Type AType and B of BType). A occurs once and B -1 number of times.  Th parent complex type is tagged and delimited (You could use th length of tag as 1).
 
 The AType and BType complex structures are themselves all delimited.
 
 I hope this helps.
 |  |  
		  | Back to top |  |  
		  |  |  
		  | kimbert | 
			  
				|  Posted: Mon Jul 07, 2008 6:02 am    Post subject: |   |  |  
		  |  Jedi Council
 
 
 Joined: 29 Jul 2003Posts: 5543
 Location: Southampton
 
 | 
			  
				| The A and B are tags, so you should be using Tagged Delimited, not All Elements Delimited. - Set 'Tag Data Separator' to '|'
 - On the Header element, set the 'Tag' property to 'A'
 - On the 'LineItem' element, set it to 'B'
 - Make sure that 'LineItem' has maxOccurs set to -1 and Repeating Element Delimiter set to <CR>
 |  |  
		  | Back to top |  |  
		  |  |  
		  | kirankinnu | 
			  
				|  Posted: Mon Jul 07, 2008 10:34 am    Post subject: |   |  |  
		  |  Centurion
 
 
 Joined: 12 Jun 2004Posts: 128
 Location: Chicago, IL
 
 | 
			  
				| With the Tags we are able to parse the First Set i.e., 
 A.....
 B....
 B.....
 B.....
 B....
 
 But after that for the second set we are getting error. How does the broker recognize the start of second set. Here are the properties I mentioned.
 
 Complex Type A: Tagged Demilited, Dimiter: |, Tag Data Seperator: | & Tag : A
 Complex Type B: Tagged Demilited, Dimiter: |, Tag Data Seperator: | & Tag : B, Repeating ElementDelimiter: <LF>
 
 Complex Type C contains A(1) & B(1...n) All Elements Delimited, Delimiter: <LF>. At the element level Repeating Element Delimiter: <LF>
 
 We are not sure of complex type C, Which Data Element Seperation should we select.
 
 Thank you for the support,
 Kiran
 |  |  
		  | Back to top |  |  
		  |  |  
		  | sridhsri | 
			  
				|  Posted: Mon Jul 07, 2008 10:51 am    Post subject: |   |  |  
		  | Master
 
 
 Joined: 19 Jun 2008Posts: 297
 
 
 | 
			  
				| From your note, I am assuming that you have the sequence of Header(once) and Records(-1) repeat -1 times. If that is indeed the case, you could try 
 Complex Type C
 ->Sequence (-1 times)
 Header (1) of HeaderType
 Records(-1) of RecordType
 
 For you other question, Complex Type C (or in this case sequence) would be tagged and delimited. HeaderType and RecordType can just be All Elements Limited.
 |  |  
		  | Back to top |  |  
		  |  |  
		  | kimbert | 
			  
				|  Posted: Mon Jul 07, 2008 11:19 am    Post subject: |   |  |  
		  |  Jedi Council
 
 
 Joined: 29 Jul 2003Posts: 5543
 Location: Southampton
 
 | 
			  
				| Just to make that completely clear, you need this: 
 
   
	| Code: |  
	| Element name="Message" ComplexType DataElementSeparation="Tagged Delimited", Delimiter="<LF>", Tag Data Separator="|"
 Group  DataElementSeparation="Tagged Delimited", Delimiter="<LF>", GroupTerminator="<LF>", Tag Data Separator="|", maxOccurs=-1
 Element name="Header", Tag="A", minOccurs=1, maxOccurs=1
 ComplexType DataElementSeparation="All Elements Delimited", Delimiter="|",
 Element name="headerField1" ...
 Element name="headerField2" ...
 Element name="LineItem", Tag="B" RepeatingElementDelimiter="<LF.>", minOccurs=0, maxOccurs=-1
 ComplexType DataElementSeparation="All Elements Delimited", Delimiter="|",
 Element name="lineItemField1" ...
 Element name="lineItemField2" ...
 
 |  |  |  
		  | Back to top |  |  
		  |  |  
		  | kirankinnu | 
			  
				|  Posted: Mon Jul 07, 2008 11:43 am    Post subject: |   |  |  
		  |  Centurion
 
 
 Joined: 12 Jun 2004Posts: 128
 Location: Chicago, IL
 
 |  |  
		  | 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
 
 |  |  |  |