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 » TRIM function

Post new topic  Reply to topic
 TRIM function « View previous topic :: View next topic » 
Author Message
Meow
PostPosted: Wed Dec 17, 2003 6:32 am    Post subject: TRIM function Reply with quote

Voyager

Joined: 25 Jun 2003
Posts: 95

Hi All,

I get this

<node>EMPLOYEE NUMBER</node>

and i want to arrive at EMPLOYEENUMBER. so i tried TRIM function

syntax: TRIM(' ' FROM 'EMPLOYEE NUMBER') this statement still gives me "EMPLOYEE NUMBER".

can you guide me how to achieve "EMPLOYEENUMBER"

I am sure that we can use the POSITION and SUBSTRING functions to achieve that. just checking if some one knows a simple logic than that.

I really appreciate the organizers and the participating people for their help.

Thanks,
Paruvan
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Dec 17, 2003 6:44 am    Post subject: Re: TRIM function Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Trim only removes LEADING, TRAILING, or LEADING AND TRAILING spaces, not Interior spaces.

So if you had " EMPLOYEE NUMBER", "EMPLOYEE NUMBER " or " EMPLOYEE NUMBER ", then trim could turn those into "EMPLOYEE NUMBER" but not "EMPLOYEENUMBER".

You'll have to use Position and Substring.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
mgk
PostPosted: Thu Dec 18, 2003 9:15 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

If you are on V5, there are new string functions that could help here, such as REPLACE.

Cheers,


MGK
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Dec 18, 2003 9:47 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

mgk wrote:
If you are on V5, there are new string functions that could help here, such as REPLACE.


Thanks!!!!

Is there a String->"list" or "list"->String function pair (ala Split/join in Perl), too?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
mgk
PostPosted: Fri Dec 19, 2003 1:11 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Hi Jeff.

There is no exact equivalent of this. If yoou think this would be very useful please let me know.

For the record, the string enhancements in V5 are:

LEFT Truncates a string preserving from the start
POSITION Extended. Now has repeat, index & direction
REPLICATE Repeats a string 'n' times
REPLACE Transforms strings within a string
RIGHT Truncates a string preserving from the end
SPACE Repeats blank. This is a short form of REPLICATE(' ', ...)
TRANSLATE Translates multiple single characters in a string
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Dec 19, 2003 5:21 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

mgk wrote:
Hi Jeff.

There is no exact equivalent of this. If yoou think this would be very useful please let me know.


Here's a real world example where it might be useful. We have to exchange data with certain customers using a standard file format that includes packed decimals. This means that (at least in 2.1), we have to model the data using CWF (since TDS doesn't seem to support packed decimals). However, the file includes repeating elements for which there are no predefined counts - which is not supported with CWF. So we created our own count fields for the various levels of repeat, and are stripping them out after conversion to a BLOB field. To make it easier to identify the "private" count fields, we created tags to wrap them.

Being able to "split" the BLOB at our tags, and then "join" back together the appropriate elements would make for a cleaner code than the POSITION/SUBSTRING/concat code we have now.

Similarly, it might come in handy to build the counts for an incoming file, as we could split on the record indicators, and then count the elements in the list.

mgk wrote:
For the record, the string enhancements in V5 are:
LEFT Truncates a string preserving from the start
POSITION Extended. Now has repeat, index & direction
REPLICATE Repeats a string 'n' times
REPLACE Transforms strings within a string
RIGHT Truncates a string preserving from the end
SPACE Repeats blank. This is a short form of REPLICATE(' ', ...)
TRANSLATE Translates multiple single characters in a string


That extended position is sweet.
_________________
I am *not* the model of the modern major general.
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 » TRIM function
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.