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 » Help needed in using Trim/Substring functions

Post new topic  Reply to topic
 Help needed in using Trim/Substring functions « View previous topic :: View next topic » 
Author Message
Bharat
PostPosted: Thu Aug 05, 2004 9:10 am    Post subject: Help needed in using Trim/Substring functions Reply with quote

Acolyte

Joined: 14 May 2002
Posts: 61
Location: Reston, VA, USA

Hi,

I need to trim 5 trailing characters from a string.
My input string is: INPUT.SAMPLE.STRING.TEST
My output string should be: INPUT.SAMPLE.STRING
Just I need to strip of trailing characters '.TEST'

I'm using the following code.
Code:
TRIM(TRAILING '.TEST' FROM InputString)

I'm getting the following error.
Quote:
Illegal trim character ''.TEST'' argument to TRIM function. The trim character argument to the TRIM function must be a character string, a byte string or a bit string, and must be of length 1. The trim character argument was ''.TEST''.

How to get my output string using Trim or Substring function? I appreciate your help.

Thanks,
Bharat
Back to top
View user's profile Send private message
Lisa
PostPosted: Thu Aug 05, 2004 9:26 am    Post subject: String Reply with quote

Master

Joined: 07 Jun 2002
Posts: 287
Location: NJ

Set NewString = String(Input From 1 for 19);

Lisa
Back to top
View user's profile Send private message Send e-mail
Bharat
PostPosted: Thu Aug 05, 2004 9:34 am    Post subject: Reply with quote

Acolyte

Joined: 14 May 2002
Posts: 61
Location: Reston, VA, USA

Thanks Lisa. But the initial part of the String is not constant.

For example: In INPUT.SAMPLE.STRING.TEST, the 'STRING' part varies for each input XML file. Only 'INPUT', 'SAMPLE' and 'TEST' parts are constants. So I can't use
Code:
Set NewString = String(Input From 1 for 19);

But '.TEST' is constant always. So is there anyway to trim the trailing characters '.TEST' from the input string.

Thanks,
Bharat
Back to top
View user's profile Send private message
Lisa
PostPosted: Thu Aug 05, 2004 9:44 am    Post subject: String Reply with quote

Master

Joined: 07 Jun 2002
Posts: 287
Location: NJ

Well, you could do the following.

Get Length, then substring.

Set InputLenght = Length(Input);
Set InputLength = InputLength - 5 --> ".TEST" is equal to 5
Set NewString = String(Input From 1 for InputLength);

I'm sure there are other ways of extracting this information.

Lisa
Back to top
View user's profile Send private message Send e-mail
Bharat
PostPosted: Thu Aug 05, 2004 10:34 am    Post subject: Reply with quote

Acolyte

Joined: 14 May 2002
Posts: 61
Location: Reston, VA, USA

Your code worked for for this issue. Thank you so much Lisa. I appreciate your help.

Regards,
Bharat
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 » Help needed in using Trim/Substring functions
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.