Nested If-Then-Else

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
marothisu
Participant
Posts: 25
Joined: Wed Oct 07, 2009 3:29 pm

Nested If-Then-Else

Post 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..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What does it not like about it? Right-click on the red derivation and select 'Validate Derivation'.
-craig

"You can never have too many knives" -- Logan Nine Fingers
marothisu
Participant
Posts: 25
Joined: Wed Oct 07, 2009 3:29 pm

Post 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?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
marothisu
Participant
Posts: 25
Joined: Wed Oct 07, 2009 3:29 pm

Post 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
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply