COBOL Evaluate ‘When Other’

The evaluate logic helps you to avoid multiple if statements in your program. This also avoids confusion in understanding COBOL logic. Why you need to write ‘WHEN OTHER’ explained in this post.

Evaluate Syntax..

We already know the syntax for evaluate is:

EVALUATE TRUE
    WHEN  CONDITION
     PERFORM  PARA1
END-EVALUATE;

When other in Evaluate..

Why “when other ” you need to write in evaluate? the reasons are simple:

You need to give to avoid ambiguity to the compiler.

The other way is , if the conditions are not matched, it helps what action will to take. 

One more point is, during validations for Numeric or character, you may get scenario like spaces, so to handle spaces what action it should take you need to write when other condition.