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.
- Select the Java project in COBOL Explorer.
- Click
Run > Debug Configurations and click
Java Application.
- Click the
New button.
- On the
Main tab, set
Main class to the class containing Main.
- 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
- Select the COBOL project.
- Click
Run > Debug Configurations and click
Wait for Application Attachment.
- 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.
- 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.