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 » REPLACE anything that is not equal to this

Post new topic  Reply to topic
 REPLACE anything that is not equal to this « View previous topic :: View next topic » 
Author Message
inMo
PostPosted: Tue Sep 29, 2015 7:38 am    Post subject: REPLACE anything that is not equal to this Reply with quote

Master

Joined: 27 Jun 2009
Posts: 216
Location: NY

In simple terms, ESQL REPLACE says "go replace 'this' with 'that'".

Is there a way in ESQL to state "go REPLACE anything that is NOT 'this' with 'that'"? Further, is there a way to state "go REPALCE anything that is not 'these' with 'that'"?
Back to top
View user's profile Send private message
timber
PostPosted: Tue Sep 29, 2015 8:20 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1292

English is not a great language for expressing complex technical requirements. Can we have some examples, please?
Back to top
View user's profile Send private message
inMo
PostPosted: Tue Sep 29, 2015 9:10 am    Post subject: Reply with quote

Master

Joined: 27 Jun 2009
Posts: 216
Location: NY

Normal behavior
Code:

REPLACE('ABCDABCDABCDA', 'A', 'Z')
 -- RESULT = ZBCDZBCDZBCDZ


Exploring the idea of how to accomplish the following in ESQL using the simplest approach possible
Code:

REPLACE('ABCDABCDABCDA', NOT 'A', 'Z')
 -- RESULT = AZZZAZZZAZZZA


More Examples
Code:

REPLACE('ABCDEFGGFEDCBA', NOT 'A', '-')
 -- RESULT = A------------A


Code:

REPLACE('ABCDEFGGFEDCBA', NOT 'A' OR 'D', '-')
 -- RESULT = A--D------D--A
Back to top
View user's profile Send private message
timber
PostPosted: Tue Sep 29, 2015 10:16 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1292

What's the underlying requirement? Validation? Cleansing of data?
Back to top
View user's profile Send private message
maurito
PostPosted: Wed Sep 30, 2015 4:21 am    Post subject: Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

if the question is: Is there an ESQL string manipulation function to do that ?
The answer is NO.
You can achieve that with a for loop, write your own function.
Back to top
View user's profile Send private message
maurito
PostPosted: Wed Sep 30, 2015 4:26 am    Post subject: Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

inMo wrote:
Code:

REPLACE('ABCDEFGGFEDCBA', NOT 'A' OR 'D', '-')
 -- RESULT = A--D------D--A


you probably mean:
Code:

REPLACE('ABCDEFGGFEDCBA', NOT ('A' OR 'D'), '-')
 -- RESULT = A--D------D--A

or
Code:

REPLACE('ABCDEFGGFEDCBA', NOT 'A' AND NOT 'D'), '-')
 -- RESULT = A--D------D--A
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 » REPLACE anything that is not equal to this
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.