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
Visual COBOL to compile applications created with an older
Micro Focus product, and these applications use data names that are now reserved keywords in
Visual COBOL, 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:
- use the REMOVE Compiler directive to remove individual keywords from the reserved words list
- set the MFLEVEL Compiler directive to a lower level which corresponds to the level your applications are at (see the information about MFLEVEL of some
Micro Focus products further down this section). This removes all reserved keywords which have been added for levels above that level from the reserved words list.
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 aVisual COBOL 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:
- In the IDE, click
.
- Type MFLEVEL"nn" or REMOVE "ReservedWord" in
Additional Directives.
- Click
File > Save All.
MFLEVEL of some
Micro Focus product releases and reserved words added for them
These are the keywords that have been added to the reserved words list for some of the more recent
Micro Focus products:
- Visual COBOL R4 (MFLEVEL"16"):
- ATTRIBUTES
- ENCODING
- NAMESPACE
- NAMESPACE-
- VALIDATING
- XML-
- XML-SCHEMA
- Net Express and
Server Express versions 6.0 WrapPack 2 and 5.1 WrapPack 5 (MFLEVEL "15"):
- DATA-POINTER
- OBJECT-REFERENCE
- Net Express 6.0 and
Server Express 6.0 (MFLEVEL "14"):