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 » Removing Commas out of a numeric Field

Post new topic  Reply to topic
 Removing Commas out of a numeric Field « View previous topic :: View next topic » 
Author Message
Kool-Aid
PostPosted: Tue Dec 14, 2004 1:38 pm    Post subject: Removing Commas out of a numeric Field Reply with quote

Novice

Joined: 22 Apr 2004
Posts: 22

Using WMQI version 2.1 is there a way to simply remove commas out of a numeric or string field. For example the value 345,008,763 is sent. I would like 345008763. How do I do this in ESQL? Or is there a node that supports this?
Back to top
View user's profile Send private message
fcotait
PostPosted: Tue Dec 14, 2004 7:31 pm    Post subject: Reply with quote

Acolyte

Joined: 28 Feb 2002
Posts: 63
Location: Sao Paulo - Brazil

You can create a function to remove commas chars using functions POSITION and SUBSTRING

Try the function below (I didn't test the code)

Code:
CREATE FUNCTION WHITOUTCHAR(S CHAR, CH CHAR) RETURNS CHAR
BEGIN

   DECLARE P INTEGER;

   SET P = 1;
   
   WHILE P > 0 DO
      SET P = POSITION(CH IN S);
      IF P > 0 THEN
         SET S = SUBSTRING(S FROM 1 FOR (P - 1)) || SUBSTRING(S FROM (P + 1));
      END IF;
   END WHILE;

   RETURN S;

END;

_________________
Filipe Cotait
IBM Certified System Administrator - WebSphere MQ
IBM Certified Specialist - MQSeries, WebSphere MQ Integrator
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
martinrydman
PostPosted: Wed Dec 15, 2004 5:30 am    Post subject: Reply with quote

Centurion

Joined: 30 Jan 2004
Posts: 139
Location: Gothenburg, Sweden

In WBIMB 5.0, there's a REPLACE function which greatly simplifies the task.

/Martin
Back to top
View user's profile Send private message
kirani
PostPosted: Wed Dec 15, 2004 10:27 am    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

martinrydman wrote:
In WBIMB 5.0, there's a REPLACE function which greatly simplifies the task.

But he is using WMQI 2.1
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
JT
PostPosted: Wed Dec 15, 2004 12:17 pm    Post subject: Reply with quote

Padawan

Joined: 27 Mar 2003
Posts: 1564
Location: Hartford, CT.

Quote:
In WBIMB 5.0, there's a REPLACE function which greatly simplifies the task

I'm curious, even if using the REPLACE function was an option, what would Kool-Aid replace the comma with? The comma needs to be removed, not replaced.
Back to top
View user's profile Send private message
martinrydman
PostPosted: Wed Dec 15, 2004 1:13 pm    Post subject: Reply with quote

Centurion

Joined: 30 Jan 2004
Posts: 139
Location: Gothenburg, Sweden

Like this:


Code:

SET X = REPLACE(X, ',');


To quote from the doc:

Quote:

If you do not specify the replace string expression, the replace string defaults to an empty string and, therefore, the behavior of the function is to delete all occurences of the search string from the result.


/Martin
Back to top
View user's profile Send private message
JT
PostPosted: Wed Dec 15, 2004 1:27 pm    Post subject: Reply with quote

Padawan

Joined: 27 Mar 2003
Posts: 1564
Location: Hartford, CT.

martinrydman,

Thanks, that'll come in handy some day.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Removing Commas out of a numeric Field
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.