Search for a specific text from a record

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
phanikumar
Participant
Posts: 60
Joined: Tue Sep 20, 2011 10:44 pm
Location: INDIA

Search for a specific text from a record

Post by phanikumar »

Hi

I have a scenario where in I need to filter out all the records if I found the specific text any where in the record.

for example I need to filter out all the records where they contain a value IBM.If IBM is part of any where within the record I need to filter out that record.

Can some one please tell me what function has to be used in order to achieve this.

Regards

Kumar
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

It has been discussed already here.
Please search for Like operator.
pandeeswaran
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Index()
-craig

"You can never have too many knives" -- Logan Nine Fingers
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

I'm assuming the string to filter out can be in any column, in which case I would test out pre-processing with a grep against what datastage itself can do
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

True, if we're talking about a flat file source you can leverage something like 'grep' in the Filter option as well.
-craig

"You can never have too many knives" -- Logan Nine Fingers
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

The grep command does have some useful options like -v and -i that you may be able to use, especially if you're dealing with a typical text file.

Without using grep, if you need to check all columns, you could create a throw-away column that concatenates all the columns and then use the Index() function in a Transformer constraint.

Another way is to read each entire record from a file into a single char or varchar column, do the Index() check, and then columnize the record.
Choose a job you love, and you will never have to work a day in your life. - Confucius
Post Reply