Like function

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
matthiaschoy
Participant
Posts: 2
Joined: Tue May 31, 2005 10:13 pm

Like function

Post by matthiaschoy »

Hi,

I am filtering data from source file to source file using a transformer. I have a condition which is getting all the tariff which contains USSD. The SQL is [if tariff like '%USSD%' then]. Which function should I use in DS 7.5 to perform that ?
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi And welcome aboard :),
you can use Basic Match operator for one, or any other function that can veify the existance of a string in a bigger string like Count()/Locate(),Index() and such.

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Match is the best, as Roy suggested. However it uses idiosyncratic syntax, for example for its wildcard. One syntax that will do the job you seek is the expression

Code: Select all

InLink.Tariff Match "...USSD..." 
(the three dots represent a wildcard). A variant in which "0X" is the wildcard is

Code: Select all

InLink.Tariff Matches "0X'USSD'0X"
(Matches is a synonym for Match).

The expression

Code: Select all

Index(InLink.Tariff, "USSD", 1) 
finds the first occurrence of "USSD" in Tariff, and may be more efficient. It returns 0 if not found, or the (positive) character position of where it was found.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
matthiaschoy
Participant
Posts: 2
Joined: Tue May 31, 2005 10:13 pm

Post by matthiaschoy »

It works... Thanks guys.... :lol:
Post Reply