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 » What is a good method to look for varying length values in a

Post new topic  Reply to topic
 What is a good method to look for varying length values in a « View previous topic :: View next topic » 
Author Message
jrsetters
PostPosted: Thu Aug 30, 2012 8:48 am    Post subject: What is a good method to look for varying length values in a Reply with quote

Acolyte

Joined: 24 Aug 2011
Posts: 72
Location: Cincinnati, OH

I have a long list of department prefixes that range from 2 to 6 characters in length that I want to filter out of a downstream system. I can't really use IN, I guess because I don't have the whole value to look for and can't substring out specific character lengths.

I don't know if it is possible to check multiple values from a CONTAINS or LIKE Operator. I'd prefer not to write out 70 individual statements.

How would you guys do it? It's about 70 different variations of 'department starts with' I need to account for (ie any department that begins with 'UN', or 'GHW' or 'GHRAD' etc).
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Aug 30, 2012 8:52 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Can you sort the 70 into subsets, all at the same length?

I.e check if SUBSTRING(2) IN ('UH','AB','MN','LQ',) and then do an OR over each subset?
Back to top
View user's profile Send private message
jrsetters
PostPosted: Thu Aug 30, 2012 8:58 am    Post subject: Reply with quote

Acolyte

Joined: 24 Aug 2011
Posts: 72
Location: Cincinnati, OH

I don't think so because most of these are hospital nursing units and we don't necessarily want to filter out everything that is similar. For instance if we had the Radiology Unit at University Hospital, we might want to filter out:

UHRADX
UHRADUS
UHRADEKG

but keep

UHRADMRI
UHRADO
UHRADPULM

or something along those lines. They are fairly specific about their list, but there is little in common that would let me use a category like that.

EDIT: I see more what you are saying now, sometimes I am slow on the uptake. So just DECLARE the variable once then do a series of OR SUBSTRINGS of 2,3,4,5, and 6 and sort them into there. That I definitely do, I just didn't know if there was a lazy way to put them all in one bracket with an OR or comma between each one.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Aug 30, 2012 9:17 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

If you work from longest to shortest subsets, that will help somewhat.

But the situation may not allow you to do what you want.

Presume you have to throw out anything that starts with UH, but keep things that start with UHABC unless it starts with UHABCA.

You have to have three checks to solve that. There's no way to solve it otherwise, even with a regex. If it doesn't match UHABCA, then it might still match UHABC or UH.
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Aug 30, 2012 12:28 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Well, a theorist might suggest something like this:
http://en.wikipedia.org/wiki/Aho-Corasick_string_matching_algorithm
You could probably find an implementation in Java out there somewhere. Whether you would be legally permitted to use it is another matter, of course.
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 » What is a good method to look for varying length values in a
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.