How to control COBOL evaluate logic

The evaluate logic helps you to avoid multiple if statements in your program. This also avoids confusion in understanding COBOL logic.

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 mention in evaluate -the reason is very simple:

To avoid  ambiguity to the compiler, you need to mention it. 

The other way is , if the conditions are not matched, it helps what action 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 mention the when other condition.

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.