Compile at the Command Line Using Existing Build Scripts

Application executables that were compiled using earlier Micro Focus products must be recompiled from the sources using Visual COBOL. If you do not recompile, you may receive an error. The exact error depends on the operating system you are running.

Most Net Express projects should compile cleanly using your existing build scripts and makefiles without any changes to your code, as Visual COBOL can use the cobol and cbllink commands to create .int and .gnt files. By specifying the ILGEN compiler directive you can also use these commands to create .NET-compatible .exe files, or use the JVMGEN directive to create JVM-compatible .exe files.

Fixing compilation issues

You might encounter some problems when compiling your Net Express applications in Visual COBOL.

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). Applications created with an older Micro Focus product might use data names that are now reserved keywords in Visual COBOL, which can result in a COBOL syntax error COBCH0666 ("Reserved word used as data name or unknown data description qualifier"). See Reserved Words Table for a comprehensive list of reserved words and level at which they are supported.

Also, these Net Express compiler directives are no longer supported:
  • 01SHUFFLE
  • 64KPARA
  • 64KSECT
  • AUXOPT
  • CHIP
  • COBIDY
  • DATALIT
  • EANIM
  • EDITOR
and the pseudovariables of the following Net Express environment variables are obsolete and can't be used.
  • BASENAME
  • FILENAME
  • PATH
  • TARGETDIR

You should consider using the following methods to solve these problems:

  • Rewrite the source to avoid using these keywords in your code and directives files.
  • Use the REMOVE Compiler directive to remove individual keywords from the reserved words list.
  • Use the MF or MFLEVEL compiler directive to select an earlier version of Micro Focus COBOL that your code is compatible with. For example, setting MFLEVEL"12" ensures compatibility with Mainframe Express 3.0 and 3.1; Net Express 4.0, 5.0, and 5.1; and Server Express 4.0, 5.0, and 5.1. Refer to Reserved Words Table for the value to use to ensure support for your existing reserved words.

Setting REMOVE and MFLEVEL directives from the command line

To use REMOVE from a Visual 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 REMOVE and MFLEVEL 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"

Single-threaded run-time system

The single-threaded run-time system is not available in Visual COBOL on Windows. Instead, both single-threaded and multi-threaded applications run using the multi-threaded run-time system. This has no effect on your existing applications.