ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Remove special characters

Post new topic  Reply to topic Goto page 1, 2  Next
 Remove special characters « View previous topic :: View next topic » 
Author Message
kunal07
PostPosted: Fri Feb 21, 2014 2:51 am    Post subject: Remove special characters Reply with quote

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
View user's profile Send private message
Gralgrathor
PostPosted: Fri Feb 21, 2014 2:59 am    Post subject: Re: Remove special characters Reply with quote

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
View user's profile Send private message Send e-mail
kunal07
PostPosted: Fri Feb 21, 2014 3:11 am    Post subject: Reply with quote

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
View user's profile Send private message
Gralgrathor
PostPosted: Fri Feb 21, 2014 3:27 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
kunal07
PostPosted: Fri Feb 21, 2014 4:31 am    Post subject: Reply with quote

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
View user's profile Send private message
kimbert
PostPosted: Fri Feb 21, 2014 4:55 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
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
View user's profile Send private message
kunal07
PostPosted: Fri Feb 21, 2014 4:57 am    Post subject: Reply with quote

Acolyte

Joined: 05 Dec 2012
Posts: 72

its simple, i don't need the space in between my string
Back to top
View user's profile Send private message
Gralgrathor
PostPosted: Fri Feb 21, 2014 5:08 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Gralgrathor
PostPosted: Fri Feb 21, 2014 5:09 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
kunal07
PostPosted: Fri Feb 21, 2014 5:30 am    Post subject: Reply with quote

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
View user's profile Send private message
kunal07
PostPosted: Fri Feb 21, 2014 5:33 am    Post subject: Reply with quote

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
View user's profile Send private message
Gralgrathor
PostPosted: Fri Feb 21, 2014 5:33 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Gralgrathor
PostPosted: Fri Feb 21, 2014 5:35 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Esa
PostPosted: Fri Feb 21, 2014 5:38 am    Post subject: Reply with quote

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
View user's profile Send private message
Gralgrathor
PostPosted: Fri Feb 21, 2014 5:46 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Remove special characters
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.