Too Many Nested If/Else Statements???

jde1919

Member
I need your help!
We have a custom report that uses 43 nested If/Else statements.

When run locally on a fat client it works correctly. When run on the Enterprise server, it ends in error.

The tracing logs show when the 34th nested IF/Else statement is run the section finishes correctly, but the report ends prematurely. It doesn't go to the next database record and start the section over again, it just ends.

So, if I data select only those records that don't hit that 34th nested statement, it ends just fine. No problem. And as mentioned, if I run it Locally (on a fat client or citrix box) with all the data, it works fine.

Why won't it run on the Enterprise server. We are running HP unix on the server and MS W2k everywhere else.

Any comments or suggestions would be very helpful.
Thanks,
jde1919
 
jde1919,

43 nested if's??? Wow! That seems like an overly complicated control structure. I pity the programmer who has to look at any such program and maintain it.

On the constructive side, can you rewrite the code to use several boolean variables to accomplish the same logic, but without all the levels of nesting?
Good luck.
 
jde1919, try to increase the per process max-stack-size in your HP-UX. If
that doesn't work, follow Doug's advice: re-write the program. Nested
if/else statements, 43 levels deep, sounds like bad code to me.

Sorry, Gerd
 
Re: I think you are right...

Gerd, Thanks for the reply, I think you are right. I will try the stack size change.

And about the nested statements...It seemed like a good idea when I started, but it has ballooned into a monster. I am actually in the process of rewriting it, but wanted to figure out why it wasn't working anyway.

Thanks again!
jde1919
 
Back
Top