Previous Topic Next topic Print topic


Debugging Mixed Language Applications

Java class calling a COBOL program

In order to step though a Java class and any COBOL program it calls, you first need to start debugging the COBOL program with a Wait for Application Attachment debug configuration, and then start debugging the calling Java class with a Java Application debug configuration. Note that there are several ways to create debug configurations and start debugging - the following procedure is just one example.

Before you start, make sure both programs are compiled for debugging.

  1. Select the Java project in COBOL Explorer.
  2. Click Run > Debug Configurations and click Java Application.
  3. Click the New button.
  4. On the Main tab, set Main class to the class containing Main.
  5. To make sure the debugger is invoked when the COBOL program is called, do one of the following.
    • Set the variables in the Environment tab:
      • Set COBPATH to the .bin directory of the COBOL project
      • Set COBSW to "+A"
    • Use CBL_DEBUGBREAK or CBL_DEBUG_START statements in the COBOL program
  6. Select the COBOL project.
  7. Click Run > Debug Configurations and click Wait for Application Attachment.
  8. Click Debug. This puts the program in a waiting state; debugging won't start for this program until it is called by the Java class. If you are prompted to switch to the Debug view, click No.
  9. Select the Java project and click Run > Debug as > Java application to start debugging.

Eclipse then opens the Debug perspective, so you can step through the Java code as it executes, and see and change the values of data items. When the class calls the COBOL program, the Debug perspective then switches to the COBOL source so you can step through and track the COBOL code too.

Previous Topic Next topic Print topic