| Author | 
		  Message
		 | 
		
		  | kunal07 | 
		  
		    
			  
				 Posted: Fri Feb 21, 2014 2:51 am    Post subject: Remove special characters | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 05 Dec 2012 Posts: 72
  
  | 
		  
		    
			  
				Hi All,
 
 
I am trying to remove special characters from message
 
 
ABC                                                   \r\n 7262671                                           \r\nPRL                                                            \r\n34/01dataconnect1                                         \r\n-
 
 
Code snippet, I tried:-
 
DECLARE whiteSpace CONSTANT CHARACTER CAST( X'090D0A20' AS CHAR CCSID 1208);
 
SET Message = REPLACE (Data, '\r\n', '');
 
SET KeyIdentifier = TRIM (whiteSpace  from Message);
 
 
 
But it is not working.
 
any help | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Gralgrathor | 
		  
		    
			  
				 Posted: Fri Feb 21, 2014 2:59 am    Post subject: Re: Remove special characters | 
				     | 
			   
			 
		   | 
		
		
		   Master
 
 Joined: 23 Jul 2009 Posts: 297
  
  | 
		  
		    
			  
				
   
	| kunal07 wrote: | 
   
  
	
   
	| Code: | 
   
  
	| SET Message = REPLACE (Data, '\r\n', ''); | 
   
 
 | 
   
 
 
 
Is that your literal code?
 
 
And, ehr, is your search engine broken, perhaps? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kunal07 | 
		  
		    
			  
				 Posted: Fri Feb 21, 2014 3:11 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 05 Dec 2012 Posts: 72
  
  | 
		  
		    
			  
				| this is the code which i am testing but it not removing the /r/n like of values | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Gralgrathor | 
		  
		    
			  
				 Posted: Fri Feb 21, 2014 3:27 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Master
 
 Joined: 23 Jul 2009 Posts: 297
  
  | 
		  
		    
			  
				
   
	| kunal07 wrote: | 
   
  
	| this is the code which i am testing but it not removing the /r/n like of values | 
   
 
 
 
That's because WMB can't guess that by '\r\n' you actually mean CAST(X'0d0a' as character). | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kunal07 | 
		  
		    
			  
				 Posted: Fri Feb 21, 2014 4:31 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 05 Dec 2012 Posts: 72
  
  | 
		  
		    
			  
				i am able to replace the values with blank space but not able to remove the white space .
 
i used trim function which remove the leading and trailing white spaces but not between the string.
 
any solution? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Fri Feb 21, 2014 4:55 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				
   
	| Quote: | 
   
  
	| I am trying to remove special characters from message | 
   
 
Why do you need to remove the special characters? _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kunal07 | 
		  
		    
			  
				 Posted: Fri Feb 21, 2014 4:57 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 05 Dec 2012 Posts: 72
  
  | 
		  
		    
			  
				| its simple, i don't need the space in between my string | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Gralgrathor | 
		  
		    
			  
				 Posted: Fri Feb 21, 2014 5:08 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Master
 
 Joined: 23 Jul 2009 Posts: 297
  
  | 
		  
		    
			  
				You want to replace white spaces in your string. 
 
 
Your function is TRANSLATE.
 
 
The characters to translate are: '\r', '\n', ' '. Your string would therefore be: CAST(X'0A0D20' as CHARACTER CCSID 1208) -- (assuming utf- .
 
 
You might really want to use the info center and search engine before resorting to asking questions on this forum. This is not the best way to learn WMB development. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Gralgrathor | 
		  
		    
			  
				 Posted: Fri Feb 21, 2014 5:09 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Master
 
 Joined: 23 Jul 2009 Posts: 297
  
  | 
		  
		    
			  
				
   
	| kimbert wrote: | 
   
  
	| Why do you need to remove the special characters? | 
   
 
 
 
And of course it never hurts to ask why you want something in the first place. I keep forgetting that and assume that people have good reasons for wanting the things they want. I keep forgetting they're people   | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kunal07 | 
		  
		    
			  
				 Posted: Fri Feb 21, 2014 5:30 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 05 Dec 2012 Posts: 72
  
  | 
		  
		    
			  
				i have already check the infocentre then only post the comment.
 
 
i have used TRANSLATE and trim also but not able to remove the space from my string.
 
ex :Abc      ab       bc      de    anc - input,
 
 
i want Abc ab bc de anc - output but not   able to do so.
 
 
Please suggest | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kunal07 | 
		  
		    
			  
				 Posted: Fri Feb 21, 2014 5:33 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 05 Dec 2012 Posts: 72
  
  | 
		  
		    
			  
				| there are 10 spaces between each string and i want to replace them by i space | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Gralgrathor | 
		  
		    
			  
				 Posted: Fri Feb 21, 2014 5:33 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Master
 
 Joined: 23 Jul 2009 Posts: 297
  
  | 
		  
		    
			  
				
   
	| kunal07 wrote: | 
   
  
	| Please suggest | 
   
 
 
 
Already gave the solution in the comment you're responding to. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Gralgrathor | 
		  
		    
			  
				 Posted: Fri Feb 21, 2014 5:35 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Master
 
 Joined: 23 Jul 2009 Posts: 297
  
  | 
		  
		    
			  
				
   
	| kunal07 wrote: | 
   
  
	| there are 10 spaces between each string and i want to replace them by i space | 
   
 
 
 
Then extend the 3d parameter of TRANSLATE by as many characters as there are in the 2nd, eg. TRANSLATE(string, 'ABC', '...'); This *is* described in the documentation. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Esa | 
		  
		    
			  
				 Posted: Fri Feb 21, 2014 5:38 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand Master
 
 Joined: 22 May 2008 Posts: 1387 Location: Finland 
  | 
		  
		    
			  
				
   
	| kunal07 wrote: | 
   
  
	| there are 10 spaces between each string and i want to replace them by i space | 
   
 
 
 
Are you sure you are doing the right thing?
 
Why don't you define a DFDL schema or a Message Set and let the parser take care of all this? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Gralgrathor | 
		  
		    
			  
				 Posted: Fri Feb 21, 2014 5:46 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Master
 
 Joined: 23 Jul 2009 Posts: 297
  
  | 
		  
		    
			  
				
   
	| Esa wrote: | 
   
  
	
   
	| kunal07 wrote: | 
   
  
	| there are 10 spaces between each string and i want to replace them by i space | 
   
 
 
 
Are you sure you are doing the right thing?
 
Why don't you define a DFDL schema or a Message Set and let the parser take care of all this? | 
   
 
 
 
Or, since his aim seems to be to provide an identifier, use a message id or aa uuid... | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |