We will be using lab1c.cob to learn how to run the debugger.
First, check the program code and ensure that the PIC clause for the yearly interest rate is 999 and not 9V99. One edition of the book had it wrong and the sample version of the code we made available for copying also had it wrong. It needs to be 999.
In the terminal window click the top right corner button, the one that looks like a box (not the dot) to maximize your terminal window. You can toggle this button to enlarge and reduce your terminal window. You MUST maximize your terminal window to run the debugger effectively (actually, you only need to maximize the terminal window before the runcbl command). Once you have maximized your terminal window, type the following commands to first compile the program with debugging information and then to run the lab in the debugger:
ccbl -Zd lab1c.cob runcbl -d lab1c
You will see a menu at the top of the window (press F10 to activate the menu at the top of the screen, if necessary), a source code area and a command area at the bottom. A list of debugger commands can be accessed by typing help in the command area (use the up and down arrow keys to scroll and press enter to exit the help screen). Typing q! on the command line will exit the debugger at any time. Notice that a black box exists to the left of the PERFORM statement in paragraph 000-CALCULATE-FUTURE-VALUES. This is the cursor for the debugger.
A few commands that you will use frequently are given below (do not try them yet!)
Create a file called lab3ques.txt to hold the answers to the questions given below.
Compile the program appropriately and start the debugger
Answers to these questions are here (Word doc)
Single step 4 times.
Single step 1 more time.
Single step 3 more times.
You will need to single step twice to enter each set of input data. When asked, enter 10000 for the investment amount, 10 for the number of years and 100 for the yearly interest rate (remember, the program does not accept editted input. These inputs represent the values 100.00, 10 and 10.0). Once you have entered the data the debugger cursor should be to the left of the statement MOVE INVESTMENT-AMOUNT TO FUTURE-VALUE.
Single step two more times.
Set a breakpoint at paragraph 120-CALCULATE-NEXT-FV (A B should appear to the left of this paragraph name). Enter g twice.
Enter g twice more.
Enter 1 to perform another calculation and enter the same input information.
Clear all breakpoints. Type g. When asked to end the program or perform another calculation, end the program.