Resolving conflicts between reserved keywords and data item names

Micro Focus continues to enhance the COBOL language, for example, by expanding the list of reserved COBOL words and adding new keywords to it as part of new levels of the COBOL language. Each Micro Focus release corresponds to a particular level. You can use the MFLEVEL Compiler directive to enable Micro Focus-specific reserved words in your code and change the behavior of certain features to be compatible with a specific level of the language.

If you use Enterprise Developer to compile applications created with an older Micro Focus product, and these applications use data names that are now reserved keywords in Enterprise Developer, you receive a COBOL syntax error COBCH0666 ("Reserved word used as data name or unknown data description qualifier"). To work around this issue and continue using some of the reserved words as data names in your source code, you can either:

You can set both directives from the command line, in your source code, or in the Additional directives field in the project's COBOL properties.

Setting directives from the command line

To use REMOVE from an Enterprise Developer command prompt, type the following:

cobol myprogram.cbl remove(title) ;

The command above removes TITLE as a keyword from the language so you can use it as an identifier in a COBOL program.

To use the set of reserved words that was used for Net Express v5.1 WrapPack 5, use this command line:

cobol myprogram.cbl mflevel"15" ;

Setting directives in the source code

To set either one of the directives in your source code, type the following starting with $ in the indication area of your COBOL program:

$set remove "ReservedWord"

Or:

$set mflevel"nn"

Setting directives in the IDE

To set either one of the directives in the project's properties:

  1. In the IDE, click Project > <myproject> Properties > COBOL.
  2. Type MFLEVEL"nn" or REMOVE "ReservedWord" in Additional directives.
  3. Click File > Save All.