New Jersey Institute of Technology (NJIT)
Computer and Information Science Department (CIS)
CIS365-001:
File Structures and Management, Fall 1999
Professor: Michael
Bieber
Install just the Enterprise and ProViewer components of Fujitsu COBOL for this class. Later where you confirm components, you can add the View Softcopy from PC option, and also remove the following subcomponents from Enterprise COBOL using the Change button: PowerCOBOL and PowerForm.
To run a COBOL program you must edit the program (producing a .cob file), compile it into an object module (producing a .obj file), link it (producing an .exe file) and then execute the .exe file.
From Windows 95/NT Start menu, choose Programs - Fujitsu COBOL - Programming Staff. This is the COBOL environment. The File menu calls the editor. The Tools menu handles the other steps.
Start the editor from the FILE menu ("new" or "open").
Start the WINCOB compiler from the Tools menu in the Programming Staff window.
The compiler results are listed in a .msg window in the editor. (If your editor is already open, you might have to open the .msg window yourself.) If your program compiles cleanly, it will post the message "Statistics: Highest severity code=I, program unit = 1."
Syntax errors are listed in the following format: file line_number: code error-description
If you get errors, open your program in a second window in the editor to compare it to the error messages. Often fixing one error will fix several of the other ones, so you may wish to recompile before tackling all of them. Make sure your program compiles cleanly before linking.
Once your program compiles cleanly, you can link it using WINLINK from the Tools menu in the Programming Staff window.
If your linking results show an error, then you probably did not choose the compiler options correctly.
Execute your program using WINSVD from the Tools menu in the Programming Staff window. Do not use WINEXE if you want to use the debugging environment. You can execute your program fully within WINSVD. Choose "Start Debugging..." from the File menu and Browse... to select your .exe file.
After a while, you should see the Runtime Environment Setup window.
* To execute your program without debugging, choose Go from the Continue menu or toolbar.
* To execute your program showing you each step, choose Animate from the Continue menu. This is especially useful when "watching" the current value of variables (see below). You can set the animation speed from the Environments command under the Options menu.
* To execute your program one line at a time, pausing before executing the next line of code, choose Step Into from the Continue menu or toolbar. The line of code about to be executed is highlighted in yellow. (To execute a lower-level procedure without seeing the individual steps, choose Step Over.)
* To examine the value of a variable at any time, choose Data from the Debug menu or toolbar and enter the variable's name.
* To examine the value of a variable as your program executes, choose Watch Data from the Debug menu or toolbar. Type the variable name in the data-name field of the watch data form and choose set. Resize each watch window so you can also see your main program window.
* You can set up a Breakpoint from the Debug menu or toolbar at any program line. (Each breakpoint line is displayed in red.) Choosing Go will execute your program until that marked line and then pause, so you can examine the values of variables at that point. You can then Step Into to execute the marked line, or choose Go to continue to the next breakpoint.
- To abort your program, type ESC from the debugging window.
- If you cannot debug your program, then you probably did not specify the compiler or link options correctly. Go back and follow the instructions on this handout exactly.
- You cannot choose any debugging options once your program has finished executing. When no line of code is marked in yellow, your program has finished executing. Use Re-debug from the Continue menu or toolbar to reset debugging options and re-execute your program.
- You can split the window using the bar beneath the "X" in the top right-hand corner to see two parts of your program at once.
- If your program has DISPLAY or ACCEPT statements, these will appear in a separate CONSOLE window. Unfortunately you cannot see the CONSOLE window in debugging mode except when you are executing an ACCEPT statement.
- If you program uses ACCEPT to enter an alphanumeric variable (PIC XXX, etc.) you need to type in the exact number of characters specified in that PIC statement, even if you need to type in spaces to reach this amount.
To view your data files, choose COBFUT32 File Utility from the Tools menu in the Programming Staff window, and then choose Browse from the Commands menu. Note that you will need to know the record length for the file you wish to view.
This page: http://www.cis.njit.edu/~bieber/CIS365F99/howto.html