Best practice when upgrading a legacy application

There are different ways in which you can start using Visual COBOL to develop your applications created with a legacy Micro Focus product such as Net Express, Server Express, or Mainframe Express.

The quickest approach would be to open individual files in Eclipse and use the IDE to edit, compile and debug them. The approach that Micro Focus recommends is to create a project and take advantage of the many project-handling features offered by Visual COBOL.

The following sections highlight stages of the development process where Micro Focus has recommendations about the best way to proceed when upgrading large projects.

Create a project for your source code

Regardless of whether you have used a project file before, Micro Focus recommends that you create one or more projects in Visual COBOL for your application files. Using a project file means all of the Eclipse productivity features will be available to you. See Working with projects for more information.

If you have a Net Express project for your application, note the following:

  • Eclipse projects are not direct mappings of existing Net Express projects.
  • A convenient way to import the project into Eclipse is to use the Net Express Project Import wizard. The wizard analyzes your existing Net Express projects, creates a solution with one or more projects and sets any Compiler directives that were used in the Net Express project.
  • The wizard helps you quickly and easily move your sources from Net Express to Eclipse. It might not create a perfectly-optimized project, and you might need to rethink and restructure the initial Eclipse projects once you have moved your source files to them.

Import your sources into an Eclipse project

Use one of the following approaches to to create Eclipse projects and add your source files to them:

  • Use the Net Express Project Import wizard - uses an existing Net Express project. Analyzes the project, creates one or more Eclipse projects that use the settings used in Net Express, and adds source files to them.
  • Create an Eclipse project and add your source files to them.

Choosing a project type

Visual COBOL provides the following project types:

Eclipse project type Description
COBOL project Choose this type for your existing legacy applications.
COBOL JVM project Choose this project type if you want to take advantage of the functionality of the JVM and extend your applications.

Your existing native COBOL applications should compile in a JVM COBOL project without any changes required.

The benefits of switching to a JVM COBOL project include:

  • The JVM COBOL dialect makes more COBOL language features adapted for the JVM available to you.
  • Easier interaction with other managed languages such as Java.
  • The ability to take advantage of a number of widely-used Java framework features.
Restriction: Code analysis is not available in JVM COBOL projects.

Using tabs in your files

Tab size in legacy Micro Focus products (such as Net Express) defaulted to eight spaces while it is four spaces by default in Eclipse. This means that you might get Compiler errors when you try to compile your COBOL sources in Visual COBOL.

If you have your application's Net Express project, you can use the Net Express Project Import wizard in Visual COBOL to upgrade the application. The wizard automatically converts the tabs to four spaces.

You can also convert tabs to spaces in one of the following ways:

  • Ensure that on the Windows > Preferences > Micro Focus > COBOL > Editor page, Insert spaces for tabs is enabled. When you import files into Eclipse, the tabs will be converted automatically.
  • Set the SOURCETABSTOP"4" Compiler directive that converts tabs to four spaces.
  • Click Source > Convert Tabs to Spaces from the main menu when the file is open in the editor.

Do not change the size of the tabs in the Eclipse preferences, as these preferences apply to all other programming languages you might be working on in the IDE.

Micro Focus recommends that you use spaces instead of tabs in Visual COBOL.

Rename variables that are now reserved words

Micro Focus continues to enhance the COBOL language. New Micro Focus product releases use newer levels of the COBOL language where each level has new words added to the list of reserved COBOL keywords.

When you are upgrading an application from a product that uses an earlier level of the COBOL language, you might find that some of the variable names are now reserved words. See the Upgrade Guide for how you can solve this problem.

To avoid confusion, Micro Focus recommends that you rename the variables whose names are now reserved words.

Functionality not supported in Visual COBOL

Note that some functionality that was available in older Micro Focus products might work differently or be superseded in Visual COBOL. See Differences between Enterprise Developer and Net Express and Mainframe Express in the Upgrade Guide for more.