how implement like operator in DS

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
pradeep_nov18
Participant
Posts: 92
Joined: Wed Mar 05, 2008 4:09 am
Location: chennai
Contact:

how implement like operator in DS

Post by pradeep_nov18 »

Hi All,

I have requirement where i have to do If Input.Column like 'INT%' then Column else Other Column.

Please help out in solving.

Thanks in advance,

Regards,
Pradeep
pradeep.v
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Use the substring operators to check to see if the first three characters = "INT". For example:

Code: Select all

If Link.Column[1,3] = "INT" then this else that
-craig

"You can never have too many knives" -- Logan Nine Fingers
pradeep_nov18
Participant
Posts: 92
Joined: Wed Mar 05, 2008 4:09 am
Location: chennai
Contact:

Post by pradeep_nov18 »

chulett wrote:Use the substring operators to check to see if the first three characters = "INT". For example:

Code: Select all

If Link.Column[1,3] = "INT" then this else that
...

Hi Chulett,

Thanks For the Reply.

But Then part will be performed only if it "INT",Even imay get like INT1,INT2 etc Then this condition will fail.

So i want implement "ORACLE LIKE OPERATOR IN DATASTAGE".

Thanks,
Pradeep.V
pradeep.v
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Which is exactly what I gave you does. How will checking the first three characters of "INT1" or "INT2" for "INT" fail? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
pradeep_nov18
Participant
Posts: 92
Joined: Wed Mar 05, 2008 4:09 am
Location: chennai
Contact:

Post by pradeep_nov18 »

chulett wrote:Which is exactly what I gave you does. How will checking the first three characters of "INT1" or "INT2" for "INT" fail? :? ...

Hi Chulett,

I want to populate If Input.Column = 'INT%' Then column else 0.hence i want to know how achieve wild card '%' in datastage.

Thanks for your response,
pradeep.v
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Stop and think about it for a moment. Maybe even try it. The code I gave you does exactly that. And now that I know the this and that:

Code: Select all

If Link.Column[1,3] = "INT" then Link.Column else "0"
-craig

"You can never have too many knives" -- Logan Nine Fingers
nagarjuna
Premium Member
Premium Member
Posts: 533
Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago

Post by nagarjuna »

In Filter stage you can use like operator ...But i dont know how far you can use it in your requirement ..
Nag
jhmckeever
Premium Member
Premium Member
Posts: 301
Joined: Thu Jul 14, 2005 10:27 am
Location: Melbourne, Australia
Contact:

Post by jhmckeever »

... or if you're averse to Craig's straightforward solution, or your requirements become more complex, then you could always use <a href="viewtopic.php?t=107882">regular expressions</a>

John.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
Post Reply