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 » Substring that retains space at the end of the message

Post new topic  Reply to topic
 Substring that retains space at the end of the message « View previous topic :: View next topic » 
Author Message
arille22
PostPosted: Tue Aug 06, 2013 10:29 pm    Post subject: Substring that retains space at the end of the message Reply with quote

Newbie

Joined: 06 Aug 2013
Posts: 2

Hi All,

When I do a substring the space at the end of the message doesn't seem to be included. May I ask how to code it to retrieve the space at the end?

Sample:
<unexpected >

I get the unexpected word without the succeeding space.

Code is
SUBSTRING(COALESCE(message, '')FROM 1 FOR 11);

Please advise.

Thank you.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Tue Aug 06, 2013 11:13 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Code:

<unexpected >
1234567890123


So,
Code:

SUBSTRING(COALESCE(message, '')FROM 1 FOR 11);


means
give me a substring
starting at position 1
and for 11 characters (including the first)

The 11th character is the 'd'

It seems to me that everything is working as expected. ( i.e.
Code:

The result is

<unexpected



Can you explain exactly it is that you want to do?
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
arille22
PostPosted: Tue Aug 06, 2013 11:19 pm    Post subject: Reply with quote

Newbie

Joined: 06 Aug 2013
Posts: 2

Sorry the <> is not included on the message.
I just put unexpected inside <> to show the space after d. Apologies for the confusion.

Just want to substring with the last character as space. As I noticed that it gets deleted.

Thank you for the reply.
Back to top
View user's profile Send private message
dogorsy
PostPosted: Tue Aug 06, 2013 11:27 pm    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

The whole description of the problem is very unclear.
How do you know the space at the end is not part of the output ?

Try the following:

Code:

DECLARE myString CHAR 'unexpected ';

SET OutputRoot.XMLNSC.Test.Value = SUBSTRING(myString from 1 for 11);

and see what is in the output message. The coalesce is not needed as myString is not NULL.

PS: When you describe a problem, you need to describe EXACTLY what you are doing, not your interpretation of you think you are doing, for example, if you say your input is <unexpected > , then you are saying exactly that, that the input starts with the '<' sign.

so you should have said, the input is ( for example )

<message>unexpected </message>

or , the input is the string 'unexpected '
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 » Substring that retains space at the end of the message
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.