Debugging optimized COBOL programs
Before you debug an optimized COBOL program, you must compile it with the correct compiler options. See Choosing TEST or NOTEST compiler suboptions for COBOL programs.
The following list describes the tasks that you can do when you debug optimized COBOL programs:
- You can set breakpoints. If the optimizer moves or removes a statement, you cannot set a breakpoint at that statement.
- You can display the value of a variable by using the
LISTorLIST TITLEDcommands. z/OS® Debugger displays the correct value of the variable. - You can step through programs one statement at a time, or run your program until you encounter a breakpoint.
- You can use the
SET AUTOMONITORandPLAYBACKcommands. - You can modify variables in an optimized program that was compiled
with one the following compilers:
- Enterprise COBOL for z/OS, Version 4 and 5
- Enterprise COBOL for z/OS and OS/390®, Version 3 Release 2 or later
- Enterprise COBOL for z/OS and OS/390, Version 3 Release 1 with APAR PQ63235 installed
- COBOL for OS/390 & VM, Version 2 Release 2
- COBOL for OS/390 & VM, Version 2 Release 1 with APAR PQ63234 installed
EJPDsuboption of theTESTcompiler option. However, variables that are declared with the VALUE clause to initialize them cannot be modified. - If you are using Enterprise COBOL for z/OS, Version 4 and 5, and specify
the
EJPDsuboption of theTESTcompiler option, theJUMPTOandGOTOcommands are fully enabled by the compiler for use in a debugging session. - If you are using Enterprise COBOL for z/OS Version 4 and using
OPTand theNOHOOKorNONE, andNOEJPDsuboptions of theTESTcompiler option, theGOTOandJUMPTOcommands are not enabled by the compiler. In this case, there is limited support forGOTOandJUMPTOwhen you run the commands withSET WARNING OFF. However, the results of usingGOTOorJUMPTOin this case might be unpredictable and any problems encountered are not investigated by IBM® service. - If you are using Enterprise COBOL for z/OS Version 5 or later, and the programs are complied with
OPTandNOEJPDof theTESTcompiler option or optimized by Automatic Binary Optimizer for z/OS, theGOTOandJUMPTOare still allowed but you need to first execute theSET WARNING OFFcommand. However, the results of usingGOTOorJUMPTOin this case might be unpredictable and any problems encountered are not investigated by IBM service. - If you are using Enterprise COBOL for z/OS
Version 4 or
earlier and using
OPT, the information about section and paragraph names is not predictable. CommandsLIST NAMES LABELSandAT LABELare affected, as well as the ability of the remote debugger to list the section and paragraph names when the module is expanded in the Modules view.
The enhancements to the compilers help you create programs that can be debugged in the same way that you debug programs that are not optimized, with the following exceptions
- You cannot change the flow of your program.
- You cannot use the
AT CALL entry_namecommand. Instead, use theAT CALL *command. - If the optimizer discarded a variable, you can refer to the variable
only by using the
DESCRIBE ATTRIBUTEScommand. If you try to use any other command, z/OS Debugger displays a message indicating that the variable was discarded by the optimization techniques of the compiler. - If you use the
ATcommand, the following restrictions apply:- You cannot specify a line number where all the statements have been removed.
- You cannot specify a range of line numbers where all the statements have been removed.
- You cannot specify a range of line numbers where the beginning point or ending point specifies a line number where all the statements have been removed.
The Source window does display the variables and statements that the optimizer removed, but you cannot use any z/OS Debugger commands on those variables or statements. For example, you cannot list the value of a variable removed by the optimizer.