Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why do nested IFs w/o ELSE clause cause problems?

Status
Not open for further replies.

WebFvcker

Programmer
May 25, 2007
1
0
0
PR
I had the following code inside a DEFINE FILE block:

CVIGENCI3/A01 = IF STATUS EQ 'B' OR 'A' OR 'S' OR 'R' OR 'Z' OR 'U' THEN
(IF CHG_OFF_PRIN GT 0 THEN
(IF PRIN_BAL1 GT 0 THEN 'Z' ELSE 'P'))
ELSE
IF STATUS EQ 'P' THEN 'T' ELSE
IF STATUS EQ 'O' THEN 'O' ELSE 'F';

For some reason the
IF CHG_OFF_PRIN GT 0 THEN
(IF PRIN_BAL1 GT 0 THEN 'Z' ELSE 'P')) section would go into the nested IF even when the outer IF was false. All I had to do was add an ELSE clause and that fixed the problem. So it ended up like:

IF CHG_OFF_PRIN GT 0 THEN
(IF PRIN_BAL1 GT 0 THEN 'Z' ELSE 'P') ELSE '')

I lost around 2 days' worth of work because of this problem. Can someone explain why this is an issue in WF 7.1.3? And if there's a solution that doesn't involve adding useless ELSE clauses to all nested IFs?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top