Previous Topic Next topic Print topic


Debug the COBOL Project

The IDE provides debugging facilities, such as stepping, examining data item values and setting breakpoints. To see some of these facilities:

  1. Click Debug > Step Into, or Step Into button.

    A console opens for running the built programs.

    The source code for locking.cbl opens in the COBOL editor. The first statement DISPLAY SPACE is highlighted in yellow, with a yellow arrow pointing to it. This is the statement to be executed next.

  2. Execute the first statement, by clicking Debug > Step Into, Step Into button or pressing F11.
  3. Step the next statement, DISPLAY LOCKING01-00, in the same way.

    This statement displays some information about the application in the console.

  4. Execute the whole of the next PERFORM statement. To do this, click Debug > Step Over, Step Over button or pressing F10.

    Step Over executes all the code for a PERFORM or CALL statement in a single step.

  5. Continue stepping into the code, until you reach the ACCEPT statement accept choice at 2445.
  6. Step into the ACCEPT statement.

    The console now appears and waits for your input.

  7. Type 5, as before, and press Enter.

    Notice that the statement "EVALUATE CHOICE" is now highlighted ready for execution and that the value of the choice variable is now "5". You can see this by hovering over the choice variable in the Evaluate statement, and also by looking in the Autos pane at the bottom.

    If the Autos pane is not visible, open it by clicking Debug > Windows > Autos.

  8. To add the choice variable to the Watch list, right-click it and click Add Watch.

    This opens a separate pane, the Watch pane, which shows the values of watched variables.

  9. Continue stepping to the end.

You can close Visual Studio now. You do not need to explicitly save anything, because the files are automatically saved when you build them.

Previous Topic Next topic Print topic