This COBOL system is integrated with Microsoft Visual Studio. The techniques you use to develop and debug native COBOL applications are much the same as the techniques you use with Visual Studio to develop nonCOBOL applications.
The development environment is Visual Studio, which provides all the functionality to manage projects and debug applications. It includes:
- Templates for native COBOL projects such as mainframe applications, Windows applications and console applications, and also the ability to add your own COBOL project type
- COBOL language colorization when editing and debugging
- Information provided when hovering over COBOL variables
- COBOL sensitive debugging including watch windows and breakpoints
COBOL applications previously built in the Micro Focus IDEs can be built with Visual Studio. The main differences between the IDEs are as follows:
- Solutions, projects and source file folders
- A solution is a container holding one or more projects that work together to create an application. The solution and its projects are reflected in the file system as folders, with solution folder containing the project folders, and the project folders containing the main COBOL source files. The folder tree shown in Solution Explorer mirrors the folder tree on disk.
If your solution has files that are shared across multiple projects, such as copybooks, you can create a folder for the shared files in the solution. COBOL copybooks can be held in folders outside the solution or project folders. You specify the location of the copybooks in the project properties.
- Copybook extensions and source file extensions
- The default extensions for source files are cbl, cob, and cpy. You can define other copybook extensions, using the COPYEXT Compiler directive. In addition, alternative file extensions need to be identified to the text editor, so that the files can be found when searching.
To specify that a certain extension is a copybook, you need to add it to the list of copybook extensions (in
Tools > Options > Text Editor > Micro Focus COBOL > Advanced > Copybook extensions), and then add it to your project (type
copyext(ext1,ext2) in
Additional Directives on the
COBOL page in your project's properties).
To associate extensions and extensionless files with COBOL, go to
Tools > Options > Text Editor > File Extensions.
- Source code character values
- We recommend that you replace any non-text characters representing hexadecimal values with a hexadecimal character string definition.
In Net Express and Mainframe Express, COBOL source files are written using the ANSI character set and can contain characters using the full range of hexadecimal values from 00 to FF. When a source file is written to disk characters with values below hex 20 are NULL protected, that is, a character pair is written to disk, NULL(hex 00) followed by the original character.
- Executables created in Visual Studio
- In Visual Studio, each project creates a single executable, either an .exe or a .dll.You can build native COBOL projects to .int or .gnt code, and package these as a Micro Focus library file (.lbr). To choose the type of executable, its location and other build settings, specify these in the project's properties.
- Build configurations
- Previously, you specified how to build a project in Build Settings and Project Settings. In Visual Studio, you specify this in a build configurations, such as the default Debug or Release configuration, or in a configuration that you create.
- Running or debugging an application
- Where a solution has multiple projects, you need to ensure that the application's executable can locate the dependent project executables (.dll) and their symbol (.idy) files. To do this, you have several options:
- In the exe project, add references to the projects that create the dlls. Specify where the symbol files are located using
Debug > Options and Settings.
- Specify that your projects put their output executables in the same folder as the solution executable (such as a bin folder). Copy the symbol files to this folder when building the dll, by setting up a post build event in the project's properties. See
Project > Properties > COBOL > Advanced > Build Events.
- Navigating the source
- In Net Express or Mainframe Express, when you have built a COBOL application, context information is often used for program navigation. Visual Studio does not provide the same capability but you can achieve the same result by using one or more of the following options:
- Edit > Find and Replace > Find in Files. The results of the find are displayed in the Find Results tab. You can then double-click an item within the find results and the source file is then loaded into a text editor view at the identified location.
- In the program editor, position the cursor on an object, right-click, and select
Go To Definition or press
F12. This shows the definition of the object in a popup window.
- In the program editor, position the cursor on an object, right-click, and select
Find All References or press
Shift+F12. This lists all instances of the object in the Find Symbol Results window.
- Build results in the Output view and the Error List
- When you build an application, you can view the build results in the Output view and the Error List. You can double-click a build message to identify a source. You can also double-click an item in the Error List to load the source file into a text editor at the relevant location. Turn on these panes, using
View > Output and
View > Error List.