| Author | 
		  Message
		 | 
		
		  | whydieanut | 
		  
		    
			  
				 Posted: Thu Jul 12, 2012 2:00 am    Post subject: Parsing IATA/SITA Type B Messages | 
				     | 
			   
			 
		   | 
		
		
		    Disciple
 
 Joined: 02 Apr 2010 Posts: 186
  
  | 
		  
		    
			  
				Hi all,
 
 
I am trying to read data from an Airlines system, SITA.
 
The data is being sent in IATA standard Type B Message formats.
 
Is anyone aware of any mechanism to parse these kind of (IATA's Type B) messages?
 
 
Below is a sample message called an LDM Message.
 
 
   
	| Code: | 
   
  
	QD FRAOWSB FRAKZSB ISTUSXH FRASPSB
 
.ESBUSXH SB/091315SB
 
LDM
 
RAT0123/09. ECENZ.F0/C42/Y108.2/6
 
-DUS.0/42/86.T.550.2/440.4/110 PAX/128 B/440 C/110
 
.PAD/0/0/1
 
.HEA/1/110
 
SI NIL | 
   
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Thu Jul 12, 2012 2:07 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				| I'm sure it's easy to write a DFDL model for this.  Have you tried? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | whydieanut | 
		  
		    
			  
				 Posted: Thu Jul 12, 2012 2:16 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Disciple
 
 Joined: 02 Apr 2010 Posts: 186
  
  | 
		  
		    
			  
				I haven't tried it yet, as I am not aware of the nuances of these formats.
 
So I was wondering if there is any existing standard way to create a Message Set for such messages.
 
Maybe something similar to how a COBOL Copybook can be used...
 
 
Not sure if I wanna take the brute force approach yet... | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | whydieanut | 
		  
		    
			  
				 Posted: Thu Jul 12, 2012 2:18 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Disciple
 
 Joined: 02 Apr 2010 Posts: 186
  
  | 
		  
		    
			  
				| Also, I am on WMB 7.0.0.3 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Thu Jul 12, 2012 2:22 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				First question is : does the standards body defining these standards produce anything that can be used?  Presumably they don't produce an XSD....   But if they have sample code that has a C header, you can import that.
 
 
Yes, I figured you weren't using v8, but you didn't say so I took the optimistic approach... v7 is better than I expected, though...  
 
 
Otherwise, you can either build the message set by hand, or define cobol copybooks that define the messages and import those...
 
 
I've forgotten the finder details of contacting the dublin lab to see if you can get an industry solution (that would likely be a paid solution...), but hopefully kimbert or mgk can remind us all. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | whydieanut | 
		  
		    
			  
				 Posted: Thu Jul 12, 2012 2:27 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Disciple
 
 Joined: 02 Apr 2010 Posts: 186
  
  | 
		  
		    
			  
				Really hate having to build it by hand.
 
Mainly because I am not sure I can test it thoroughly enough.
 
Plus there are more than 2-3 different types of messages to model here.
 
 
So was looking for a more graceful option.
 
 
As for trying to find info on the actually standard, my fingers are tired from trying out all combinations of search terms into Google!
 
   | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | whydieanut | 
		  
		    
			  
				 Posted: Thu Jul 12, 2012 3:26 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Disciple
 
 Joined: 02 Apr 2010 Posts: 186
  
  | 
		  
		    
			  
				mqjeff,
 
Can you provide some pointers as to how I might start building this by hand?
 
 
Like the Message Domain, etc. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Thu Jul 12, 2012 3:48 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				It doesn't appear to be XML, so you can't use XMLNSC...
 
 
You're not using v8, so you can't use DFDL.
 
 
That means MRM.
 
 
In general, TDS is more flexible and usable than CWF.
 
 
I don't know the data formats you're talking about, so I can't be *any* more help. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | whydieanut | 
		  
		    
			  
				 Posted: Thu Jul 12, 2012 4:01 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Disciple
 
 Joined: 02 Apr 2010 Posts: 186
  
  | 
		  
		    
			  
				For the below sample message:
 
 
   
	| Code: | 
   
  
	
 
QU JPSZZAI                                                                      
 
.BOMRCAI 121049                                                                 
 
LDM                                                                             
 
AI101/10.VTALQ.F4C35Y303.2/13                                                   
 
-CDG.22/9/0/3.0.T1895.3/925.4/874.5/96                                          
 
.PAX/0/1/30.PAD/0/0/0           
 
 | 
   
 
 
The 1st 3 lines can be ignored.
 
The fourth line (AI101/10.VTALQ.F4C35Y303.2/13) has to be split into 
 
 
   
	| Code: | 
   
  
	
 
FlightNo: AI101
 
Date (day): 10
 
Aircraft: VTALQ
 
Seats:
 
  F:4
 
  C:35
 
  Y:303
 
  Deck: 2
 
  Cabin: 13
 
 | 
   
 
 
 
 
I have a complex field with the above line (4th) in it.
 
This has to now be split into the above structure.
 
Any pointers as to how go about from here? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Thu Jul 12, 2012 4:47 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				| That appears to be a mix of tags and delimiters. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | smdavies99 | 
		  
		    
			  
				 Posted: Thu Jul 12, 2012 9:57 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land. 
  | 
		  
		    
			  
				If yiou had attended the Websphere User Group Meeting at IBM today you would have heard the venerable 'Kimbert' tell the assembled masses exactly how this problem might be solved with DFDL. 
 
 
Good luck the the 'free text' areas. _________________ WMQ User since 1999
 
MQSI/WBI/WMB/'Thingy' User since 2002
 
Linux user since 1995
 
 
 
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Thu Jul 12, 2012 11:36 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				
   
	| Quote: | 
   
  
	| the venerable 'Kimbert' | 
   
 
I resent the term 'venerable' because in my mind it is linked with words like 'old', 'grey' and 'past it'. Not all of those are valid accusations. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | smdavies99 | 
		  
		    
			  
				 Posted: Thu Jul 12, 2012 11:43 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land. 
  | 
		  
		    
			  
				I think I'm allowed to say that because you are younger than me   
 
 
Some might say that I'm old, grey and past it but hardly venerable. _________________ WMQ User since 1999
 
MQSI/WBI/WMB/'Thingy' User since 2002
 
Linux user since 1995
 
 
 
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Thu Jul 12, 2012 12:18 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				| whydieanut: I could certainly help you to develop a message model for the particular example that you posted. Let me know if that would help. However...if you need to generate a set of message definitions for the entire IATA Type B standard then you would be *far* better off using WMB v8 and DFDL. Why? Because DFDL is an open standard with a published format for the xsds. You could write a program that emits the DFDL xsds for the IATA messages. Much easier than hand-crafting all the MRM definitions. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | whydieanut | 
		  
		    
			  
				 Posted: Thu Jul 12, 2012 10:18 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Disciple
 
 Joined: 02 Apr 2010 Posts: 186
  
  | 
		  
		    
			  
				Is that line a good use case for using Data Pattern?
 
 
Edit: Sorry, didn't see the posts from today.
 
 
@kimbert,
 
I suppose I only have to work with a couple of formats, not ALL of them.
 
 
The one that I am currently working on is called an LDM Message.
 
Am posting a sample message below:
 
 
   
	| Code: | 
   
  
	
 
QU JPSZZAI                                                                      
 
.BOMRCAI 121049                                                                 
 
LDM                                                                             
 
AI101/10.VTALQ.F4C35Y303.2/13                                                   
 
-CDG.22/9/0/3.0.T1895.3/925.4/874.5/96                                          
 
.PAX/0/1/30.PAD/0/0/0                                                           
 
-JFK.145/90/14/5.0.T13027.1/3112.2/1101.3/6902.4/898.5/1014                                                                         
 
.PAX/0/17/232.PAD/0/2/9                                                         
 
SI                                                                              
 
CDG B/1175.C/624.M/96.E/NIL                                                     
 
JFK B/10271.C/2101.M/655.E/NIL                                                  
 
 CAPT VIJAY PRATAP                                                              
 
 05 DEGREE FLAPS FOR STAB TRIM                                                  
 
 STAB TRIM AT 15 DEGREE FLAPS --                                                
 
 
;
 
 | 
   
 
 
 
 
Explanation of the various elements:
 
 
The first 3 lines contain header info and are easy to parse.
 
This is done.
 
   
	| Code: | 
   
  
	QU JPSZZAI
 
.BOMRCAI 121049
 
LDM | 
   
 
 
 
The fourth line is a complex structure consisting of delimiter separated elements, again easy to parse
 
This is done.
 
   
	| Code: | 
   
  
	| AI101/10.VTALQ.F4C35Y303.2/13 | 
   
 
 
 
The fifth line onwards, there is a specific pattern.
 
Each pair of lines contain data for each leg of a flight. These pairs can be repeated (unbounded)
 
So in the above sample, there are 2 legs (one upto CDG and another upto JFK)
 
How do I go about splitting these pairs of lines? Just getting each pair of lines into a some kind of a complex element would do. From there, they can be further parsed.
 
   
	| Code: | 
   
  
	-CDG.22/9/0/3.0.T1895.3/925.4/874.5/96
 
.PAX/0/1/30.PAD/0/0/0
 
 
-JFK.145/90/14/5.0.T13027.1/3112.2/1101.3/6902.4/898.5/1014
 
.PAX/0/17/232.PAD/0/2/9 | 
   
 
 
 
After these pairs is another delimiter
 
 
 
Below this delimiter are rows for baggage and cargo entries for each leg of the flight
 
   
	| Code: | 
   
  
	CDG B/1175.C/624.M/96.E/NIL
 
JFK B/10271.C/2101.M/655.E/NIL | 
   
 
 
 
After these are (I believe) repeating lines of free text. But these can be ignored.
 
   
	| Code: | 
   
  
	 CAPT VIJAY PRATAP
 
 05 DEGREE FLAPS FOR STAB TRIM
 
 STAB TRIM AT 15 DEGREE FLAPS --
 
 
; | 
   
 
 
 
 
 
Here is what I have so far:
 
   
	| Code: | 
   
  
	
 
MRM
 
   H1
 
         H1.1:CHARACTER:QU
 
         H1.2:CHARACTER:JPSZZAI
 
   H2
 
         H2.1:CHARACTER:.BOMRCAI
 
         H2.2:CHARACTER:121049
 
   MSG_TYPE:CHARACTER:LDM
 
   H4
 
         H4.1
 
               FLTNO:CHARACTER:AI101
 
               DAY:CHARACTER:10
 
         TAILNO:CHARACTER:VTALQ
 
         SEAT_CAPACITY
 
               CLASS1
 
                     CLASS:CHARACTER:F
 
                     SEATS:CHARACTER:4
 
               CLASS2
 
                     CLASS:CHARACTER:C
 
                     SEATS:CHARACTER:35
 
               CLASS3
 
                     CLASS:CHARACTER:Y
 
                     SEATS:CHARACTER:303
 
         H4.3
 
               CD:CHARACTER:2
 
               CC:CHARACTER:13
 
 | 
   
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |