Hour 9The Evaluate Statement

In computer programs, it is often necessary to determine which action to take based on a complex set of conditions. You may end up coding a significant number of If statements to handle these decisions. As you nest the If statements deeper and deeper, the code can become very confusing. If you have to come back later and change the program, you may find yourself spending a lot of time just trying to figure out what you were attempting to do with all those If statements.

COBOL comes equipped with a very versatile statement as an alternative to using complex, highly nested If statements. This statement is the Evaluate statement.

When to Use Evaluate

After analyzing the decisions you need to make in your program, you ...

Get Sams Teach Yourself COBOL in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.