Back in week 10/2011 I wrote a tip about how you in COBOL write expressions like "the color is red, yellow or green" as COLOR = 'RED' OR 'YELLOW' OR 'GREEN'. This trick is not available in any other programming languages I know of. In some programming languages like PASCAL and its predecessors (for instance Delphi) you can write COLOR IN [RED, YELLOW, GREEN], but this requires some additional declarations. IN is also available in SQL where it is possible to write COLOR IN ('RED', 'YELLOW', 'GREEN').
Well, this tip is about PL/I and how do you create the same expression in PL/I? The straightforward solution is to write COLOR = 'RED' ! COLOR = 'YELLOW' ! COLOR = 'GREEN'. Such an expression is often used in an IF statement and here you can use a SELECT instead:
So it is possible to make a similar expression in PL/I compared to SQL and COBOL. It may look like a lot of extra coding compared to a simple IF ... THEN DO; /* processing */ END; but it is much easier to extent with additional values and if other values must be treated differently, you can easily add an extra WHEN for those values. It is still not as simple as in COBOL. Please note the empty OTHERWISE. Without it PL/I will abend at execution time if COLOR is not one of the listed values in a WHEN.