Best Practice in Visual COBOL Development

Break down large projects

Projects with a large number of source files and build artefacts can be hard to navigate and slow to build. If you find this the case. we recommend that you review the contents of large projects and split them into separate projects (and possible separate solutions) in which you group items that are logically related. These projects can still be built in the same output folder if required.

For example:
  • If you have different versions of a product for different customers, keep common source in one project and a separate project for each customer. You could also have a master solution into which you add projects from other solutions by right-clicking a solution and selecting Add > Existing Project.
  • If you have core code that is rarely changed or recompiled, keep that in one project and have separate projects for those areas that change regularly.

Referencing common sources

To avoid repetition and reduce maintenance effort, you should consider keeping all your Compiler directive settings in a directives file and reference this file in each project. Similarly you should keep copybooks in a single project and add this project as a dependency to your COBOL projects.

If using managed code and multiple projects, use project references rather than file references.

Create templates

After creating and configuring a project, you can save the settings as a template that can be reused and distributed to other users. It can be added to the list of project types available when clicking File > New > Project and then typing COBOL in the search field of the Create a new project dialog box.

To create a template of the open project, click File > Export Template and follow the steps explained in the Export Template Wizard.

Use relative paths

Keep source relative to a base path and avoid full paths so that code is portable and easy to use with source control systems. You should also avoid using network shares or drives.