|   | 
	 
  
    | 
RSS Feed - WebSphere MQ Support
 | 
RSS Feed - Message Broker Support
 |   
 
  
	     | 
	 | 
   
 
  
	|  Trailing blank in fixed lenght format in DFDL model | 
	« View previous topic :: View next topic »  | 
   
  
  	
	  
		
		
		  | Author | 
		  Message
		 |  
		
		  | ediman | 
		  
		    
			  
				 Posted: Wed Jun 12, 2013 12:41 am    Post subject: Trailing blank in fixed lenght format in DFDL model | 
				     | 
			   
			 
		   | 
		 
		
		   Newbie
 
 Joined: 05 Jun 2013 Posts: 9
  
  | 
		  
		    
			  
				Hi,
 
I have another little problem while migrating from MRM in Wmb6 to DFDL in Wmb8.
 
 
We read input messages from a MQ queue as flat file with fixed lenght records, and some fields can have trainling blanks.
 
I need to keep this characters in the message tree because some output fields are fixed substrings of this fields or a concatenation of fixed substrings of two or more fields.
 
 
In MRM model that was not a problem, as you can see in trace
 
 
 
 
   
	| Code: | 
   
  
	
 
2013-06-12 09:16:52.736128       18   UserTrace   BIP4060I: Data ''*****************************************************
 
                                       Letto messaggio in coda
 
                                       ( ['mrm' : 0x25d09a0]
 
                                         (0x01000013:Name+):Testata = (
 
                                           (0x01000013:Name+     ):Adial                       = (
 
                                             (0x0300000B:NameValue+):Progressivo = '000001' (CHARACTER)
 
                                             (0x0300000B:NameValue+):Source      = '2400' (CHARACTER)
 
                                             (0x0300000B:NameValue+):NomeFlusso  = 'VEFA-DOCALT   ' (CHARACTER)
 
                                             (0x0300000B:NameValue+):MaggTo      = ' ' (CHARACTER)
 
                                           )
 
                                           (0x0300000B:NameValue+):TipoRecord                  = '01' (CHARACTER)
 
                                           (0x0300000B:NameValue+):DocId                       = '0003675866' (CHARACTER)
 
                                           (0x0300000B:NameValue+):ScanId                      = '            ' (CHARACTER)
 
                                           (0x0300000B:NameValue+):CodFoam                     = '00027384' (CHARACTER)
 
                                           (0x0300000B:NameValue+):Societa                     = '0004' (CHARACTER)
 
                                           (0x0300000B:NameValue+):Pdv                         = '0080' (CHARACTER)
 
                                           (0x0300000B:NameValue+):TipoDocumento               = '0' (CHARACTER)
 
                                           (0x0300000B:NameValue+):NumeroDocumento             = '11004208        ' (CHARACTER)
 
                                           (0x0300000B:NameValue+):DataDocumento               = DATE '2011-02-21' (DATE)
 
                                           (0x0300000B:NameValue+):TotaleDocumento             = 6581.20 (DECIMAL)
 
                                           (0x0300000B:NameValue+):RegistroIva                 = '    ' (CHARACTER)
 
                                           (0x0300000B:NameValue+):DataRegistrazioneProtocollo = '        ' (CHARACTER)
 
                                           (0x0300000B:NameValue+):NrProtocolloIva             = '          ' (CHARACTER)
 
                                           (0x0300000B:NameValue+):DataArrivoFattura           = '        ' (CHARACTER)
 
                                           (0x0300000B:NameValue+):DataInvioFattura1           = '        ' (CHARACTER)
 
                                           (0x0300000B:NameValue+):DataRicevimentoFattura      = '        ' (CHARACTER)
 
                                           (0x0300000B:NameValue+):DataInvioFattura2           = '        ' (CHARACTER)
 
                                           (0x0300000B:NameValue+):CodiceContabile             = '          ' (CHARACTER)
 
                                           (0x0300000B:NameValue+):CodiceContabileTransitorio  = '          ' (CHARACTER)
 
                                         )
 
                                         (0x01000013:Name+):Iva     = (
 
                                           (0x01000013:Name+     ):Adial      = (
 
                                             (0x0300000B:NameValue+):Progressivo = '000002' (CHARACTER)
 
                                             (0x0300000B:NameValue+):Source      = '2400' (CHARACTER)
 
                                             (0x0300000B:NameValue+):NomeFlusso  = 'VEFA-DOCALT   ' (CHARACTER)
 
                                             (0x0300000B:NameValue+):MaggTo      = ' ' (CHARACTER)
 
                                           )
 
                                           (0x0300000B:NameValue+):TipoRecord = '03' (CHARACTER)
 
                                           (0x0300000B:NameValue+):DocId      = '0003675866' (CHARACTER)
 
                                           (0x0300000B:NameValue+):Imponibile = 5484.33 (DECIMAL)
 
                                           (0x0300000B:NameValue+):CodiceIva  = '20  ' (CHARACTER)
 
                                           (0x0300000B:NameValue+):Imposta    = 1096.87 (DECIMAL)
 
                                         )
 
                                       )
 
                                       *****************************************************
 
 | 
   
 
 
 
In DFDL editor of Wmb8 I defined a string field, i.e. "Numero Documento", in this way
 
 
 
Representation -> Text
 
Length Kind -> Explicit
 
Length -> 16
 
Length Units -> Characters
 
Nillable -> False
 
Default Value -> <unset>
 
Fixed Value -> <unset>
 
String Giustification -> Left
 
String Pad Character -> %SP;
 
Truncate Specified Length -> no
 
Pad Kind -> padChar
 
Trim Kind -> padChar
 
 
 
 
However in message logical tree trailing blanks are deleted as you can see in trace
 
 
   
	| Code: | 
   
  
	
 
2013-06-12 09:20:38.706184       18   UserTrace   BIP4060I: Data ''*****************************************************
 
                                       Letto messaggio in coda
 
                                       ( ['dfdl' : 0x7f993804dba0]
 
                                         (0x01000000:Name):VefaDocAlt = (
 
                                           (0x01000000:Name):Testata = (
 
                                             (0x01000000:Name     ):Adial                       = (
 
                                               (0x03000000:NameValue):Progr      = '000001' (CHARACTER)
 
                                               (0x03000000:NameValue):Source     = '2400' (CHARACTER)
 
                                               (0x03000000:NameValue):NomeFlusso = 'VEFA-DOCALT' (CHARACTER)
 
                                               (0x03000000:NameValue):MAggTo     = '' (CHARACTER)
 
                                             )
 
                                             (0x03000000:NameValue):TipoRecord                  = '01' (CHARACTER)
 
                                             (0x03000000:NameValue):DocId                       = '0003675866' (CHARACTER)
 
                                             (0x03000000:NameValue):ScanId                      = '' (CHARACTER)
 
                                             (0x03000000:NameValue):CodFoam                     = '00027384' (CHARACTER)
 
                                             (0x03000000:NameValue):Societa                     = '0004' (CHARACTER)
 
                                             (0x03000000:NameValue):Pdv                         = '0080' (CHARACTER)
 
                                             (0x03000000:NameValue):TipoDocumento               = '0' (CHARACTER)
 
                                             (0x03000000:NameValue):NumeroDocumento             = '11004208' (CHARACTER)
 
                                             (0x03000000:NameValue):DataDocumento               = DATE '2011-02-21' (DATE)
 
                                             (0x03000000:NameValue):TotaleDocumento             = 6581.20 (DECIMAL)
 
                                             (0x03000000:NameValue):RegistroIva                 = '' (CHARACTER)
 
                                             (0x03000000:NameValue):DataRegistrazioneProtocollo = '' (CHARACTER)
 
                                             (0x03000000:NameValue):NrProtocolloIva             = '' (CHARACTER)
 
                                             (0x03000000:NameValue):DataArrivoFattura           = '' (CHARACTER)
 
                                             (0x03000000:NameValue):DataInvioFattura1           = '' (CHARACTER)
 
                                             (0x03000000:NameValue):DataRicevimentoFattura      = '' (CHARACTER)
 
                                             (0x03000000:NameValue):DataInvioFattura2           = '' (CHARACTER)
 
                                             (0x03000000:NameValue):CodiceContabile             = '' (CHARACTER)
 
                                             (0x03000000:NameValue):CodiceContabileTransitorio  = '' (CHARACTER)
 
                                           )
 
                                           (0x01000000:Name):Iva     = (
 
                                             (0x01000000:Name     ):Adial      = (
 
                                               (0x03000000:NameValue):Progr      = '000002' (CHARACTER)
 
                                               (0x03000000:NameValue):Source     = '2400' (CHARACTER)
 
                                               (0x03000000:NameValue):NomeFlusso = 'VEFA-DOCALT' (CHARACTER)
 
                                               (0x03000000:NameValue):MAggTo     = '' (CHARACTER)
 
                                             )
 
                                             (0x03000000:NameValue):TipoRecord = '03' (CHARACTER)
 
                                             (0x03000000:NameValue):DocId      = '0003675866' (CHARACTER)
 
                                             (0x03000000:NameValue):Imponibile = 5484.33 (DECIMAL)
 
                                             (0x03000000:NameValue):CodiceIva  = '20' (CHARACTER)
 
                                             (0x03000000:NameValue):Imposta    = 1096.87 (DECIMAL)
 
                                           )
 
                                         )
 
                                       )
 
                                       *****************************************************
 
 | 
   
 
 
 
How can I make to get all string value ?
 
 
Regards | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | kimbert | 
		  
		    
			  
				 Posted: Wed Jun 12, 2013 2:22 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				Very simple - set TrimKind to 'None'.
 
 
   
	| Quote: | 
   
  
	| I need to keep this characters in the message tree because some output fields are fixed substrings of this fields or a concatenation of fixed substrings of two or more fields.  | 
   
 
There may be a good reason why you are doing it this way,  but it sounds like bad design. You are putting knowledge of the data format into the message flow logic. 
 
 
My approach would be to parse out those substrings using DFDL, and then simply map the fields to the output. | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | ediman | 
		  
		    
			  
				 Posted: Wed Jun 12, 2013 4:13 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		   Newbie
 
 Joined: 05 Jun 2013 Posts: 9
  
  | 
		  
		    
			  
				Thank you very much, now it works.
 
 
   
	| Quote: | 
   
  
	
 
There may be a good reason why you are doing it this way, but it sounds like bad design. You are putting knowledge of the data format into the message flow logic. 
 
 | 
   
 
 
I have to map input data into IDoc and send it to SAP, and sometimes IDoc fields are required to be created in a particoular way.
 
 
For example, suppose we have in input
 
   
	| Code: | 
   
  
	
 
Field1(30) = "This is field 1              "
 
Field2(25) = "This is field 2         "
 
 | 
   
 
 
 
IDoc field could require
 
 
Field1 + Field2 as they arrive in the system
 
 
 
so we have to send 
 
   
	| Code: | 
   
  
	
 
"This is field 1              This is field 2"
 
 | 
   
 
 
 
or last 20 characters of Field1 + first 5 characters of Field2
 
 
 
so we have to send 
 
 
and so on.
 
 
Since we used MRM all flow logics expected trailing blanks, that's why we need them, otherwise we have to change the flow logics.
 
 
Regards. | 
			   
			 
		   | 
		 
		
		  | 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
  | 
  		 
	   
	 | 
   
 
  	 | 
	  |