Compiling for debug

To debug a program, you need to configure the build process to create all the files needed for debugging.

Compile a project for debugging

You do this by using a build configuration for your project with the Compile for debugging option set to Yes. To see your current build configurations, and create new ones:

  1. Right-click on your project in COBOL Explorer
  2. Click Properties > Micro Focus > Build Configurations.
  3. Select a build configuration and click the COBOL tab.
  4. Check Enable configuration specific settings and ensure Compile for debugging is set to Yes.
  5. Click Apply and Close.
  6. Build your project.

    This produces the symbols (.idy) files for each program built, which are placed in the output folder of your project, alongside the compiled files. By default, you must use these symbols files to debug these compiled files.

Compile a standalone file for debugging

When working with standalone COBOL programs (such that are opened in the IDE without a project), the IDE first searches for the program symbols files to provide debug information.

If no .idy files are found in any of the locations specified on the Program Symbols (.IDY) page in Window > Preferences > Micro Focus > COBOL > Standalone Files, you need to manually recompile the file to produce the debug information. You can recompile from the command line or from within the IDE. To compile for debugging in the IDE:

  1. Check the Compiler directives for compiling standalone files - click Window > Preferences > Micro Focus > COBOL > Standalone Files > Compile.
  2. Ensure that the anim Compiler directive is included then click OK.
  3. Right-click your standalone file in the editor and click Compile.
Tip: If your program relies on copybook files that are not located in the same folder from which the program file was built, use Copybook Paths (Window > Preferences > Micro Focus > COBOL > Standalone Files > Copybook Paths) to specify the location to be used during debugging. This ensures not only that the copybook files are located and used during debug, but that their context (in relation to the calling program) is retained in the editor as you step through the code. These file locations can be specified both locally and remotely (if a remote host connection exists).