if else logic

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
deesh
Participant
Posts: 193
Joined: Mon Oct 08, 2007 2:57 am

if else logic

Post by deesh »

Hi Friends

I have one if else logic, can share with me how to implement below condition in data stage.


if 1st character of okcucl = 5 then 020
else two first character of okcucl = 65 then 030 else 001
jhmckeever
Premium Member
Premium Member
Posts: 301
Joined: Thu Jul 14, 2005 10:27 am
Location: Melbourne, Australia
Contact:

Post by jhmckeever »

Assuming you mean in a parallel transformer:

Code: Select all

If Left(InLink.okcucl,1) = '5'  Then '020'
Else If Left(InLink.okcucl, 2) = '65' Then '030'
Else '001' 
<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>
deesh
Participant
Posts: 193
Joined: Mon Oct 08, 2007 2:57 am

Post by deesh »

jhmckeever wrote:Assuming you mean in a parallel transformer:

Code: Select all

If Left(InLink.okcucl,1) = '5'  Then '020'
Else If Left(InLink.okcucl, 2) = '65' Then '030'
Else '001' 
Hi,
When I tried this logic, not given sufficient result It's giving wrong

I need below kind of data, Please send proper logic

5612 ------020612
6589 --------03089
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

John's response was a COMPLETE ANSWER to your question, which only sought a three-character string.
deesh wrote:if 1st character of okcucl = 5 then 020
else two first character of okcucl = 65 then 030 else 001
You have now changed the question.

We at DSXchange are not in the business of supplying a complete solution (though a number of people here are in that business, but only for money).

How about you give some thought to how YOU might go about it (apart from requesting/demanding that someone else solves your problems)?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
shalini11
Participant
Posts: 74
Joined: Thu Jan 22, 2009 3:00 am

Post by shalini11 »

Try this

If Trim(DSLink1.okcucl[1,1])='5' Then '020':Trim(DSLink1.okcucl[2,len(DSLink1.okcucl)])
Else If Trim(DSLink1.okcucl[1,2])='65' Then '030':Trim(DSLink1.okcucl[3,len(DSLink1.okcucl)])
Else '001'
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

deesh wrote: Hi,
When I tried this logic, not given sufficient result It's giving wrong

I need below kind of data, Please send proper logic

5612 ------020612
6589 --------03089
Unbelievable!
datastage_learner
Participant
Posts: 15
Joined: Thu May 07, 2009 9:50 pm

Post by datastage_learner »

shalini11 wrote:Try this

If Trim(DSLink1.okcucl[1,1])='5' Then '020':Trim(DSLink1.okcucl[2,len(DSLink1.okcucl)])
Else If Trim(DSLink1.okcucl[1,2])='65' Then '030':Trim(DSLink1.okcucl[3,len(DSLink1.okcucl)])
Else '001'

mate...perfect answer! :wink:
Thanks,
DS_Learner
Post Reply