Consultor Eletrônico



Kbase P24000: Nested IF ELSE statements compile without error
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   11/13/2008
Status: Verified

SYMPTOM(s):

Nested IF statements compile without error

Code with nested "IF" statements should return a compile error if it does not obey the IF .. THEN .. ELSE rules

an "else" statement without an "if" statement should not compile

FACT(s) (Environment):

Progress 9.1D
All Supported Operating Systems

CAUSE:

The 4GL compiler appears to be in error by putting the unmatched statement after the else:

If there was an IF statement as the one statement under another IF, the compiler was not properly ending the scope of the first IF. Therefore it would attach a spurious ELSE clause later on in the .p to that first IF statement when it should have been raising a compiler error.

FIX:

The compiler was fixed in 9.1D07 to detect this omission at which time, the IF .. THEN .. ELSE syntax will need to be reconstructed as per the rules.

if 1 > 1 then
if 1 = 1 THEN
DO:
message 1
view-as alert-box info buttons ok.

message 2
view-as alert-box info buttons ok.
END.

else
message 3
view-as alert-box info buttons ok.