Implementing If ElseIf End Function in DataStage

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
srini.dw
Premium Member
Premium Member
Posts: 186
Joined: Fri Aug 18, 2006 1:59 am
Location: Chennai

Implementing If ElseIf End Function in DataStage

Post by srini.dw »

Hi,
How to Implement this in DataStage....
IF B_DT >= PCKG_BEGIN_DT AND B_DT <= FMC_PCKG_END_DT
THEN TYPE := 'N';
ELSIF A_END_DT >= PCKG_BEGIN_DT AND A_END_DT <= FMC_PCKG_END_DT THEN TYPE:= 'R';
ELSE TYPE:='C';


Thanks
Srini
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Pretty much just like that, without the assingments and the semi-colons. The TYPE field should be the target of the derivation and use something like this:

Code: Select all

IF B_DT >= PCKG_BEGIN_DT AND B_DT <= FMC_PCKG_END_DT THEN 'N' ELSE IF A_END_DT >= PCKG_BEGIN_DT AND A_END_DT <= FMC_PCKG_END_DT THEN 'R' ELSE 'C'
Your dates would also need to be in a 'comparable' format, ISO compliant: YYYY-MM-DD.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Note that ELSE IF is two words - there is no ELSEIF or ELIF operator. Note also that this is a value-generating expression, not a statement in a function, so that assigment operators and statement terminators are inappropriate.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Ragupathy
Participant
Posts: 9
Joined: Thu Feb 11, 2010 11:14 pm

condition

Post by Ragupathy »

chulett wrote:Pretty much just like that, without the assingments and the semi-colons. The TYPE field should be the target of the derivation and use something like this:

Code: Select all

IF B_DT >= PCKG_BEGIN_DT AND B_D ...[/quote]


we can give like this

  if 1=1 then 100 else  if 1=2 then  200  else 0
Ragu
Ragupathy
Participant
Posts: 9
Joined: Thu Feb 11, 2010 11:14 pm

condition

Post by Ragupathy »

chulett wrote:Pretty much just like that, without the assingments and the semi-colons. The TYPE field should be the target of the derivation and use something like this:

Code: Select all

IF B_DT >= PCKG_BEGIN_DT AND B_D ...[/quote]


we can give like this

  if 1=1 then 100 else  if 1=2 then  200  else 0
Ragu
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Re: condition

Post by Sainath.Srinivasan »

Ragupathy wrote:we can give like this

if 1=1 then 100 else if 1=2 then 200 else 0
The result in this case will always be 100.

Btw, this thread was initiated and resolved more than 2 years ago. The poster might have moved on to new adventures.
Post Reply