CASE, WHEN, OTHERWISE and END-CASE statements

The CASE statement provide an elegant way to test values.

Read syntax diagramSkip visual syntax diagramCASE&FIELDWHEN&CONDITIONEasytrieve StatementOTHERWISEEasytrieve StatementEND-CASE
Parameters
&FIELD
The field name to be evaluated.
&CONDITION
Value (&LIT) to be tested for. It must be a literal or &LIT1 THRU &LIT2.
OTHERWISE
Must be the last statement after a series of tests. The statements following OTHERWISE are executed only when all previous tests fail.
END-CASE
Terminates the CASE

The CASE statement is translated by Migration Utility to COBOL EVALUATE statement. The OTHERWISE statement is translated to WHEN OTHER of EVALUATE statement.