COBOL Evaluate: How to Write Multiple When Conditions

Sample Evaluate syntax to give ‘or’ condition is given . This is one of the most frequently used coding styles

COBOL Evaluate 'OR' Condition
COBOL Evaluate ‘OR’ Condition
Evaluate Marital-code
    When 'M'
         ADD 2 to People-count
    When 'S'
    When 'D'
    When 'W'
         ADD 1 to People-Count
End-Evaluate.

The way above code tells, WHEN in sequence you have 3 WHEN. That means, if you get in input either of the values, adding ‘1’ to people count.

Related:

Author: Srini

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