COBOL: EVALUATE ALSO Best Examples

Evaluate is an alternative to IF condition. To give Multiple conditions you need to write many IFs.

You can use Evaluate ALSO to simplify the code. My below example shows you how to use it.

The ALSO in Evaluate is equal to AND.


Example to Evaluate ALSO. If you want to test two or more conditions, then, you need to use ALSO.

EVALUTAE TRUE ALSO TRUE
WHEN SEX = 'M' ALSO SEX = 'F'
PERFORM PARA-1
WHEN OTHER
CONTINUE
END-EVALUAtE

How to Give Complex Conditions

Evaluate True Also True
When A + B < 10 Also C = 10
Move "Case 1" To Description
When A + B > 50 Also C = ( D + E ) / F
Move "Case 2" To Description
When Other
Move "Case Other" To Description
End-Evaluate

References

Related Posts

Author: Srini

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