Finding a Match: CASE
The CASE command covers a special case of the multiple case IF command. Rather than allowing an arbitrary condition to be tested in each of the individual cases (as in the general multiple case IF command), the CASE command allows a given symbol to be tested against specific values until a matching value is found.
/: CASE symbol
/: WHEN value1
/: WHEN value2
/: WHEN valuen
/: WHEN OTHERS.
The symbol in the CASE line is formatted. If its value is found in one of the WHEN lines, then the text lines following this WHEN line are printed. If no matching value is found then the text lines enclosed by the WHEN OTHERS line and the ENDCASE command are printed. The WHEN OTHERS section is optional.
As with the IF command, the comparison is always performed on literal values.