This tutorial uses the Hello COBOL World application you created previously and modified in the Configuring the Hello COBOL World Application tutorial. The current tutorial demonstrates some of the debugging features of Visual Studio.
You are going to add some extra code to the application that will help demonstrate some of the debugging features:
01 source-string pic x(10) value "AAbbAAbbCC".
inspect source-string replacing all 'A' by 'D' display source-string inspect source-string replacing characters by 'Q' before initial 'C' display source-string
The source-string variable is a string that has an initial value of "AAbbAAbbCC". Some of the characters in this string are replaced during the execution of the application.
Before you start debugging a multi-project application, you need to specify which the startup project is. This needs to be the HelloCOBOLWorld project. To make this the startup project:
This triggers a build of the project and starts the debugger. A few news windows and toolbars appear in the Visual Studio main window.
The first line in the Procedure Division of the helloworld.cbl program is highlighted showing the line the debugger will execute next.
The console window of the application is also opened but is empty because there is no information to display yet.
Note that Autos is showing the source-string variable and its initial value. This value will change as you step through the code.
You can now step through the code and see how the value of the SOURCE-STRING changes:
The first line in the program executes and the cursor moves to the next line in the code.
This executes the DISPLAY statement. Check the Windows Task bar for the application's console window which now also displays the value of SOURCE-STRING.
The cursor moves to the line that has the COPY statement and the debugger opens the HELLO.cpy copybook inline in the editor in the helloworld.cbl file.
This prints "Hello COBOL World" to the console window.
The application terminates and debugging stops and the IDE hides the windows and toolbars that are used during debugging.
You can save the solution and keep it in case you need to experiment with the Hello COBOL World application again.