Use "LIKE" functionality in transformer

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Use "LIKE" functionality in transformer

Post by vinaymanchinila »

Hi,
I am converting ETL work built in SQL to DataStage. I have a statement which uses case statement with the "LIKE" command and I donot have the temp table, so how do I get the functionality of the LIKE command in DS transformer.

For example I have the following command

SELECT CUSTOMER,
PRODUCT,
CASE when DESC like '%T%' and FAMILY like '%TRY%' and CUSTOMER IN ('X1','X2','X3') then 'CASE1'
when LOCATION in ('LAX','CMH') then 'PRO'

Thanks,
mahveen
Participant
Posts: 5
Joined: Fri Aug 26, 2005 11:26 am

Post by mahveen »

Hi,

In the transformer, we can always use the substring function to incorporate 'like' functionality.

The other way could be using case statement in sql query and using an indicator field if it satisfies the like condition. and using it in the transformer.
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Post by vinaymanchinila »

Hi,

I donot have the table, bascially what is being done (Case statement ) has to be implemented over a file.
Thanks,
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Post by kaps »

I believe you can use If then else statement in your transformer instead of Case statement.

Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The Transformer stage uses non-SQL pattern matching.

Read about pattern matching in the on-line help or the DataStage BASIC manual.

Example:
inlink.Desc Matches "...T..." (the three dots is a wildcard matching any number of characters)
inlink.ProdCode Matches "2A3N..." (ProdCode must begin with two alphabetic characters followed by three numeric characters)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply