OS/VS COBOL accepted the ON
statement, but IBM Enterprise COBOL does not accept it anymore. The ON
statement allows the
selective execution of statements it contains. Similar functions are provided in Enterprise COBOL by EVALUATE
and IF
Noncompliant code example
IDENTIFICATION DIVISION.
PROGRAM-ID. foo.
PROCEDURE DIVISION.
* Non-Compliant
ON 1
DISPLAY 'First time'
ELSE
DISPLAY 'Other times'.
END PROGRAM foo.