Created On:  11 February 2010

Problem:

Compiling the following program, while specifying no particular compiler directives, produces a 301-S error message, as shown:

        1 77 field-1 pic x(20) value "00000abc".
        2
        3 procedure division.
        4 examine field-1 replacing leading "0" by " "
        5 exhibit named field-1
        4 examine field-1 replacing leading "0" by " "
       
* 301-S********
         **** Unrecognised verb
        
However, if the EXAMINE is changed to an INSPECT, the error doesn't occur.  Why isn't EXAMINE recognized, when INSPECT is?

Resolution:

EXAMINE is a feature of the IBM OS/VS dialect of COBOL.  Where EXAMINE is documented in the Micro Focus Language Reference Manual, the description is surrounded by a box with the caption "OSVS."  There is a compiler directive named OSVS, but the default is NOOSVS, so by default EXAMINE is not recognized as a reserved word.  You can use EXAMINE if you specify the OSVS compiler directive, for example:

        cob -C OSVS myprog.cbl
      
Incident #1252383