| Author | Message | 
		
		  | edd | 
			  
				|  Posted: Thu Dec 01, 2016 10:41 am    Post subject: Need help in parsing a message |   |  | 
		
		  | Novice
 
 
 Joined: 18 Aug 2016Posts: 14
 
 
 | 
			  
				| Hi All, 
 Can't get my head around a requirement I have. I have to parse a message which comes in chunks of same length of groups of data having "unique tag" preceding it. The problem is these groups of data are optional and if so, then I have to populate the exact length of spaces in between preceding and the succeeding group of data. Please note that each group of data has a "unique tag".
 
 I do not have any experience with TDS format and am really struggling with it to understand and apply. Is there any way I could parse it in a TDS format and remove the tag as well from the output message?
 
 The Message would look like :
 
 [/b]ABCD<DATA>PQRS<DATA>
 
 
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mqjeff | 
			  
				|  Posted: Thu Dec 01, 2016 11:21 am    Post subject: |   |  | 
		
		  | Grand Master
 
 
 Joined: 25 Jun 2008Posts: 17447
 
 
 | 
			  
				| You should be using DFDL. 
 You can remove tags when you map from one format to another...
 
 You can tell DFDL to use spaces if the field is null.  This might be a bit difficult for numeric values.  If you don't need to break out the individual fields inside the DATA, then you can just treat it as a single string.
 
 You should consider your model to be a repeating sequence of a choice.  Each member of the choice is be indicated by one of your tags.
 _________________
 chmod  -R ugo-wx /
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | timber | 
			  
				|  Posted: Fri Dec 02, 2016 2:17 am    Post subject: |   |  | 
		
		  |  Grand Master
 
 
 Joined: 25 Aug 2015Posts: 1292
 
 
 | 
			  
				| 
  I agree; this is a no-contest. DFDL provides a full list of what it did and why. MRM TDS does not. 
	| Quote: |  
	| You should be using DFDL. |  
 
  That leaves a few questions unanswered. You need to supply some examples, (within in [c o d e] tags, please). 
	| Quote: |  
	| The problem is these groups of data are optional and if so, then I have to populate the exact length of spaces in between preceding and the succeeding group of data. Please note that each group of data has a "unique tag". |  
 
  Parsing is something that is done to the input bitstream. But you are now asking about the output message. Do you need to parse this format, or write it? Or both? 
	| Quote: |  
	| Is there any way I could parse it in a TDS format and remove the tag as well from the output message? |  |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | edd | 
			  
				|  Posted: Fri Dec 02, 2016 8:29 am    Post subject: |   |  | 
		
		  | Novice
 
 
 Joined: 18 Aug 2016Posts: 14
 
 
 | 
			  
				| 
   
	| Quote: |  
	| You need to supply some examples |  
 
 
   
	| Code: |  
	| 00ABC000000002     1234567  951QWERTYUI                                      0944602    001                                                                                                                                                                     00DEF123      ZXCVBNMK                           10Q5737                              9                                                                                                                                                                         00GHI09820101A10                           102                                                                                                                                                                                                                  01JKLMN 1367/WK51/181619                                                                                                                                                                                                                                        11POIUY 0876602                                                                                                                                                                                                                                                 41HYUJI 397250                                                                                                                                                                                                                                                  05YYYCT S1606001 |  
 The Tags here are:
 1. 00ABC
 2. 00DEF
 3. 00GHI
 4. 01JKLMN
 5. 11POIUY
 6. 41HYUJI
 7. 05YYYCT
 
 Actually I'm trying to convert the old Neon formats into now supported MRM or DFDL parsers.
 
 And yes, after parsing, I need to transform it into an xml.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mqjeff | 
			  
				|  Posted: Fri Dec 02, 2016 8:34 am    Post subject: |   |  | 
		
		  | Grand Master
 
 
 Joined: 25 Jun 2008Posts: 17447
 
 
 | 
			  
				| So 
 
   
	| Code: |  
	| <message><sequence><sequence repeats until end of file> <choice>
 <record tag=00ABC> <record fields> </record>
 <record tag=00DEF> <record fields> </record>
 ....
 ..
 </choice>
 </sequence>
 </sequence>
 </message>
 |  
 Or something similar.
 _________________
 chmod  -R ugo-wx /
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | edd | 
			  
				|  Posted: Sun Dec 11, 2016 12:57 pm    Post subject: |   |  | 
		
		  | Novice
 
 
 Joined: 18 Aug 2016Posts: 14
 
 
 | 
			  
				| Thanks mqjeff and timber, I have installed IIB v10 developer edition and created a DFDL schema for the message structure. I have created a few complex types and then added them to the main message in a sequential order. The DFDL parse test is successful  , but when I try the flow exerciser and when I deploy the application and try to pass a message, it goes to the backout failure queue. 
 I have used a compute node which turns the Flat file into an XML and the following error is being shown. Any suggestions?
 
 
 
   
	| Code: |  
	| ( <Integration_node>.<Integration server> ) The element with name ''QQQ_LineItem'' and field type ''folderType'' is not valid as the child of Root.XML or Root.XMLNSC. 
 Each child of Root.XMLNSC must represent a valid XML construct for the top level of an XML document. The only field types that are valid in this position are XMLNSC.Comment or XMLNSC.ProcessingInstruction.
 
 Ensure that the message tree is structured correctly, and that each syntax element has a valid field type.
 |  
 Please Note: "QQQ_LineItem" - this complex type contains a few more complex types within itself.[/quote]
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | fjb_saper | 
			  
				|  Posted: Mon Dec 12, 2016 5:25 am    Post subject: |   |  | 
		
		  |  Grand High Poobah
 
 
 Joined: 18 Nov 2003Posts: 20767
 Location: LI,NY
 
 | 
			  
				| The error suggests that you trying to do something like 
 
   
	| Code: |  
	| Root.XMLNSC.tag1 Root.XMLNSC.tag2
 Root.XMLNSC.tag3
 |  This would result in an invalid XML because it is missing it's XML root tag
 You need something like
 
 
   
	| Code: |  
	| Root.XMLNSC.xmlroottag.tag1 Root.XMLNSC.xmlroottag.tag2
 Root.XMLNSC.xmlroottag.tag3
 |  
 Hope it helps
  _________________
 MQ & Broker admin
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | edd | 
			  
				|  Posted: Mon Dec 12, 2016 8:15 am    Post subject: |   |  | 
		
		  | Novice
 
 
 Joined: 18 Aug 2016Posts: 14
 
 
 | 
			  
				| 
   
	| Quote: |  
	| This would result in an invalid XML because it is missing it's XML root tag |  
 Thanks fjb_saper, Fixed it with just adding a root tag in the "OutputRoot.XMLNSC.---".
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  |  |