The evaluate logic avoids multiple-if statements in your program. It also avoids confusion to understand COBOL logic. The aim of this post is why you need to write ‘WHEN OTHER’ in the EVALUATE statement.
The syntax for evaluate is:
EVALUATE TRUE WHEN CONDITION PERFORM PARA1 WHEN OTHER continue END-EVALUATE.
When other in Evaluate..
Why “when other ” you need to write in evaluate?
the reasons are simple:
- This avoids ambiguity to the compiler.
- If the conditions are not matched, it helps what action it has to to take.
- During Numeric or character validations, to handle space spaces, you need to write logic in WHEN OTHER condition of what action compiler has to take.