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

Post new topic  Reply to topic
 Trim « View previous topic :: View next topic » 
Author Message
andrewsnorm
PostPosted: Tue Apr 22, 2003 8:11 pm    Post subject: Trim Reply with quote

Newbie

Joined: 22 Apr 2003
Posts: 1

Hi Experts,

I have a situation to trim spaces for output.

Field1 = Fixed length 10
Field2 = Fixed length 3

Input data = ABCDE 123
Output data = ABCDE123

SET OutputRoot.MRM.Field1 = TRIM(InputBody.Field1); does not trim. Where have I gone wrong in V2.0.1?

Thanks
Back to top
View user's profile Send private message
yaakovd
PostPosted: Sun Apr 27, 2003 12:35 pm    Post subject: Reply with quote

Partisan

Joined: 20 Jan 2003
Posts: 319
Location: Israel

You need casting as character before TRIM operation:

Code:
SET OutputRoot.MRM.Field1 = TRIM(CAST(InputBody.Field1 AS CHAR));

_________________
Best regards.
Yaakov
SWG, IBM Commerce, Israel
Back to top
View user's profile Send private message Send e-mail
Ian
PostPosted: Mon Apr 28, 2003 6:14 am    Post subject: Reply with quote

Disciple

Joined: 22 Nov 2002
Posts: 152
Location: London, UK

Hi,

Websphere MQ Integrator V2.1 - ESQL Reference

Quote:

TRIM

TRIM( trim_specification trim_singleton FROM source_string )
TRIM( trim_specification FROM source_string )
TRIM( trim_singleton FROM source_string )
TRIM( source_string )

The TRIM function returns a new string of the same type source_string, in which
the trim_specification singletons have been removed. trim_specification is one
of LEADING, TRAILING, or BOTH.
If trim_specification is not specified, BOTH is assumed.
If trim_singleton is not specified, a default singleton is assumed. This default
depends on the data type of source_string:

character ' ' (space)
byte X'00'
bit B'0'

TRIM returns a string value of the same data type and content as source_string
but with any leading or trailing singletons that are equal to trim_singleton
removed (depending on the value of trim_specification). If any of the parameters
are NULL, the result is a NULL value of the same type as source_string.
The FROM keyword is not required, and is in fact prohibited if neither a trim
specification, for example LEADING or TRAILING, nor a trim singleton, is
specified.

Note that it is often unnecessary to strip trailing blanks from character strings
before comparison because the rules of character string comparison mean that
trailing blanks are not significant.

The following examples illustrate the behavior of the TRIM function:
TRIM(TRAILING 'b' FROM 'aaabBb') returns 'aaabB'
TRIM(' a ') returns 'a'
TRIM(LEADING FROM ' a ') returns 'a '
TRIM('b' FROM 'bbbaaabbb') returns 'aaa'


You are trying to trim spaces using a function that removes TRAILING and/or LEADING spaces
and your data does not contain TRAILING or LEADING spaces.

Your data contains embedded spaces (between the "E" and the "1").

Quote:

Input data = ABCDE 123


You will need to manipulate the string (using ESQL) to find the embedded spaces (POSITION)
and then substring (SUBSTRING) the other parts of the string together into a new string
containing no spaces, probably within a loop (if there is more than one occurance of a space).
_________________
Regards, Ian
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
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.