if then else

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
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

if then else

Post by balajisr »

In the construct "if then else" used in the transfomer it is mandatory to give some values for else clause.

E.g If Color='Green' then 1 Else 0

Is it possible to make "Else" portion of "If then Else" a no-op code? i.e I do not want Else portion of code to be executed at all.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

In the BASIC language you can do this, but when using the construct in DataStage jobs the result of the IF-THEN-ELSE is assigned to a variable, i.e. it is the right side of an "=" statement. Because of this an IF clause must assign a value to both outcomes of the condition.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The If..Then..Else construct here is a conditional expression (not a statement) and therefore must return a value irrespective of the result of the test expression. The concept of "no operation" is irrelevant.

You will notice in the Then and Else parts there are value-generating expressions, not executable statements.

In routines you can use conditional expressions as rvalues (on the right hand side of an assignment statement for example) and the same rules apply there.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

Thanks ArndW and Ray.
Post Reply