Not all source modules need to be compiled in debug mode to use CodeWatch. You may compile in debug mode only those modules you want to debug.
If you debug a program with multiple modules and the main program is compiled in debug mode, the initial environment will always be the main program module.
If the main program is not compiled in debug mode, the initial environment will be the first debug module specified in the link step.
The COBOL program amort.cob is an example of a program with multiple modules. To debug just the subprogram MPCALC, only mpcalc.cob needs to be compiled in debug mode. To do this, use the following command sequence:
$ lpicobol amort.cob $ lpicobol mpcalc.cob -deb $ ldcobol amort.o mpcalc.o -o amort $ cwcmd amort
The dollar character ($) in this command sequence is the system prompt.
The debugger is then invoked and MPCALC is the initial evaluation environment.