Page 1 of 1

Nested If-Then-Else

Posted: Wed Dec 02, 2009 10:38 am
by marothisu
Search returned nothing for this, so I thought I'd ask. How does one do Nested If-Then-Else in a Transformer Stage for PX?

I am doing something like this:
If expr1 Then expr2 ELSE IF expr3 THEN expr4 ELSE expr5


of course, DataStage PX doesn't like that..

Posted: Wed Dec 02, 2009 10:53 am
by chulett
What does it not like about it? Right-click on the red derivation and select 'Validate Derivation'.

Posted: Wed Dec 02, 2009 10:55 am
by marothisu
chulett wrote:What does it not like about it? Right-click on the red derivation and select 'Validate Derivation'. ...
I think it's because any expressions in that need to be in parentheses. Is there any documentation with actual grammar rules?

Posted: Wed Dec 02, 2009 11:03 am
by chulett
No, they don't. What does it actually say when you validate? And I don't believe I've ever seen an official grammar reference. Others may know. :?

Posted: Wed Dec 02, 2009 11:09 am
by marothisu
chulett wrote:No, they don't. What does it actually say when you validate? And I don't believe I've ever seen an official grammar reference. Others may know. :? ...
I didn't do it because I already corrected it with the correct usage of parentheses.

They should really include the BNF for these functions somewhere

Posted: Wed Dec 02, 2009 11:24 am
by Sreenivasulu
If you do lot of Nested If Else (like more than 4 nested if) in the derivation section somehow datastage does not like it. This is based on personal experience

Regards
Sreeni

Posted: Wed Dec 02, 2009 1:31 pm
by ray.wurlod
The original formulation, provided that all five expressions are well formed, is perfectly valid.

Validate expression, which Craig advised you to use, would have told you which of the five expressions was not well formed. Or at least the first of them that was not well formed. Lather, rinse and repeat.