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 » ESQL Substring

Post new topic  Reply to topic
 ESQL Substring « View previous topic :: View next topic » 
Author Message
madrox
PostPosted: Mon Apr 27, 2015 4:35 pm    Post subject: ESQL Substring Reply with quote

Acolyte

Joined: 11 Mar 2015
Posts: 71

Hello All,
I am trying to use the substring function to capture the characters before and after '/'

for ex:
"firstpart/secondpart/thirdpart"
so i can retrieve
firstpart
secondpart
thirdpard

from the knowledge center i found
Code:
SUBSTRING('firstpart/secondpart' BEFORE '/');

should give me : firstpart

Code:
SUBSTRING('firstpart/secondpart' AFTER '/');

should give me : secondpart

how can i get thirdpart?

Thanks
Back to top
View user's profile Send private message
smdavies99
PostPosted: Mon Apr 27, 2015 10:27 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.

Won't the second on return

secondpart/thirdpart

because it is after the first /
Then you can do the substring again to get the third part.

you could submit an RFE requesting that the function be modified to say something like

Code:

SUBSTRING('firstpart/secondpart' AFTER n '/' );

Where n is the number of instances of '/' to skip.

alternatively you could write your own function to do the iteration and call that instead of calling SUBSTRING directly.
_________________
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
iibmate
PostPosted: Tue Apr 28, 2015 1:12 am    Post subject: Re: ESQL Substring Reply with quote

Apprentice

Joined: 17 Mar 2015
Posts: 38
Location: Perth, WA

Try this..

SUBSTRING(SUBSTRING('firstpart/secondpart/thirdpart' AFTER '/') AFTER '/');
Back to top
View user's profile Send private message
wbisantosh
PostPosted: Tue Apr 28, 2015 6:44 am    Post subject: Reply with quote

Apprentice

Joined: 12 Nov 2012
Posts: 47

You could try something similar, to make it work for variable number of Parts (not just 3)

Code:
DECLARE parts ROW;
      DECLARE Req_String Char 'First/Second/Third';
      DECLARE i INT 1;

      WHILE LENGTH(Req_String) > 0 DO
         SET parts.[i] = SUBSTRING(Req_String BEFORE '/');
         SET Req_String = SUBSTRING(Req_String AFTER '/');
         SET i = i + 1;
      END WHILE;


Thanks
Santosh
Back to top
View user's profile Send private message
madrox
PostPosted: Thu Apr 30, 2015 6:26 am    Post subject: Reply with quote

Acolyte

Joined: 11 Mar 2015
Posts: 71

Thank you all for your input
Back to top
View user's profile Send private message
inMo
PostPosted: Mon May 04, 2015 11:54 am    Post subject: Reply with quote

Master

Joined: 27 Jun 2009
Posts: 216
Location: NY

How does one submit an RFE?
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon May 04, 2015 12:05 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

inMo wrote:
How does one submit an RFE?


From here
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
inMo
PostPosted: Mon May 04, 2015 12:13 pm    Post subject: Reply with quote

Master

Joined: 27 Jun 2009
Posts: 216
Location: NY

Thank you.
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 » ESQL Substring
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.