Debug Tooluser
Debug Tooluser
Debug Tooluser
User’s Guide
Version 4 Release 1
SC18-9012-00
Debug Tool for z/OS
Debug Tool Utilities and Advanced Functions for
z/OS
User’s Guide
Version 4 Release 1
SC18-9012-00
Note!
Before using this information and the product it supports, be sure to read the
general information under “Notices” on page 311.
Contents v
Chapter 25. Debugging an assembler COBOL command format . . . . . . . . 188
program in full-screen mode . . . . . 163 COBOL compiler options in effect for Debug
Example: sample assembler program for debugging 163 Tool commands . . . . . . . . . . . 188
Defining a compilation unit as assembler and COBOL reserved keywords . . . . . . . . 189
loading debug data . . . . . . . . . . . 166 Using COBOL variables with Debug Tool . . . . 189
Defining a compilation unit in a different load Accessing COBOL variables . . . . . . . 189
module as assembler . . . . . . . . . . . 167 Assigning values to COBOL variables . . . . 189
Multiple compilation units in a single assembly 167 Example: assigning values to COBOL variables 189
Halting when certain assembler routines are called 168 Displaying values of COBOL variables . . . . 191
Displaying and modifying the value of assembler Using DBCS characters in COBOL . . . . . . 191
variables or storage . . . . . . . . . . . 168 %PATHCODE values for COBOL . . . . . . . 192
Halting on a line in assembler only if a condition is Declaring session variables in COBOL . . . . . 193
true . . . . . . . . . . . . . . . . 169 Debug Tool evaluation of COBOL expressions . . 193
Debugging assembler when debug data is only Displaying the results of COBOL expression
available for a few parts . . . . . . . . . . 169 evaluation . . . . . . . . . . . . . 194
Getting an assembler routine traceback . . . . . 170 Using constants in COBOL expressions . . . . 194
Finding unexpected storage overwrite errors in Using Debug Tool functions with COBOL . . . . 195
assembler . . . . . . . . . . . . . . 170 Using %HEX with COBOL . . . . . . . . 195
Using the %STORAGE function with COBOL 195
Qualifying variables and changing the point of
Chapter 26. Customizing your view in COBOL . . . . . . . . . . . . 195
full-screen session . . . . . . . . . 171 Qualifying variables in COBOL . . . . . . 195
Defining PF keys . . . . . . . . . . . . 171 Changing the point of view in COBOL . . . . 197
Defining a symbol for commands or other strings 171 Considerations when debugging a COBOL class 197
Customizing the layout of windows on the session Debugging VS COBOL II programs . . . . . . 198
panel . . . . . . . . . . . . . . . . 172 Finding the listing of a VS COBOL II program 198
Opening and closing session panel windows 173
Resizing session panel windows . . . . . . 173 Chapter 29. Debugging PL/I programs 199
Zooming a window to occupy the whole screen 173
Debug Tool subset of PL/I commands . . . . . 199
Customizing session panel colors . . . . . . . 174
PL/I language statements . . . . . . . . . 199
Customizing profile settings . . . . . . . . 175
%PATHCODE values for PL/I . . . . . . . . 200
Saving customized settings in a preferences files 177
PL/I conditions and condition handling . . . . 201
Entering commands in PL/I DBCS freeform format 202
Part 5. Debugging your programs Initializing Debug Tool when TEST(ERROR, ...)
by using Debug Tool commands . 179 run-time option is in effect . . . . . . . . . 202
Debug Tool enhancements to LIST STORAGE PL/I
command . . . . . . . . . . . . . . 202
Chapter 27. Entering Debug Tool PL/I support for Debug Tool session variables . . 202
commands . . . . . . . . . . . . 181 Accessing PL/I program variables . . . . . . 202
Using uppercase, lowercase, and DBCS in Debug Accessing PL/I structures . . . . . . . . . 203
Tool commands . . . . . . . . . . . . 181 Debug Tool evaluation of PL/I expressions . . . 204
DBCS . . . . . . . . . . . . . . . 181 Supported PL/I built-in functions . . . . . . 204
Character case and DBCS in C and C++ . . . 182 Using SET WARNING PL/I command with
Character case in COBOL and PL/I . . . . . 182 built-in functions . . . . . . . . . . . 204
Abbreviating Debug Tool keywords . . . . . . 182 Unsupported PL/I language elements . . . . . 205
Entering multiline commands in full-screen and
line mode . . . . . . . . . . . . . . 183 Chapter 30. Debugging C and C++
Entering multiline commands in a command file 183
Entering multiline commands without continuation 184
programs . . . . . . . . . . . . . 207
Using blanks in Debug Tool commands . . . . 184 Debug Tool commands that resemble C and C++
Entering comments in Debug Tool commands . . 184 commands . . . . . . . . . . . . . . 207
Using constants in Debug Tool commands. . . . 185 Using C and C++ variables with Debug Tool . . . 208
Getting online help for Debug Tool command Accessing C and C++ program variables . . . 208
syntax . . . . . . . . . . . . . . . . 185 Displaying values of C and C++ variables or
expressions . . . . . . . . . . . . . 208
Assigning values to C and C++ variables . . . 209
Chapter 28. Debugging COBOL %PATHCODE values for C and C++ . . . . . 209
programs . . . . . . . . . . . . . 187 Declaring session variables with C and C++ . . . 210
Format for a COBOL source listing and debug file 187 C and C++ expressions . . . . . . . . . . 211
Debug Tool commands that resemble COBOL Calling C and C++ functions from Debug Tool . . 212
statements . . . . . . . . . . . . . . 187 C reserved keywords . . . . . . . . . . . 213
Contents vii
HLL constants . . . . . . . . . . . . 266 How does Debug Tool locate source and listing
Debug Tool commands that resemble HLL files? . . . . . . . . . . . . . . . . 289
commands . . . . . . . . . . . . . . 266 How does Debug Tool locate COBOL side files? 290
Qualifying variables and changing the point of How does Debug Tool locate EQALANGX files 290
view . . . . . . . . . . . . . . . . 267
Qualifying variables . . . . . . . . . . 267 Appendix C. Examples: Preparing
Changing the point of view . . . . . . . 268 programs and modifying setup files
Handling conditions and exceptions in Debug Tool 269
Handling conditions in Debug Tool . . . . . 270
with Debug Tool Utilities . . . . . . 291
Handling exceptions within expressions (C and Creating personal data sets . . . . . . . . . 291
C++ and PL/I only) . . . . . . . . . . 271 Starting Debug Tool Utilities . . . . . . . . 292
Debugging multilanguage applications . . . . . 271 Compiling or assembling your program by using
Debugging an application fully supported by Debug Tool Utilities . . . . . . . . . . . 292
Language Environment . . . . . . . . . 271 Modifying and using a setup file . . . . . . . 295
Debugging an application partially supported Run the program in foreground . . . . . . 295
by Language Environment . . . . . . . . 272 Run the program in batch . . . . . . . . 296
Using session variables across different
languages . . . . . . . . . . . . . 272 Appendix D. Notes on debugging in
Coexistence with other debuggers . . . . . . 273 batch mode . . . . . . . . . . . . 297
Coexistence with unsupported HLL modules . . . 274
Appendix E. Notes on debugging in
Chapter 41. Debugging multithreading remote debug mode . . . . . . . . 299
programs . . . . . . . . . . . . . 275 Tip on using the IBM Distributed Debugger . . . 299
Restrictions when debugging multithreading
applications . . . . . . . . . . . . . . 275 Appendix F. Syntax of the TEST
Compiler option . . . . . . . . . . 301
Chapter 42. Debugging across Syntax for the C TEST compiler option . . . . . 301
multiple processes and enclaves . . . 277 Syntax for the C++ TEST compiler option . . . . 303
Starting Debug Tool within an enclave . . . . . 277 Syntax for the COBOL TEST compiler option . . . 304
Viewing Debug Tool windows across multiple Syntax for the PL/I and Enterprise PL/I TEST
enclaves . . . . . . . . . . . . . . . 277 compiler options . . . . . . . . . . . . 307
Using breakpoints within multiple enclaves . . . 278
Ending a Debug Tool session within multiple Notices . . . . . . . . . . . . . . 311
enclaves . . . . . . . . . . . . . . . 278 Copyright license . . . . . . . . . . . . 312
Using Debug Tool commands within multiple Programming interface information . . . . . . 312
enclaves . . . . . . . . . . . . . . . 278 Trademarks and service marks . . . . . . . 312
To use this document and debug a program written in one of the supported
languages, you need to know how to write, compile, and run such a program.
Licensed documents are available only to customers with a z/OS license. Access to
these documents requires an IBM Resource Link user ID and password, and a key
code. With your z/OS order you received a Memo to Licensees, (GI10-0671), that
includes this key code.
To obtain your IBM Resource Link user ID and password, log on to:
http://www.ibm.com/servers/resourcelink
Note: You cannot access the z/OS licensed documents unless you have registered
for access to them and received an e-mail confirmation informing you that
your request has been processed.
You can use the PDF format on either z/OS Licensed Product Library CD-ROM or
IBM Resource Link to print licensed documents.
The LookAt Web site also features a mobile edition of LookAt for devices such as
Pocket PCs, Palm OS, or Linux-based handhelds. So, if you have a handheld
device with wireless access and an Internet browser, you can now access LookAt
message information from almost anywhere.
To use LookAt as a TSO/E command, you must have LookAt installed on your
host system. You can obtain the LookAt code for TSO/E from a disk on your z/OS
Collection (SK3T-4269) or from the LookAt Web site’s Download link.
The last several chapters list notices, bibliography, and glossary of terms.
Debug Tool provides facilities that apply only to programs compiled with specific
levels of compilers. Because of this, Debug Tool for z/OS User’s Guide uses the
following terms:
Syntax diagrams pictorially display the order and parts (options and arguments)
that comprise a command statement. They are read from left to right and from top
to bottom, following the main path of the horizontal line.
Symbols
The following symbols may be displayed in syntax diagrams:
Symbol Definition
─── Indicates the beginning of the syntax diagram.
─── Indicates that the syntax diagram is continued to the next line.
─── Indicates that the syntax is continued from the previous line.
─── Indicates the end of the syntax diagram.
Syntax items
Syntax diagrams contain many different items. Syntax items include:
v Keywords - a command name or any other literal information.
v Variables - variables are italicized, appear in lowercase and represent the name
of values you can supply.
v Delimiters - delimiters indicate the start or end of keywords, variables, or
operators. For example, a left parenthesis is a delimiter.
v Operators - operators include add (+), subtract (-), multiply (*), divide (/), equal
(=), and other mathematical operations that may need to be performed.
v Fragment references - a part of a syntax diagram, separated from the diagram to
show greater detail.
v Separators - a separator separates keywords, variables or operators. For example,
a comma (,) is a separator.
Syntax examples
The following table provides syntax examples.
Table 1. Syntax examples
Item Syntax example
Required item.
KEYWORD required_item
Required items appear on the main path of the horizontal
line. You must specify these items.
Required choice.
KEYWORD required_choice1
A required choice (two or more items) appears in a required_choice2
vertical stack on the main path of the horizontal line. You
must choose one of the items in the stack.
Optional item.
KEYWORD
Optional items appear below the main path of the optional_item
horizontal line.
Optional choice.
KEYWORD
An optional choice (two or more items) appears in a optional_choice1
vertical stack below the main path of the horizontal line. optional_choice2
You may choose one of the items in the stack.
Default.
default_choice1
Default items appear above the main path of the KEYWORD
horizontal line. The remaining items (required or optional_choice2
optional) appear on (required) or below (optional) the optional_choice3
main path of the horizontal line. The following example
displays a default with optional items.
Variable.
IBM Corporation
H150/090
555 Bailey Avenue
San Jose, CA 95141-1003
USA
v Fax your comments to this U.S. number: (800)426-7773.
When you send information to IBM, you grant IBM a nonexclusive right to use or
distribute the information in any way it believes appropriate without incurring any
obligation to you.
You can use Debug Tool to debug your programs in batch mode, interactively in
full-screen mode, or in remote debug mode using a workstation user interface
provided by the compiler product.
Table 2 maps out the Debug Tool interfaces and compilers or assemblers each
interface supports.
Table 2. Debug Tool interface type by compiler or assembler
Full-screen
Compiler or assembler Batch mode mode Remote mode
VS COBOL II V1R3 & V1R4 (with U U
limitations)
AD/Cycle COBOL/370 V1R1 U U
COBOL for MVS & VM U U U
COBOL for OS/390 & VM U U U
Enterprise COBOL for z/OS and OS/390 U U U
OS PL/I 2.1, 2.2, & 2.3 (with limitations) U U
PL/I for MVS & VM U U
Enterprise PL/I U U U
AD/Cycle C/370 V1R2 U U
C/C++ for MVS/ESA Version 3 Release 2 U U
OS/390 C/C++ feature version 1.3 and U U
earlier
OS/390 C/C++ feature version 2.4 and later U U U
z/OS C/C++ feature U U U
IBM High Level Assembler (HLASM) U U U
Table 3 maps out the Debug Tool interfaces and subsystems each interface
supports.
Table 3. Debug Tool interface type by subsystem
Full-screen
Subsystem Batch mode mode Remote mode
TSO U U U
Table 4 shows the operating system and communication protocol for each remote
debugger.
Table 4. Remote debugger by operating system and communication protocol
Operating
system and z/OS or VisualAge for WebSphere
communication VisualAge COBOL OS/390 Java, Enterprise Studio Enterprise
protocol for Windows C/C++ Edition Developer
OS/2 4.0 and U
TCP/IP
Windows NT 4.0 U U U U
and TCP/IP
Windows 2000 U U U
and TCP/IP
Windows XP and U U
TCP/IP
Windows 95 and U
TCP/IP
Related concepts
“Debug Tool interfaces”
Related tasks
Chapter 4, “Planning your debug session and collecting resources,” on page 21
Chapter 20, “Using full-screen mode: overview,” on page 93
Related references
Debug Tool for z/OS Reference and Messages
You can debug all languages supported by Debug Tool in full-screen mode.
You can debug non-TSO programs in full-screen mode by using the full-screen
mode through a VTAM terminal facility. For example, you can debug a COBOL
batch job running in MVS/JES, a DB2 Stored Procedure, an IMS transaction
running on a IMS MPP region, or an application running in UNIX System Services.
Contact your system administrator to determine if the full-screen mode through a
VTAM terminal facility is active on your system.
Related tasks
Debug Tool for z/OS Customization Guide
Batch mode
You can use Debug Tool command files to predefine series of Debug Tool
commands to be performed on a running batch application. Neither terminal input
nor user interaction is available for batch debugging of a batch application. The
results of the debugging session are saved to a log, which you can review at a later
time.
Debug Tool, in conjunction with the remote debuggers provided by some compiler
products and WebSphere Studio Enterprise Developer, provides users with the
ability to debug host programs, including batch, through a graphical user interface
(GUI) on the workstation. The remote debuggers VisualAge Remote Debugger and
IBM Distributed Debugger are available through products such as:
v C/C++ Productivity Tools for OS/390
v VisualAge COBOL for Windows 3.0
v VisualAge for Java, Enterprise Edition for OS/390
v VisualAge PL/I for Windows
Remote debug mode also provides important additional functions such as the
ability to interactively debug batch processes. For example, a COBOL batch job
running in MVS/JES, or a COBOL CICS batch transaction, can be interactively
debugged through a TCP/IP connection to a workstation equipped with a remote
debugger. You can debug the following applications:
v VisualAge PL/I for OS/390 applications
v Enterprise PL/I for z/OS and OS/390 applications
The Debug Tool Web site contains a current list of environments supporting remote
debug mode.
For more information, visit the IBM Software Web site at:
http://www.ibm.com/software/awdtools/
Related references
“Debug Tool session panel” on page 93
Debug Tool provides a tool called Debug Tool Setup Utility (DTSU) to help you
create and manage setup files which can help you run your programs. Debug Tool
Utilities and Advanced Functions adds tools to help you do the following tasks:
v Prepare your high-level language programs for debugging by helping you
convert, compile, and link.
v Prepare your assembler programs for debugging by helping you assemble, create
debug information, and link.
v Conduct analysis on your test cases to determine how thoroughly your test cases
test your programs (also called code coverage).
v Start and run your program in foreground or batch by storing and using setup
information. Setup information can be the run-time parameters, libraries, and
names of input and output data sets.
v For IMS Version 8, browse and edit the Language Environment run-time
parameters table.
v Create a batch job for private IMS message region with customized load libraries
and region attributes.
The combination of DTSU and these tools is called Debug Tool Utilities.
Debug Tool provides a rich set of commands to debug your programs. Debug Tool
Utilities and Advanced Functions enhances this set of commands by adding the
following commands:
v ALLOCATE
v CALL %FA
v DESCRIBE ALLOCATIONS
v FREE
v LOADDEBUGDATA or LDD
v PLAYBACK BACKWARD
v PLAYBACK DISABLE
v PLAYBACK ENABLE
v PLAYBACK FORWARD
v PLAYBACK START
v PLAYBACK STOP
v QUERY ASSEMBLER
v QUERY AUTOMONITOR
v QUERY ASSEMBLER
v QUERY PLAYBACK
v QUERY PLAYBACK LOCATION
v SET ASSEMBLER
The common_parameters are optional and specify any of the parameters described in
Appendix E of Coverage Utility User’s Guide and Messages. Multiple options are
separated by blanks. Note that if you specify any of these common_parameters, your
settings are remembered by EQASTART and become the default on subsequent
starts of EQASTART when you do not specify parameters.
This chapter gives an overview of basic debugging tasks and directs you to other
sections of the document that provide more detail.
Related tasks
“Compiling a C program with the TEST compiler option” on page 31
“Compiling a C program on an HFS file system” on page 32
“Compiling your C program with the #pragma statement” on page 33
“Compiling a C++ program with the TEST compiler option” on page 35
“Compiling a C++ program on an HFS file system” on page 35
“Compiling a COBOL program with the TEST compiler option” on page 25
Place the slash (/) before or after the TEST parameter, depending on the
programming language you are debugging.
This is the simplest and most direct way to start Debug Tool. It also starts
Debug Tool at the earliest point possible in your program.
v From within your program, insert calls to _ctest(), plitest, or ceetest to start
Debug Tool. This method is useful when you are familiar with your program
and you know where you want debugging to begin.
When you start your program with the TEST run-time option, the Debug Tool
screen appears:
COBOL LOCATION: EMPLOOK initialization
Command ===> Scroll ===> PAGE
MONITOR --+----1----+----2----+----3----+----4----+----5----+----6 LINE: 0 OF 0
******************************* TOP OF MONITOR ********************************
****************************** BOTTOM OF MONITOR ******************************
Now that you are familiar with the Debug Tool interface, you can begin debugging
programs.
Related tasks
Chapter 15, “Starting Debug Tool by using the TEST run-time option,” on page 63
Chapter 16, “Starting Debug Tool from a program,” on page 69
“Starting Debug Tool with CEETEST” on page 69
“Starting Debug Tool with PLITEST” on page 75
“Starting Debug Tool with the __ctest() function” on page 75
“Entering commands on the session panel” on page 100
“Navigating through Debug Tool session panel windows” on page 104
“Recording and replaying statements”
Related references
“Debug Tool session panel” on page 93
Related tasks
“Stepping through or running your program” on page 109
You can record and subsequently replay statements that you run. When you replay
statements, you can replay them in a forward direction or a backward direction.
Table 5 describes the sequence in which statements are replayed when you replay
them in a forward direction or a backward direction.
Table 5. The sequence in which statements are replayed.
PLAYBACK PLAYBACK
FORWARD BACKWARD
sequence sequence COBOL Statements
1 9 DISPLAY "CALC Begins."
2 8 MOVE 1 TO BUFFER-PTR.
3 7 PERFORM ACCEPT-INPUT 2 TIMES.
Statements that you run after you enter the PLAYBACK ENABLE command are
recorded.
PLAYBACK BACKWARD and PLAYBACK FORWARD change the direction commands like
STEP move in.
When you have finished replaying statements, enter the PLAYBACK STOP command.
Debug Tool returns you to the point at which you entered the PLAYBACK START
command. You can resume normal debugging. Debug Tool continues to record
your statements. To replay a new set of statements, begin at step 1.
When you finish recording and replaying statements, enter the following
command:
PLAYBACK DISABLE
Debug Tool no longer records any statements and discards information that you
recorded. The PLAYBACK START, PLAYBACK FORWARD, PLAYBACK BACKWARD, and PLAYBACK
STOP commands are no longer available.
Related references
Debug Tool for z/OS Reference and Messages
Setting a breakpoint
In Debug Tool, breakpoints can indicate a stopping point in your program and a
stopping point in time. Breakpoints can also contain activities, such as instructions
to run, calculations to perform, and changes to make.
In the Log window, the message AT 100 ; appears. If line 100 is not a valid place
to set a breakpoint, the Log window displays a message similar to Statement 100
is not valid. The breakpoint is also indicated in the Source window by a
reversing of the colors in the prefix area.
Breakpoints do more than just indicate a place to stop. Breakpoints can also
contain instructions. For example, the following breakpoint instructs Debug Tool to
display the contents of the variable myvar when Debug Tool reaches line 100:
AT 100 LIST myvar;
A breakpoint can contain instructions that alter the flow of the program. For
example, the following breakpoint instructs Debug Tool to go to label newPlace
when it reaches line 100:
AT 100 GOTO newPlace ;
The syntax of the complex instruction depends on the program language that you
are debugging. The previous example assumes that you are debugging a C
program. If you are debugging a COBOL program, the same example is written as
follows:
AT 100 if mybool = TRUE THEN myvar = 10 ; END-IF ;
Related references
Debug Tool for z/OS Reference and Messages
For one-time display, enter the following command on the command line, where x
is the name of the variable:
LIST (x)
For continuous display, enter the following command on the command line, where
x is the name of the variable:
MONITOR LIST ( x )
In the Monitor window, a line appears with the name of the variable and the
current value of the variable next to it. If the value of the variable is undefined, the
variable is not initialized, or the variable does not exist, a message appears
underneath the variable name declaring the variable unusable.
Related tasks
“Displaying values of C and C++ variables or expressions” on page 208
“Displaying values of COBOL variables” on page 191
“Displaying and monitoring the value of a variable” on page 112
Related references
Debug Tool for z/OS Reference and Messages
Changing the value of a variable depends on the programming language that you
are debugging. In Debug Tool, the rules and methods for the assignment of values
to variables are the same as programming language rules and methods. For
example, to assign a value to a C variable, use the C assignment rules and
methods:
var = 1 ;
Related tasks
“Assigning values to C and C++ variables” on page 209
“Assigning values to COBOL variables” on page 189
Skipping a breakpoint
Use the DISABLE command to temporarily disable a breakpoint. Use the ENABLE
command to re-enable the breakpoint.
Related references
Debug Tool for z/OS Reference and Messages
The Log window displays a line that says CLEAR AT 100 ; and the prefix area
reverts to its original colors. These changes indicate that the breakpoint at line 100
is gone.
Related references
Debug Tool for z/OS Reference and Messages
Refer to Debug Tool for z/OS Reference and Messages for more information on the
QQUIT and QUIT ABEND commands which can stop your debug session.
Related references
Debug Tool for z/OS Reference and Messages
The sections in this chapter provide answers to these questions which can help you
determine how you want to conduct your debug session.
Related concepts
“Debug Tool interfaces” on page 4
Chapter 2, “Debug Tool Utilities and Advanced Functions: introduction,” on page 7
Related tasks
Chapter 5, “Preparing a COBOL program,” on page 25
Chapter 6, “Preparing a PL/I program,” on page 29
Chapter 7, “Preparing a C program,” on page 31
Chapter 8, “Preparing a C++ program,” on page 35
Chapter 9, “Preparing an assembler program,” on page 37
Chapter 10, “Preparing a DB2 program,” on page 41
Chapter 11, “Preparing a DB2 stored procedures program,” on page 45
Chapter 12, “Preparing a CICS program,” on page 47
Chapter 13, “Preparing an IMS program,” on page 53
Chapter 38, “Debugging programs in a production environment,” on page 255
If you use one of the following compilers, you can compile your programs without
hooks:
v Enterprise COBOL for z/OS and OS/390, Version 3
v COBOL for OS/390 & VM, Version 2 Release 2
v COBOL for OS/390 & VM, Version 2 Release 1, with APAR PQ40298
To decrease the size of your application, increase performance, and retain most
debug capabilities, you can compile COBOL programs with the
TEST(NONE,SYM,SEPARATE) compiler option, which is available with one of the
following compilers:
v Enterprise COBOL for z/OS and OS/390, Version 3
v COBOL for OS/390 & VM, Version 2 Release 2
v COBOL for OS/390 & VM, Version 2 Release 1, with APAR PQ40298
When do you want to start Debug Tool and when do you want it to
gain control?
You have a choice of ways to start Debug Tool, as well as ways to let it gain
control of your program.
After Debug Tool starts, it gains control of your program and suspends execution
so that you can take actions such as checking the value of a variable or examining
the contents of storage.
When a program is under development, compile the program with the TEST(ALL)
compiler option to get all of Debug Tool’s capabilities. If you use one of the
following compilers, you can compile COBOL programs with the
TEST(NONE,SYM,SEPARATE) compiler option and retain all of Debug Tool’s
capabilities:
v Enterprise COBOL for z/OS and OS/390, Version 3
v COBOL for OS/390 & VM, Version 2 Release 2
v COBOL for OS/390 & VM, Version 1 with APAR PQ40298
Debug Tool uses the symbol tables to obtain information about program variables.
Programs compiled with one of the following compilers and with the SEPARATE
suboption store debugging information and symbol tables in a separate file.
v Enterprise COBOL for z/OS and OS/390, Version 3
v COBOL for OS/390 & VM, Version 2 Release 2
v COBOL for OS/390 & VM, Version 2 Release 1 with APAR PQ40298
The file, called a separate debug file, must be a nontemporary file and must also
be available during the debug session. If you move or rename the separate debug
file, use the SET SOURCE or SET DEFAULT LISTINGS command to specify the new
location or name of the files.
Debug Tool uses hooks to gain control of your program at selected points during
its execution. These points can be at the entrances and exits of blocks, at statement
boundaries, and at points in the program where program flow might change
between statement boundaries (called path points), such as before and after a CALL
To debug programs compiled with the TEST(NONE) compiler option (which does not
insert hooks into the program), you must activate the Dynamic Debug facility and
use one of the following compilers:
v Enterprise COBOL for z/OS and OS/390, Version 3
v COBOL for OS/390 & VM, Version 2 Release 2
v COBOL for OS/390 & VM, Version 2 Release 1 with APAR PQ40298
If these programs reside in read-only storage, the Authorized Debug facility must
be activated. Contact your system administrator to verify that the Dynamic Debug
and Authorized Debug facilities are activated.
If these programs are running on OS/390, Version 2 Release 10, or z/OS, Version 1
Release 1, you need to install Language Environment APAR PQ46488.
In addition, you must link your program with the Language Environment
SCEELKED library and not the VS COBOL II COB2LIB library.
After you convert and debug your program, you can do one of the following:
v Continue to use the OS/VS COBOL compiler. Every time you want to debug
your program, you need to use the Convert and Compile option.
v Use the new source that was produced by the Convert and Compile option. You
can compile it and debug it without using the Convert and Compile option.
The Convert and Compile option can use any level of COBOL source program as
input, including VS COBOL II, COBOL for MVS & VM, and COBOL for OS/390 &
VM programs that were previously compiled with the CMPR2 compiler option.
Related references
Debug Tool for z/OS Reference and Messages
By default, the Enterprise PL/I compiler stores the relative path and file names in
the object file. When you start a debug session, if the source is not in the same
location as where the program is launched, Debug Tool does not locate the source.
To avoid this problem, specify the full path name for the source when you compile
the program. For example, if you execute the following series of commands, Debug
Tool does not find the source:
1. Change to the directory where your program resides and compile the program.
cd /u/myid/mypgm
pli -g "//TEST.LOAD(HELLO)" hello.pli
2. Exit UNIX System Services and return to the TSO READY prompt.
3. Launch the program with the TEST run-time option.
call TEST.LOAD(HELLO) ’test/’
The source because is located in another directory (/u/myid/mypgm). Debug Tool
does find the source if you change the compile command to:
The same restriction applies to programs that you compile to run in a CICS
environment.
To be able to view your listing while debugging in full-screen mode, PL/I for MVS
& VM and OS PL/I programs must be compiled using the SOURCE compiler option.
You must also direct the listing to a nontemporary file that is available during the
debug session. During a debug session, Debug Tool displays the first file it finds
named userid.pgmname.list in the Source window. If Debug Tool cannot find the
listing at this location, use the SET SOURCE command to associate your source
listing with the program you are debugging.
If you build your application using the c89 orc++, do the following steps:
1. Compile your source code as usual, but specify the –g option to generate
debugging information. The –g option is equivalent to the TEST compiler option
under TSO or MVS batch. For example, to compile the C source file fred.c
from the u/mike/app directory, specify:
cd /u/mike/app
c89 –g –o "//PROJ.LOAD(FRED)" fred.c
Note: The double quotes in the command line above are required.
2. Set up your TSO environment, as described above.
3. Debug the program under TSO by entering the following:
FRED TEST ENVAR('PWD=/u/mike/app') / asis
Note: The single quotes in the command line above are required.
ENVAR('PWD=/u/mike/app') sets the environment variable PWD to the path
from where the source files were compiled. Debug Tool uses this
information to determine from where it should read the source files.
If you are debugging your application in the UNIX System Services Shell, you
must debug in remote debug mode or in full-screen mode through a VTAM
terminal. The workstation component of remote debuggers is available through
several products, including C and C++ Productivity Tools for OS/390 and
VisualAge COBOL.
Related references
Debug Tool for z/OS Reference and Messages
By default, the C compiler stores the relative path and file names in the object file.
When you start a debug session, if the source is not in the same location as where
the program is launched, Debug Tool does not find the source. To avoid this
problem, specify the full path name of the source when you compile the program.
For example, if you execute the following series of commands, Debug Tool does
not find the source:
1. Change to the directory where your program resides and compile the program.
cd /u/myid/mypgm
c89 -g -o "//TEST.LOAD(HELLO)" hello.c
2. Exit UNIX System Services and return to the TSO READY prompt.
3. Launch the program with the TEST run-time option.
call TEST.LOAD(HELLO) ’test/’
The source is located in another directory (/u/myid/mypgm). Debug Tool finds the
source if you change the compile command to:
c89 -g -o "//TEST.LOAD(HELLO)" /u/myid/mypgm/hello.c
Related tasks
“Compiling your C program with the #pragma statement”
Related references
z/OS C/C++ User’s Guide
This #pragma must appear before any executable code in your program.
The following example generates symbol table information, symbol information for
nested blocks, and hooks at line numbers:
#pragma options (test(SYM,BLOCK,LINE))
Related tasks
Chapter 7, “Preparing a C program,” on page 31
Chapter 8, “Preparing a C++ program,” on page 35
C/C++ Language Reference
Related references
Debug Tool for z/OS Reference and Messages
By default, the C++ compiler stores the relative path and file names in the object
file. When you start a debug session, if the source is not in the same location as
where the program is launched, Debug Tool does not locate the source. To avoid
this problem, specify the full path name of the source when you compile the
program. For example, if you execute the following series of commands, Debug
Tool does not find the source:
1. Change to the directory where your program resides and compile the program.
cd /u/myid/mypgm
c++ -g -o "//TEST.LOAD(HELLO)" hello.cpp
2. Exit UNIX System Services and return to the TSO READY prompt.
3. Launch the program with the TEST run-time option.
call TEST.LOAD(HELLO) ’test/’
The source is located in another directory (/u/myid/mypgm). Debug Tool finds the
source if you change the compile command to:
c++ -g -o "//TEST.LOAD(HELLO)" /u/myid/mypgm/hello.cpp
Related tasks
Chapter 7, “Preparing a C program,” on page 31
Related references
z/OS C/C++ User’s Guide
If you use Debug Tool Utilities to prepare your assembler program, you can do
steps 1 and 2 in one step.
You must have Debug Tool Utilities and Advanced Functions installed on your
system to prepare and debug assembler programs.
When you debug an assembler program, you can use most of the Debug Tool
commands. There are three differences between debugging an assembler program
and debugging programs written in other programming languages supported by
Debug Tool:
v After you assemble your program, you must create a debug information file,
also called the EQALANGX file. Debug Tool uses this file to obtain information
about your assembler program.
v Debug Tool assumes all compile units are written in some high-level language
(HLL). You must inform Debug Tool that a compile unit is an assembler compile
unit and instruct Debug Tool to load the assembler compile unit’s debug
information. Do this by entering the LOADDEBUGDATA (or LDD) command.
v Assembler does not have language elements you can use to write expressions.
Debug Tool provides an assembler-like language elements you can use to write
expressions for Debug Tool commands that require an expression. See Debug Tool
for z/OS Reference and Messages a description of the syntax of the assembler-like
language.
After you verify that your assembler program meets these requirements, prepare
your assembler program as instructed in Chapter 9, “Preparing an assembler
program.”
To read more information about a field in any panel, place the cursor in the input
field and press PF1. To read more information about a panel, place the cursor
anywhere on the panel that is not an input field and press PF1.
After you assemble your program and create the EQALANGX file, you can link-edit
your program.
To read more information about a field in any panel, place the cursor in the input
field and press PF1. To read more information about a panel, place the cursor
anywhere on the panel that is not an input field and press PF1.
Chapter 9. Preparing an assembler program 39
After you link-edit your program, you can run your program and start Debug
Tool.
Program preparation includes the DB2 precompiler, the compiler, the prelinker, the
linkage editor, and DB2 bind. The following files must be retained in a permanent
data set for Debug Tool to read when you debug your program:
v For COBOL and PL/I, the program listing.
v For COBOL, the separate debug file.
v For C, C++, VisualAge PL/I and Enterprise PL/I, the program source file.
Note: For C and C++, it is the input to the compiler (the output from the DB2
precompiler) that needs to be retained.
Related references
DB2 UDB for OS/390 Application Programming and SQL Guide
Related references
DB2 UDB for OS/390 Application Programming and SQL Guide
Before using Debug Tool, you must prepare your program by compiling at least
one part of it with the TEST compiler option.
Related tasks
Related references
If your system programmer has not already done so, include all the proper
libraries in the SYSLIB concatenation. For example, the ISPLOAD library for
ISPLINK calls, and the DB2 DSNLOAD library for the DB2 interface modules
(DSNxxxx).
Related tasks
Chapter 16, “Starting Debug Tool from a program,” on page 69
In order to debug a stored procedure, it must be compiled with the TEST compiler
option and run with the TEST run-time option. If the stored procedure is defined as
Type=SUB, CEEUOPTS is ignored by Language Environment.
The TEST runtime options must be defined to the RUNOPTS field of the DB2 catalog
by using the appropriate DB2 SQL commands. In the following examples, the
stored procedure is a COBOL program called SPROC1 of Type SUB that runs in a
WLM address space called WLMENV1. The stored procedures are debugged in
remote mode.
v For DB2 Version 5, the stored procedure is defined as follows:
insert into sysibm.sysprocedures
(procedure, authid, luname, loadmod, linkage, collid,
language, asutime, stayresident, ibmreqd,
runopts,
parmlist, result_sets, wlm_env,
pgm_type, external_security, commit_on_return)
values(’SPROC1’, ’ ’, ’ ’, ’SPROC1’, ’ ’, ’ ’,
’COBOL’, 0, ’ ’, ’N’,
’TEST(,,,VADTCPIP&9.112.27.21%8001:*)’,
’ ’, 0, ’WLMENV1’,
’S’, ’N’, ’N’);
v For DB2 Version 6, the stored procedure is defined as follows:
create procedure sproc1
language cobol
external name sproc1
parameter style general
wlm environment wlmenv1
run options ’TEST(,,,VADTCPIP&9.112.27.99%8001:*)’
program type sub;
To verify that the stored procedure is defined correctly, use the SQL SELECT
command on the appropriate DB2 table.
v For DB2 Version 5:
select * from sysibm.sysprocedures;
v For DB2 Version 6:
select * from sysibm.sysroutines;
If the definition is not correct, use the appropriate SQL command to modify the
stored procedure.
© Copyright IBM Corp. 1992, 2003 45
v For DB2 Version 5:
update sysibm.sysroutines
set runopts=’TEST(,,,VADTCPIP&9.112.27.21%8000:*)’
where specificname=’SPROC1’;
v For DB2 Version 6:
alter procedure sproc1 run options ’TEST(,,,VADTCPIP&9.112.27.21%8000:*)’;
Related references
DB2 UDB for OS/390 Application Programming and SQL Guide
Related tasks
Chapter 5, “Preparing a COBOL program,” on page 25
Chapter 6, “Preparing a PL/I program,” on page 29
Chapter 7, “Preparing a C program,” on page 31
Chapter 8, “Preparing a C++ program,” on page 35
Chapter 9, “Preparing an assembler program,” on page 37
After you link-edit your program, use the DTCN transaction to create a profile that
specifies the combination of resource IDs that you want to debug. See “Creating
and storing a DTCN profile.”
Select the combination of resources to debug (see Help for more information)
Some of the entry fields are filled in with default values that start Debug Tool,
in full-screen mode, for tasks running on this terminal. If you do not want to
change the defaults, you can skip the next two steps and proceed to step 4 on
page 49. If you want to change the settings on this panel, continue to the next
step.
2. Specify the combination of resource IDs that you want to debug.
Terminal Id
Specify the CICS terminal to debug. By default, this ID is set to the
terminal that is currently running DTCN.
Transaction Id
Specify the CICS transaction to debug. If you specify a transaction ID
without any other resource, Debug Tool is started every time that
transaction is run, including times when other users run the
transaction.
Program Id(s)
Specify the CICS program or programs to debug. If you specify a
program ID without any other resource, Debug Tool is started every
time the program is run, including times when other users run the
program.
User Id
Specify the CICS user ID to debug. All programs that are run by this
user will start Debug Tool.
NetName
Specify the four character name of a CICS terminal or a CICS system
that you want to use to run your debugging session. This name is used
by VTAM to identify the CICS terminal or system.
3. Specify the type of debugging and the ID of the display device.
Session Type
Select one of the following options:
MFI Indicates that Debug Tool initializes on a 3270 type of terminal.
TCP Indicates that you want to interact with Debug Tool from your
Some of the entry fields are filled in with default values that start Debug Tool,
in full-screen mode, for tasks running on this terminal. If you do not want to
change the defaults, you can skip the rest of this step and proceed to step 5 on
page 50. If you want to change the settings on this panel, continue with this
step.
Test Option
TEST/NOTEST specifies the conditions under which Debug Tool assumes
control during the initialization of your application.
Test Level
ALL/ERROR/NONE specifies what conditions need to be met for Debug
Tool to gain control.
Command File
A valid fully qualified data set name that specifies the primary
commands file for this run.
Now, any tasks that run in the CICS system and match the resource IDs that you
specified in the previous steps will start Debug Tool.
To display all of the active DTCN profiles in the CICS region, press PF7. The
Debug Tool CICS Control - All Sessions screen displays, shown below.
DTCN Debug Tool CICS Control - All Sessions S07CICPL
DTCN also reads the Language Environment NOTEST option supplied to the CICS
region in CEECOPT or CEEROPT. You can supply suboptions, such as the name of
a preference file, with the NOTEST option to supply additional defaults to DTCN.
If you do not have Debug Tool Utilities and Advanced Functions installed on your
system, you can continue to compile, link, and start your IMS program by using
your site procedures. Remember the following points:
v Your program must be compiled with the TEST compiler option. Use the default
options to gain maximum debugging facilities.
v Ensure that your source (if you are working with C, C++, or Enterprise PL/I),
listing (if you are working with COBOL or PL/I), or separate debug file (if you
are working with COBOL) is stored in a permanent data set that is available to
Debug Tool.
v Ensure that you do the tasks described in “Linking IMS programs for
debugging” on page 55.
For IMS TM programs running in IMS Version 8, you do not have to link the
CEEUOPT load module to obtain information about the TEST run-time options.
You can specify the transaction settings and TEST run-time options to use to run
Creating setup file for your IMS program by using Debug Tool Utilities
To create a setup file for your IMS program by using Debug Tool Utilities, do the
following steps:
1. Start Debug Tool Utilities. If you do not know how to start Debug Tool
Utilities, see “Starting Debug Tool Utilities” on page 9.
2. In the Debug Tool Utilities panel (EQA@PRIM), type 4 in the Option line and
press Enter.
3. In the Manage IMS Programs panel (EQAPRIS), type 2 in the Option line and
press Enter.
4. In the Manage Message Regions - Edit Setup File panel (EQAPFORA), type in
the information to create a new setup file or edit an existing setup file. Press
Enter.
When you link your IMS batch program or IMS TM Version 7 or earlier program,
you must include a run-time options module in your program link. They must be
coded and assembled in a user-defined run-time option module. For instructions
on how to create the CEEUOPT run-time options module using the CEEXOPT macro,
follow the steps in “Linking DB2 programs for debugging” on page 42.
For COBOL programs using IMS, include the IMS interface module DFSLI000 from
the IMS RESLIB library.
Then you use the setup files to run your program in foreground or batch. The
Debug Tool Setup Utility (DTSU) RUN command performs the file allocations and
then starts the program with the specified options and parameters in the
foreground. The DTSU SUBMIT command submits a batch job to start the program.
Related tasks
“Creating the setup file”
“Editing an existing setup file”
“Saving your setup file” on page 61
“Starting your program” on page 62
Related tasks
“Entering file allocation statements, run-time options, and program parameters” on page 60
Related tasks
“Entering file allocation statements, run-time options, and program parameters”
To modify the name of the load module, type the name in the Load Module Name
field.
In the file allocation section of the panel, each line represents an element of a DD
name allocation or concatenation. The statements can be modified, copied, deleted,
and reordered.
The Edit and Browse line commands allow you to modify or view the contents of
the data set name specified for DD and SYSIN DD types.
You can use the DDNAME STEPLIB to specify the load module search order.
For additional help, move the cursor to any field and enter the HELP command or
press PF1.
Related tasks
“Saving your setup file”
To save your setup file and exit the Edit–Edit Setup File panel, enter the END
command or press PF3.
To exit the Edit–Edit Setup File panel without saving any changes to your setup
file, enter the CANCEL command or press PF12.
Related tasks
“Starting your program” on page 62
Chapter 14. Starting Debug Tool from the Debug Tool Utilities 61
Starting your program
To perform the allocations and run the program with the specified parameter
string, enter the RUN command or press PF4.
To generate JCL from the information in the setup file and then submit to the batch
job, enter the SUBMIT command or press PF10.
Related tasks
Chapter 16, “Starting Debug Tool from a program,” on page 69
Related references
“Special considerations while using the TEST run-time option”
You can change the TEST/NOTEST run-time options at any time with the SET TEST
command.
To enable the suboptions you specified with NOTEST, start Debug Tool during your
program’s run time using a library service call such as CEETEST, PLITEST, or the
__ctest() function.
The initial command list, whether it consists of a command string included in the
run-time options or a primary commands file, can contain a USE command to get
commands from a secondary file. If started from the primary commands file, a
USE file takes on the characteristics of the primary commands file.
If you enter STEP at this point, before entering any other commands, both program
and Language Environment initialization will complete and give you access to all
variables. You can also enter all valid commands.
If Debug Tool is started while your program is running (for example, using a
CEETEST call), it might not be able to find all compile units associated with your
application. Compile units located in load modules that are not currently active are
not known to Debug Tool, even if they were run prior to Debug Tool’s
initialization.
Debug Tool also does not know about compile units that were not compiled with
the TEST compiler option, even if they are active, nor does Debug Tool know about
compile units written in unsupported languages.
For example, suppose load module mod1 contains compile units cu1 and cu2, both
compiled with the TEST option. The compile unit cu1 calls cux, contained in load
module mod2, which returns after it completes processing. The compile unit cu2
contains a call to the CEETEST library service. When the call to CEETEST initializes
Debug Tool, only cu1 and cu2 are known to it. Debug Tool does not recognize cux.
Commands in the preferences file are performed only once, when Debug Tool is
first initialized in the process.
Session log
The session log stores the commands entered and the results of the execution of
those commands. The session log saves the results of the execution of the
commands as comments. This allows you to use the session log as a commands
file.
Related tasks
“Link-editing CEEBXITA into your program” on page 47
Related references
Debug Tool for z/OS Reference and Messages
Chapter 15. Starting Debug Tool by using the TEST run-time option 65
Related references
z/OS Language Environment Programming Guide
Related references
z/OS Language Environment Programming Guide
Note: This option replaces the OS PL/I and VS COBOL II STAE/NOSTAE options.
This #pragma must appear before the first statement in your source file. For
example, if you specified the following in the source:
#pragma runopts (notest(all,*,prompt))
TEST overrides the NOTEST option specified in the #pragma and, because TEST does
not contain any suboptions of its own, the suboptions ALL, *, and PROMPT remain in
effect.
Chapter 15. Starting Debug Tool by using the TEST run-time option 67
If you link together two or more compile units with differing #pragmas, the options
specified with the first compile are honored. With multiple enclaves, the options
specified with the first enclave (or compile unit) started in each new process are
honored.
If you specify options on the command line and in a #pragma, any options entered
on the command line override those specified in the #pragma unless you specify
NOEXECOPS. Specifying NOEXECOPS, either in a #pragma or with the EXECOPS compiler
option, prevents any command line options from taking effect.
Related tasks
z/OS C/C++ User’s Guide
To start Debug Tool using these alternatives, you still need to be aware of the TEST
suboptions specified using NOTEST, CEEUOPT, or other "indirect" settings.
Related tasks
“Starting Debug Tool with CEETEST”
“Starting Debug Tool with PLITEST” on page 75
“Starting Debug Tool with the __ctest() function” on page 75
“Using CEEUOPT to start Debug Tool under CICS” on page 88
Related references
“Special considerations while using the TEST run-time option” on page 63
If you don’t want to compile your program with hooks, you can use CEETEST calls
to start Debug Tool at strategic points in your program. If you decide to use this
method, you still need to compile your application so that symbolic information is
created.
Using CEETEST when Debug Tool is already initialized results in a reentry that is
similar to a breakpoint.
void CEETEST ( , ) ;
string_of_commands fc
For PL/I
CALL CEETEST ( * , * ) ;
string_of_commands fc
string_of_commands (input)
Halfword-length prefixed string containing a Debug Tool command list,
string_of_commands is optional.
If Debug Tool is available, the commands in the list are passed to the debugger
and carried out.
If string_of_commands is omitted, Debug Tool prompts for commands in
interactive mode.
For Debug Tool, remember to use the continuation character if your command
exceeds 72 characters.
fc (output)
A 12-byte feedback code, optional in some languages, that indicates the result of
this service.
CEE000
Severity = 0
Msg_No = Not Applicable
Message = Service completed successfully
CEE2F2
Severity = 3
Msg_No = 2530
Message = A debugger was not available
Note: The CEE2F2 feedback code can also be obtained by MVS/JES batch
applications. For example, either the Debug Tool environment was
corrupted or the debug event handler could not be loaded.
For C and C++ and COBOL, if Debug Tool was started through CALL CEETEST, the
GOTO command is only allowed after Debug Tool has returned control to your
program via STEP or GO.
Usage notes
C and C++
Include leawi.h header file.
COBOL
Include CEEIGZCT. CEEIGZCT is in the Language Environment SCEESAMP
data set.
Related tasks
“Entering multiline commands in full-screen and line mode” on page 183
Related references
z/OS Language Environment Programming Guide
int main(void) {
_VSTRING commands;
_FEEDBACK fc;
strcpy(commands.string, "");
commands.length = strlen(commands.string);
CEETEST(&commands, &fc);
}
Example 2
In this example, a string of valid Debug Tool commands is passed to
Debug Tool and a pointer to Language Environment feedback code is
returned. The call to CEETEST starts Debug Tool and the command string is
processed. At statement 23, the values of x and y are displayed in the Log,
and execution of the program resumes. Barring further interrupts, Debug
Tool regains control at program termination and prompts you for
commands. The command LIST(z) is discarded when the command GO is
executed.
Example 3
In this example, a string of valid Debug Tool commands is passed to
Debug Tool and a pointer to the feedback code is returned. If the call to
CEETEST fails, an informational message is printed.
If the call to CEETEST succeeds, Debug Tool is started and the command
string is processed. At statement 30, the values of x and y are displayed in
the Log, and execution of the program resumes. Barring further interrupts,
Debug Tool regains control at program termination and prompts you for
commands.
#include <leawi.h>
#include <string.h>
#include <stdio.h>
int x,y,z;
_VSTRING commands;
_FEEDBACK fc;
01 Parms.
05 AA PIC S9(4) BINARY Value 14.
05 BB PIC x(14) Value 'SET SCREEN ON;'.
The result of the call is returned in the feedback code, using a variable
defined as:
01 FC.
02 CONDITION-TOKEN-VALUE.
COPY CEEIGZCT.
03 CASE-1-CONDITION-ID.
04 SEVERITY PIC S9(4) BINARY.
04 MSG-NO PIC S9(4) BINARY.
03 CASE-2-CONDITION-ID
REDEFINES CASE-1-CONDITION-ID.
04 CLASS-CODE PIC S9(4) BINARY.
04 CAUSE-CODE PIC S9(4) BINARY.
03 CASE-SEV-CTL PIC X.
03 FACILITY-ID PIC XXX.
02 I-S-INFO PIC S9(9) BINARY.
in the DATA DIVISION of your program. You are not prompted for
commands.
CALL "CEETEST" USING COMMAND-STRING FC.
DCL 1 fb,
5 Severity Fixed bin(15),
5 MsgNo Fixed bin(15),
5 flags,
8 Case bit(2),
8 Sev bit(3),
8 Ctrl bit(3),
5 FacID Char(3),
5 I_S_info Fixed bin(31);
If ¬FBCHECK(FC, CEE000)
Then Put Skip List('––––> ERROR! in CEETEST call', FC.MsgNo);
CALL PLITEST ;
( character_string_expression )
character_string_expression
Specifies a list of Debug Tool commands. If necessary, this is converted to a
fixed-length string.
Notes:
1. If Debug Tool executes a command in a CALL PLITEST command string that
causes control to return to the program (GO for example), any commands
remaining to be executed in the command string are discarded.
2. If you don’t want to compile your program with hooks, you can use CALL
PLITEST statements as hooks and insert them at strategic points in your
program. If you decide to use this method, you still need to compile your
application so that symbolic information is created.
The following examples show how to use PLITEST to start Debug Tool for PL/I.
Example 1
No argument is passed to Debug Tool when it is started. After gaining
control, Debug Tool prompts you for commands.
CALL PLITEST;
Example 2
A string of commands is passed to Debug Tool when it is started. After
gaining control, Debug Tool sets a breakpoint at statement 23, and returns
control to the program. You are not prompted for commands. In addition,
the List Y; command is discarded because of the execution of the GO
command.
CALL PLITEST('At statement 23 Do; List X; End; Go; List Y;');
Example 3
Variable ch is declared as a character string and initialized as a string of
commands. The string of commands is passed to Debug Tool when it is
started. After it runs the commands, Debug Tool prompts you for more
commands.
DCL ch Char(45) Init('At Statement 23 Do; List x; End;');
CALL PLITEST(ch);
When a list of commands is specified with __ctest(), Debug Tool runs the
commands in that list. If you specify a null argument, Debug Tool gets commands
by reading from the supplied commands file or by prompting you. If control
returns to your application before all commands in the command list are run, the
remainder of the command list is ignored. Debug Tool will continue reading from
the specified commands file or prompt for more input.
If you do not want to compile your program with hooks, you can use __ctest()
function calls to start Debug Tool at strategic points in your program. If you decide
to use this method, you still need to compile your application so that symbolic
information is created.
Using __ctest() when Debug Tool is already initialized results in a reentry that is
similar to a breakpoint.
(1)
int __ctest ( char *char_str_exp ) ;
Notes:
1 The syntax for ctest() and __ctest() is the same.
char_str_exp
Specifies a list of Debug Tool commands.
The following examples show how to use the __ctest() function for C and C++.
Example 1
A null argument is passed to Debug Tool when it is started. After it gains
control, Debug Tool prompts you for commands (or reads commands from
the primary commands file, if specified).
__ctest(NULL);
Example 2
A string of commands is passed to Debug Tool when it is started. At
statement 23, Debug Tool lists x and y, then returns control to the program.
You are not prompted for commands. In this case, the command list z; is
never executed because of the execution of the command GO.
__ctest("at line 23 {"
" list x;"
" list y;"
"}"
"go;"
"list z;");
Example 3
Variable ch is declared as a pointer to character string and initialized as a
string of commands. The string of commands is passed to Debug Tool
when it is started. After it runs the string of commands, Debug Tool
prompts you for more commands.
__ctest(strcat(buffer, ch));
Related tasks
“Starting Debug Tool under CICS”
“Starting Debug Tool under MVS in TSO”
“Starting Debug Tool in batch” on page 81
Related tasks
Chapter 36, “Debugging CICS programs,” on page 249
To begin a debug session, ensure your program has been compiled with the TEST
compiler option, and take the following steps:
1. Make sure all Debug Tool data sets are available. This might involve defining
them as part of a STEPLIB library.
Note: High-level qualifiers and load library names will be specific to your
installation. Ask the person who installed Debug Tool what the data sets
are called. The names will probably end in SEQAMOD. These data sets
might already be in the linklist or included in your TSO logon
procedure, in which case you don’t need to do anything to access them.
The installation options will determine whether or not this step is needed.
2. Allocate all other data sets containing files your program needs.
3. If you want a session log file, allocate one. This is a file that keeps a record of
your debug session and can be used as a commands file during subsequent
sessions. Do not allocate the session log file to a terminal. For example, do not
use ALLOC FI(INSPLOG) DA(*).
4. Start your program with the TEST run-time option, specifying the appropriate
suboptions, or include a call to CEETEST, PLITEST, or __ctest() in the program’s
source.
The following two example CLISTs show how you might allocate the Debug Tool
load library data set (SEQAMOD) if it is not in the linklist or TSO logon
procedure:
PROC 0 TEST
TSOLIB ACTIVATE DA(’EQAW.SEQAMOD’)
END
and
PROC 0 TEST
TSOLIB DEACTIVATE
FREE FILE(SEQAMOD)
ALLOCATE DA(’EQAW.SEQAMOD’) FILE(SEQAMOD) SHR REUSE
TSOLIB ACTIVATE FILE(SEQAMOD)
END
If you store either example CLIST in MYID.CLIST(DTSETUP), you can execute the
CLIST by entering the following at the TSO READY prompt:
EXEC ’MYID.CLIST(DTSETUP)’
The CLIST will execute and the appropriate Debug Tool data set will be allocated.
After allocating all necessary program data sets, the command line is used to
allocate the preferences file setup.pref and the session log file session.log as
shown in the following example:
ALLOCATE FILE(insppref) DATASET(setup.pref) REUSE
ALLOCATE FILE(insplog) DATASET(session.log) REUSE
CALL 'USERID1.MYLIB(TSTSCRPT)' '/TEST'
The following CLIST fragment shows how to define Debug Tool-related files and
start the C program prog1 with the TEST run-time option:
ALLOC FI(inspsafe) DA(debug.save) REUSE
ALLOC FI(insplog) DA(debug.log) REUSE
ALLOC FI(insppref) DA(debug.preferen) REUSE
CALL 'MYID.MYQUAL.LOAD(PROG1)' +
' TRAP(ON) TEST(,*,;,insppref)/'
Files include the session log file, debug.log; the preferences file, debug.preferen;
and the settings file, debug.save, a Debug Tool file that saves Debug Tool settings
for use in future debug sessions. Its Debug Tool-supplied default ddname is
inspsafe. All necessary data sets must exist prior to Starting this CLIST.
Starting your program from a terminal that works only in line mode results in a
line-mode session of Debug Tool. If you want to debug in line mode and you have
a 3270-compatible terminal that is capable of sustaining a full-screen session, you
must specify SET SCREEN OFF. You can specify this with the TEST run-time option
by including the command in a preferences file, or by specifying it as a command
string (for example, TEST(,*,"SET SCREEN OFF",insppref)).
To start Debug Tool from a terminal other than the terminal currently controlling
your TSO session, use the VTAM_LU_id parameter to specify the LU id of a VTAM
terminal. The VTAM terminal you specify controls your debugging session as long
as you remain in full-screen mode. If you enter line mode, control reverts to your
TSO terminal until you re-enter full-screen mode using the SET SCREEN ON
command.
Related tasks
“Recording your debug session in a log file” on page 107
Chapter 16, “Starting Debug Tool from a program,” on page 69
Related references
z/OS Language Environment Programming Guide
Before starting Debug Tool in batch mode, ensure that you have compiled your
program with the TEST compiler option. Next, modify the JCL to run your batch
program to include the appropriate Debug Tool data sets and to specify the TEST
run-time option. Finally, run the modified JCL.
You can debug an MVS batch job in full-screen mode. Use the MFI option to
specify the LU name of a VTAM terminal that interacts with Debug Tool. In the
previous example, change the EXEC statement to specify the LU name of the VTAM
terminal. For example:
//STEP1 EXEC PGM=EMPLRUN,
// PARM=’/TEST(,INSPIN,,MFI%ABC00001:)’
Related tasks
Appendix D, “Notes on debugging in batch mode,” on page 297
Chapter 27, “Entering Debug Tool commands,” on page 181
Appendix E, “Notes on debugging in remote debug mode,” on page 299
Contact your systems programmer if you do not know the name of the Debug
Tool library on your system.
To control Debug Tool from a separate terminal, specify the VTAM LU identifier
of the separate terminal in the TEST parameter, as in the following example:
’TEST(,,,MFI%TCP00001:)/’`
v For MVS batch, if your system programmer has not installed Debug Tool in the
standard search path, you need to include the Debug Tool library in your
STEPLIB concatenation . Start your program with the TEST run-time option
specifying the VTAM LU identifier of a terminal, as in the following example
’TEST(,,,MFI%TCP00001:)/’
v For CICS, make sure Debug Tool is installed in your CICS region. Enter DTCN
to start the Debug Tool control transaction. Press PF4 to save the default
debugging profile. Press PF3 to exit from the DTCN transaction. Enter the name
of the transaction you want to debug.
Related tasks
Chapter 14, “Starting Debug Tool from the Debug Tool Utilities,” on page 59
Chapter 7, “Preparing a C program,” on page 31
Chapter 8, “Preparing a C++ program,” on page 35
Chapter 5, “Preparing a COBOL program,” on page 25
Chapter 6, “Preparing a PL/I program,” on page 29
“Ending a full-screen debug session” on page 119
“Entering commands on the session panel” on page 100
Related references
“Debug Tool session panel” on page 93
After the debugging session has ended, repeat steps 5 and 6 to create another
full-screen mode debugging session.
If the remote debugger does not start when the stored procedure calls it, verify
that the TCP/IP address is defined correctly in the DB2 catalog. When the stored
procedure is called, the remote debugger source window is refreshed with the
source or listing of the stored procedure.
To verify that the stored procedure has started, enter the following DB2 Display
command, where xxxx is the name of the stored procedure:
Display Procedure(xxxx)
For DB2 Version 6, to switch from remote debug mode to full-screen mode through
a VTAM terminal, change the definition of the stored procedure as follows, where
TCP00095 is the VTAM LU name:
alter procedure SPROC1 run options ’TEST(,,,MFI%TCP00095:)’
Related tasks
Chapter 4, “Planning your debug session and collecting resources,” on page 21
Related tasks
“Using CEEUOPT to start Debug Tool under CICS” on page 88
“Using CEDF to start Debug Tool under CICS” on page 88
Related references
“Debug modes under CICS” on page 249
DTCN profiles contain the identifiers (IDs) of CICS resources to debug. These
resource IDs can be Terminal, Transaction, Program, or User.
To debug a CICS program by using DTCN to start Debug Tool, update the
link-edit step to include the EQADCCXT member from the Debug Tool library
**.SEQAMOD into the program’s main load module.
When CICS programs are started, Language Environment runs the EQADCCXT user
exit that you used to link-edit into the program. EQADCCXT uses a highly efficient
look-up mechanism to decide whether the Terminal ID, Transaction ID, Program
ID, and User ID for the task match a repository profile item. EQADCCXT selects the
best matching profile (the one with the greatest number of resource IDs that match
the active task). If two items have an equal number of matching resource IDs, the
older item is selected.
If this situation occurs, an error message is sent to the system console, suggesting
that DTCN users should specify additional resource qualification. So, in the above
case, each profile item should be set up with both user ID and program ID.
DTCN not only provides the capability to specify what to debug by specifying
debug resource IDs, DTCN also provides the capability to specify how the debug
session will run, for example, whether a mainframe (MFI) or workstation (VAD)
debug session is desired.
When a DTCN profile is active for a full-screen mode debugging session, Debug
Tool preserves in the profile all of the breakpoint information for that session.
When the DTCN profile is deleted, the breakpoint information is deleted. After you
save the profile in the repository, DTCN shows the saved TEST string in the
display field Repository String. When you are satisfied with the saved profile,
press PF3 to exit DTCN.
Related tasks
Chapter 5, “Preparing a COBOL program,” on page 25
Debug Tool runs in the mode defined in the TEST run-time option you supplied,
normally Single Terminal mode, although you could provide a primary commands
file and a log file and not use a terminal at all.
To start Debug Tool, simply run the application. Don’t forget to remove the
CEEUOPT containing your TEST run-time option when you have finished
debugging your program.
Related tasks
Chapter 15, “Starting Debug Tool by using the TEST run-time option,” on page 63
Related tasks
“Starting Debug Tool with CEETEST” on page 69
CEDF has an ″,I″ option that starts Debug Tool. This option starts both EDF and
Debug Tool in Dual Terminal mode. In Dual Terminal mode, EDF and Debug Tool
screens are displayed on the terminal where you issue the CEDF command;
application screens are displayed on the application terminal.
Note: You need to know the id of each terminal. One way to get this information
is by using the CEOT transaction. The output will include Ter(xxxx), where
xxxx is the terminal id.
where xxxx is the terminal on which you want to start the transaction to be
debugged. This terminal is where the application is started. It performs 3270
application I/O, while a Debug Tool session is started at the terminal where CEDF
is started.
CICS will return a message verifying the terminal id of the second terminal. Then,
on the xxxx terminal, enter:
TRAN
Once the command is entered, Debug Tool will be started for all Language
Environment-enabled programs that are running on the terminal where Debug
Tool is started. Debug Tool will continue to be active on this terminal, even if you
turn off EDF.
For example, to begin a Debug Tool session using terminal T304 as the debugging
terminal and T305 as the terminal where you want to run your application, start
the CEDF transaction as follows on T304:
CEDF T305,ON,I
Then, on terminal T305, enter the name of the transaction you are debugging:
TRAN
When you run your application on T305, Debug Tool is started on T304. Terminal
T305 displays only application output, that is, a specific CICS command to write to
the screen.
Debugging your programs in full-screen mode is the easiest way to learn how to
use Debug Tool, even if you plan to use batch or line modes later.
Note: The PF key definitions used in these topics are the default settings.
Related tasks
Chapter 18, “Starting a full-screen debug session,” on page 83
“Ending a full-screen debug session” on page 119
“Entering commands on the session panel” on page 100
“Navigating through Debug Tool session panel windows” on page 104
“Recording your debug session in a log file” on page 107
“Setting breakpoints to halt your program at a line” on page 109
“Stepping through or running your program” on page 109
“Displaying and monitoring the value of a variable” on page 112
“Displaying error numbers for messages in the Log window” on page 117
“Finding a renamed source, listing, or separate debug file” on page 117
“Requesting an attention interrupt during interactive sessions” on page 118
Chapter 23, “Debugging a C program in full-screen mode,” on page 141
Chapter 24, “Debugging a C++ program in full-screen mode,” on page 151
Chapter 21, “Debugging a COBOL program in full-screen mode,” on page 121
Chapter 22, “Debugging a PL/I program in full-screen mode,” on page 133
The Debug Tool session panel below shows the default layout for the Monitor
window 1, the Source window 2, and the Log window 3.
Related tasks
“Customizing the layout of windows on the session panel” on page 172
Related references
“Session panel header”
“Monitor window” on page 97
“Source window” on page 96
“Log window” on page 98
The Source window displays the source file or listing. The Source window has four
parts, described below.
1 Header area
Identifies the window, shows the compile unit name, and shows the
current position in the source or listing.
2 Prefix area
Occupies the left-most eight columns of the Source window. Contains
statement numbers or line numbers you can use when referring to the
statements in your program. You can use the prefix area to set, display, and
remove breakpoints with the prefix commands AT, CLEAR, ENABLE, DISABLE,
QUERY, and SHOW.
3 Source display area
Shows the source code (for a C and C++ program), the source listing (for a
COBOL or PL/I program), a pseudo assembler listing (for an assembler
program), or the disassembly view (for programs without debug
information) for the currently qualified program unit. If the current
executable statement is in the source display area, it is highlighted.
4 Suffix area
A narrow, variable-width column at the right of the screen that Debug Tool
uses to display frequency counts. It is only as wide as the largest count it
must display.
The suffix area is optional. To show the suffix area, enter SET SUFFIX ON. To
hide the suffix area, enter SET SUFFIX OFF. You can also set it on or off
with the Source Listing Suffix field in the Profile Settings panel.
The labeled header line for each window contains a scale and a line counter. If you
scroll a window horizontally, the scale also scrolls to indicate the columns
displayed in the window. The line counter indicates the line number at the top of a
window and the total number of lines in that window. If you scroll a window
vertically, the line counter reflects the top line number currently displayed in that
window.
Related tasks
“Using prefix commands on specific lines or statements” on page 102
“Customizing profile settings” on page 175
Use the Monitor window to continuously display output from the MONITOR LIST,
MONITOR QUERY, MONITOR DESCRIBE, and SET AUTOMONITOR commands. If this window
is not open, Debug Tool opens it when you enter a MONITOR or SET AUTOMONITOR
command. Its contents are refreshed whenever Debug Tool receives control and
after every Debug Tool command that can affect the display.
When you issue the SET AUTOMONITOR ON command, the following line is displayed
at the bottom of the list of monitored variables:
********** AUTOMONITOR **********
Variables that are added to the Monitor window as a result of the SET AUTOMONITOR
command are displayed underneath this line.
If a window is not wide enough to show all the output it contains, you can either
issue SCROLL RIGHT (to scroll the window to the right) or ZOOM (to make it fill the
screen).
The labeled header line for each window contains a scale and a line counter. If you
scroll a window horizontally, the scale also scrolls to indicate the columns
displayed in the window. The line counter indicates the line number at the top of a
window and the total number of lines in that window. If you scroll a window
vertically, the line counter reflects the top line number currently displayed in that
window.
You can update the values of monitored variables by typing new values over the
displayed values.
Related tasks
“Displaying and monitoring the value of a variable” on page 112
“Scrolling the windows” on page 105
The Log window records and displays your interactions with Debug Tool. All
commands that are valid in line mode, and their responses, are automatically
appended to the Log window. The following commands are not recorded in the
Log window.
PANEL
FIND
CURSOR
RETRIEVE
SCROLL
WINDOW
IMMEDIATE
QUERY prefix command
SHOW prefix command
If SET INTERCEPT ON is in effect for a file, that file’s output also appears in the Log
window.
You can optionally exclude STEP and GO commands from the log by specifying SET
ECHO OFF.
Commands that can be used with IMMEDIATE, such as the SCROLL and WINDOW
commands, are excluded from the Log window.
By default, the Log window keeps 1000 lines for display. To change this value,
enter SET LOG KEEP n, where n is the number of lines you want kept for display.
The labeled header line for each window contains a scale and a line counter. If you
scroll a window horizontally, the scale also scrolls to indicate the columns
displayed in the window. The line counter indicates the line number at the top of a
window and the total number of lines in that window. If you scroll a window
vertically, the line counter reflects the top line number currently displayed in that
window.
When you start Debug Tool, if your source or listing is not displayed, press PF4.
This puts you in the Source Identification panel. The Source Identification panel
indicates the name of the source, listing or separate debug file that was intended to
be used by Debug Tool. With this name, you can verify if the file exists or if you
have authorization to access it. If your file is stored at a different place, do one of
the following:
v Use the SET SOURCE command with the new name of the source, listing, or
debug file; or
v use the SET DEFAULT LISTINGS command with the new name of the source,
listing or debug file (provided they are stored in a PDS); or
v type over the Listing/Source file field in the Source Identification panel with the
new name for the source, listing, or separate debug file.
Related references
Appendix B, “How does Debug Tool locate debug information and source or
listing files?,” on page 289
Debug Tool for z/OS Reference and Messages
Related references
“Order in which Debug Tool accepts commands from the session panel”
“Initial PF key settings” on page 103
Related tasks
Chapter 27, “Entering Debug Tool commands,” on page 181
When you are entering system commands, you must comply with the following:
v A command is required after the SYSTEM keyword. Do not enter any required
parameters. Debug Tool prompts you.
This starts ISPF and displays an ISPF panel on your host emulator screen that
you can use to issue commands.
TSO is a synonym for the SYSTEM command. Truncation of the TSO command is not
allowed.
You can use prefix commands to specify the particular verb or statement in the line
where you want the command to apply. For example, AT typed in the prefix area of
a line sets a statement breakpoint at the first relative statement in that line, while
AT 3 sets a statement breakpoint at the third relative statement in that line. Typing
DISABLE 3 in the prefix area and pressing Enter disables that breakpoint.
Related tasks
“Defining PF keys” on page 171
Related references
“Initial PF key settings”
Related tasks
“Defining PF keys” on page 171
Related tasks
“Retrieving commands from the Log and Source windows” on page 104
To retrieve a line, move the cursor to the desired line, modify it (for example,
delete any comment characters) and press Enter. The input line appears on the
command line. You can further modify the command, then press Enter to issue it.
Related tasks
“Retrieving previous commands” on page 103
Related tasks
“Moving the cursor between windows”
“Scrolling the windows” on page 105
“Scrolling to a particular line number” on page 105
“Finding a string in a window” on page 105
“Changing which source file appears in the Source window” on page 105
“Displaying the line at which execution halted” on page 106
“Customizing profile settings” on page 175
Related tasks
“Defining PF keys” on page 171
You can toggle one of the Source, Log or Monitor windows to full screen
(temporarily not displaying the others) by moving the cursor into the window you
want to zoom and pressing PF10 (ZOOM). To toggle back, press PF10 again. PF11
(ZOOM LOG) toggles the Log window the same way without the cursor needing to be
in the Log window.
You can scroll any of the windows vertically and horizontally by issuing the
SCROLL UP, DOWN, LEFT, and RIGHT commands (the SCROLL keyword is optional). You
can use the command line to specify which window to scroll. For example, to
scroll the monitor window up 5 lines, enter SCROLL UP 5 MONITOR.
Alternately, you can use the position of the cursor to indicate the window you
want to scroll; if the cursor is in a window, that window is scrolled. If you do not
specify the window, the default window (determined by the setting of the DEFAULT
WINDOW command) is scrolled. You can change the default window by changing the
settings of Default window and Default scroll amount under the Profile Settings
panel.
Related tasks
“Customizing the layout of windows on the session panel” on page 172
“Scrolling to a particular line number”
“Customizing profile settings” on page 175
For example, to bring line 345 to the top of the window, enter SCROLL TO 345 on
the command line. The selected window is scrolled vertically so that your specified
line is displayed at the top of that window.
To repeat the search in whatever window the cursor is in, press PF5 again.
and a list of compile units will be written to the Log window, as shown below.
USERID.MFISTART.C(CALC)
USERID.MFISTART.C(PUSHPOP)
USERID.MFISTART.C(READTOKN)
You can type over or insert characters on one of these lines in the Log window and
press Enter to display the modified text on the command line, for example:
SET QUALIFY CU "USERID.MFISTART.C(READTOKN)"
and then press Enter to issue the command. Typing over a line in the Log window
and issuing them as commands is a way to save keystrokes and reduce errors in
long commands.
Another way to change which source file appears in the Source window is to press
PF4 (LIST) with the cursor on the command line. This displays the Source
Identification Panel, where associations are made between listings or source files
shown in the Source window and their compile units. Type over the Listings/Source
File field with the new name.
Related tasks
“Finding a renamed source, listing, or separate debug file” on page 117
The default ddname associated with the Debug Tool session log file is INSPLOG. If
you do not allocate a file with ddname INSPLOG, no default log file is created.
Related tasks
“Creating the log file”
“Recording how many times each source line runs” on page 108
For COBOL only, if you want to subsequently use the session log file as a
commands file, make the LRECL less than or equal to 72. Debug Tool ignores
everything after column 72 for file input during a COBOL debug session.
For CICS only, SET LOG OFF is the default. To start the log, you must use the SET
LOG ON file command. For example, to have the log written to a data set named
TSTPINE.DT.LOG , issue: SET LOG ON FILE TSTPINE.DT.LOG;.
Make sure the default of SET LOG ON is still in effect. If you have issued SET LOG
OFF, output to the log file is suppressed. If Debug Tool is never given control, the
log file is not used.
When the default log file (INSPLOG) is accessed during initialization, any existing
file with the same name is overwritten. On MVS, if the log file is allocated with
disposition of MOD, the log output is appended to the existing file. Entering the
SET LOG ON FILE xxx command also appends the log output to the existing file.
This causes Debug Tool to write the log to the file which is allocated to the DD
name LOGDDN.
Note: A sequential file is recommended for a session log since Debug Tool writes
to the log file.
At any time during your session, you can stop information from being sent to a
log file by entering:
SET LOG OFF;
The log file is active for the entire Debug Tool session.
Debug Tool keeps a log file in the following modes of operation: line mode,
full-screen mode, and batch mode.
After you have entered the SET FREQUENCY ON command, your Source window
is updated to show the current frequency count. Remember that this command
starts the statistic gathering to display the actual count, so if your application
has already executed a section of code, the data for these executed statements
will not be available.
which lists the number of times each statement is run. When you quit, the
results are written to the Log file. You can issue the LIST FREQUENCY * at any
time, but it will only display the frequency count for the currently active
compile unit.
Related tasks
“Creating the log file” on page 107
Related tasks
“Halting on a line in C only if a condition is true” on page 145
“Halting on a line in C++ only if a condition is true” on page 156
“Halting on a COBOL line only if a condition is true” on page 126
“Halting on a PL/I line only if a condition is true” on page 137
To run your program up to the next hook, press PF2 (STEP). If you compiled with
TEST for C or C++, TEST(ALL,SYM) for COBOL or PL/I, or TEST(NONE,SYM) for
Enterprise COBOL for z/OS and OS/390 or COBOL for OS/390 & VM with
Dynamic Debug installed, STEP performs one statement.
Note: A condition being raised is determined by the setting of the TEST run-time
suboption test_level.
The command STEP OVER runs the called function without stepping into it. If you
accidentally step into a function when you meant to step over it, issue the STEP
RETURN command that steps to the return point (just after the call point).
Related tasks
Chapter 4, “Planning your debug session and collecting resources,” on page 21
Chapter 15, “Starting Debug Tool by using the TEST run-time option,” on page 63
Debug Tool provides a set of commands (the PLAYBACK commands) that helps you
record and replay the statements that you run while you debug your program. To
record and replay statements, you need to do the following:
1. Record the statements that you run (PLAYBACK ENABLE command). If you specify
the DATA parameter or the DATA parameter is defaulted, additional information
about your program is recorded.
2. Prepare to replay statements (PLAYBACK START command).
3. Replay the statements that you recorded (STEP or RUNTO command).
4. Change the direction that the statements are replayed (PLAYBACK FORWARD
command).
5. Stop replaying statements (PLAYBACK STOP command).
Each of these steps are described in more detail in the sections that follow.
The PLAYBACK ENABLE command can be used to record the statements that you run
for all compile units or for specific compile units. For example, you can record the
statements that you run for compile units A, B, and C, where A, B, and C are
existing compile units. Later, you can enter the PLAYBACK ENABLE command and
specify that you want to record the statements that you run for all compile units.
You can use an asterisk (*) to specify all current and future compile units.
The number of statements that Debug Tool can record depends on the following:
v The amount of storage specified or defaulted.
v The number of changes made to the variables.
v The number of changes made to files.
You cannot change the storage value after you have started recording. The more
storage that you specify, the more statements that Debug Tool can record. After
Debug Tool has filled all the available storage, Debug Tool puts information about
the most recent statements over the oldest information. When the DATA parameter
is in effect, the available storage fills more quickly.
You can use the DATA parameter with programs compiled with the SYM suboption of
the TEST compiler option only if they are compiled with the following compilers
and are running with the following Language Environment run time and APARs
installed:
v Compilers:
– Enterprise COBOL for z/OS and OS/390, Version 3 Release 2
– Enterprise COBOL for z/OS and OS/390, Version 3 Release 1 with APAR
PQ63235
– COBOL for OS/390 & VM, Version 2 with APAR PQ63234
v Language Environment APARs:
– z/OS Version 1 Release 4, with APAR PQ65176
– z/OS, Version 1 Release 3, with APAR PQ65175
– z/OS, Version 1 Release 2, with APAR PQ65174 and APAR PQ52626
– z/OS, Version 1 Release 1, with APAR PQ62947 and APAR PQ52626
– OS/390, Version 2 Release 10, with APAR PQ62947 and APAR PQ52626
You can replay as far forward as the point where you entered the PLAYBACK START
command. As you replay statements, you see only the statements that you
recorded for those compile units you indicated you wanted to record. While you
are replaying steps, you cannot modify variables. If the DATA parameter is in effect,
you can access the contents of variables and expressions.
Related references
Debug Tool for z/OS Reference and Messages
When you replay statements, many Debug Tool commands are unavailable. Debug
Tool for z/OS Reference and Messages contains a complete list of all the commands
that are not available.
You can also access special registers, except for the ADDRESS OF, LENGTH OF, and
WHEN-COMPILED special registers. You can also access all the special registers
supported by Debug Tool commands.
When you are replaying statements, many Debug Tool commands are available
only if the following conditions are met:
v The DATA parameter must be specified or defaulted for the compile unit.
v The compile unit must be compiled with a compiler that supports the DATA
parameter.
You can use the QUERY PLAYBACK command to determine the compile units for
which the DATA option is in effect.
Debug Tool for z/OS Reference and Messages contains a complete list of all the
commands that can be used when you specify the DATA parameter.
If Debug Tool cannot display the value of a variable in its declared data type,
Debug Tool displays the value of the variable in hexadecimal format. To change
the value of the variable, type in the new value in hexadecimal format.
To display the contents of a variable once by using the LIST command, do the
following step:
1. Move the cursor to the command line.
Debug Tool opens a separate section of the Monitor window, called the
automonitor section, and displays the name and value of variables in the next
statement that you run. Each time you enter the STEP command or a breakpoint
is encountered, Debug Tool does the following:
a. Removes the previous names and values.
b. Displays the names and values of the variables of the statement that Debug
Tool runs next. The values displayed are values before the statement is run.
To save the following information in the log file, enter the SET AUTOMONITOR ON LOG
command:
v Breakpoint locations
v The names and values of the variables at the breakpoints
The default option is NOLOG, which would not save the above information.
Each entry in the log file contains the breakpoint location within the program and
the names and values of the variables in the statement. To stop saving this
information in the log file and continue updating the automonitor section of the
Monitor window, enter the SET AUTOMONITOR ON NOLOG command.
Variables that are monitored through the MONITOR LIST command are displayed
above the automonitor section of the Monitor window.
To close the automonitor section of the Monitor window and stop adding the name
and value of variables in the statements your run, enter the SET AUTOMONITOR OFF
command.
The SET AUTOMONITOR command is available only if you purchase and install IBM
Debug Tool Utilities and Advanced Functions, Version 4 Release 1 (5655-L23).
Before you run the statement in Line 1, enter the following command:
SET AUTOMONITOR ON ;
The name and value of the variables LOAN-AMOUNT and LOAN-AMOUNT-IN are
displayed in the automonitor section of the Monitor window. These values are the
values of the variables before you run the statement.
Enter the STEP command. Debug Tool removes LOAN-AMOUNT and LOAN-AMOUNT-IN
from the automonitor section of the Monitor window and then displays the name
and value of the variables INTEREST-RATE and INTEREST-RATE-IN. These values are
the values of the variables before you run the statement.
Debug Tool displays the value of the variable variable-name in hexadecimal format.
If you defined a PF key with the LIST %HEX command, do the following steps:
1. If the variable is not displayed in the Source window, scroll through your
program until the variable you want is displayed in the Source window.
2. Move your cursor to the variable name.
3. Press the PF key to which you defined LIST %HEX command. Debug Tool
displays the value of the variable variable-name in hexadecimal format.
You cannot define a PF key with the PL/I HEX built-in function.
Substitute n with the number in the monitor list the corresponds to the
monitored expression that you would like to display in hex.
v If the variable is not being monitored, enter the following command:
MONITOR LIST (expression) HEX ;
Substitute expression with the name of the variable or a complex expression you
want to monitor.
Modifying variables
There are two methods to modify variables:
v By using a command, such as MOVE or an assignment command. Each command
is described in Debug Tool for z/OS Reference and Messages.
v By typing over the existing value that is displayed in the Monitor window.
To modify the value of a variable by typing over the existing value in the Monitor
window, do the following steps:
1. Move the cursor to the existing value.
2. Type in the new value. Black vertical bars mark the area where you can type in
your new value; you cannot type anything before and including the left vertical
bar nor can you type anything including and after the right vertical bar.
3. Press Enter. Debug Tool creates a command in the command line that will do
the modification.
4. Verify that the command that Debug Tool created is correct. Press Enter.
You can modify the value of a variable by typing over the existing value in the
Monitor window, with the following exceptions:
v Only one value at a time can be modified. If you type over the values of more
than one variable, only the first one is modified.
v You cannot type in a value that is larger than the declared type of the variable.
For example, if you declare a variable as a string of four character and you try
to type in five characters, Debug Tool prevents you from typing in the fifth
character.
v If Debug Tool cannot display the entire value in the Monitor window, you
cannot modify the value of that variable. If the variable is a structure and you
want to modify an element of that structure, the element must not have an
ambiguous name. An ambiguous name is a reference to an element that might
have more than one definition. For example, if you have two structures in a C
program and each structure has an element defined as street_address char[15],
the Monitor window must display the beginning of the structure so that Debug
Tool can determine to which structure a specific element belongs to.
v If you enter quotes, carefully verify the command that Debug Tool creates to
ensure that the command complies with any applicable quotation rules.
If the Monitor window is open before you enter the SET AUTOMONITOR OFF
command and you are watching the value of variables not monitored by SET
AUTOMONITOR ON, the Monitor window remains open.
Related tasks
“Displaying values of C and C++ variables or expressions” on page 208
“Displaying values of COBOL variables” on page 191
“Accessing PL/I program variables” on page 202
“Displaying and modifying the value of assembler variables or storage” on page 168
To view a current list of allocated files, enter the DESCRIBE ALLOCATIONS command.
The following screen displays the command and sample output:
DESCRIBE ALLOCATIONS ;
* Current allocations:
* VOLUME CAT DISP OPEN DDNAME DSNAME
* 1--- 2- 3------ 4- 5----- 6------------------------------------------
* COD008 * SHR KEEP * EQAZSTEP BCARTER.TEST.LOAD
* SMS004 * SHR KEEP SHARE.CEE210.SCEERUN
* COD00B * OLD KEEP * INSPLOG BCARTER.DTOOL.LOGV
* VIO NEW DELETE ISPCTL0 SYS02190.T085429.RA000.BCARTER.R0100269
* COD016 * SHR KEEP ISPEXEC BCARTER.MVS.EXEC
* IPLB13 * SHR KEEP ISPF.SISPEXEC.VB
* VIO NEW DELETE ISPLST1 SYS02190.T085429.RA000.BCARTER.R0100274
* IPLB13 * SHR KEEP * ISPMLIB ISPF.SISPMENU
* SMS278 * SHR KEEP SHARE.ANALYZ21.SIDIMLIB
* SHR89A * SHR KEEP SHARE.ISPMLIB
* SMS25F * SHR KEEP * ISPPLIB SHARE.PROD.ISPPLIB
* SMS891 * SHR KEEP SHARE.ISPPLIB
* SMS25F * SHR KEEP SHARE.ANALYZ21.SIDIPLIB
* IPLB13 * SHR KEEP ISPF.SISPPENU
* IPLB13 * SHR KEEP SDSF.SISFPLIB
* IPLB13 * SHR KEEP SYS1.SBPXPENU
* COD002 * OLD KEEP * ISPPROF BCARTER.ISPPROF
* NEW DELETE SYSIN TERMINAL
* NEW DELETE SYSOUT TERMINAL
* NEW DELETE SYSPRINT TERMINAL
You can allocate files to an existing, cataloged data set by using the ALLOCATE
command.
By default, the DESCRIBE ALLOCATIONS command lists the files allocated by the
current user. You can specify other parameters to list other system allocations, such
as the data sets currently allocated to LINK list, LPA list, APF list, system catalogs,
Parmlib, and Proclib. The Debug Tool for z/OS Reference and Messages describes the
parameters you must specify to list this information.
Either modify your profile or use the SET MSGID ON command. To modify your
profile, use the PANEL PROFILE command and set Show message ID numbers to
YES by typing over the NO.
Related tasks
“Customizing profile settings” on page 175
To point Debug Tool to several renamed files, you can use the SET DEFAULT
LISTINGS command and specify the renamed files, separated by commas and
enclosed in parenthesis. For example, to point Debug Tool to the files
SVTRSAMP.TS99992.MYPROG, PGRSAMP.LLTEST.PROGA, and RRSAMP.CRTEST.PROGR, enter
the following command:
SET DEFAULT LISTINGS (SVTRSAMP.TS99992.MYPROG, PGRSAMP.LLTEST.PROGA, RRSAMP.CRTEST.PROGR) ;
If you need to do this repeatedly, note the SET SOURCE ON commands generated in
the Log window. You can save these commands in a file and reissue them with the
USE command for future invocations of Debug Tool.
Related tasks
“Changing which source file appears in the Source window” on page 105
An attention interrupt should not be confused with the ATTENTION condition. If you
set an AT OCCURRENCE or ON ATTENTION, the commands associated with that
breakpoint are not run at an attention interrupt.
Language Environment TRAP and INTERRUPT run-time options should both be set to
ON in order for attention interrupts that are recognized by the host operating
system to be also recognized by Language Environment. The test_level suboption of
the TEST run-time option should not be set to NONE.
For CICS and full-screen mode through a VTAM terminal only: An attention
interrupt key is not supported in CICS or full-screen mode through a VTAM
terminal.
For MVS only: For C, when using an attention interrupt, use SET INTERCEPT ON
FILE stdout to intercept messages to the terminal. This is required because
messages do not go to the terminal after an attention interrupt.
For Dynamic Debug only: The Dynamic Debug feature does not support attention
interrupts for programs that have been compiled with the TEST(NONE,SYM) compiler
option, assembler programs, and disassembly programs.
The correct key might not be marked ATTN on every keyboard. Often the
following keys are used:
v Under TSO: PA1 key
v Under IMS: PA1 key
Related references
z/OS Language Environment Programming Guide
Related references
Debug Tool for z/OS Reference and Messages
Related tasks
Chapter 28, “Debugging COBOL programs,” on page 187
“Halting when certain routines are called in COBOL” on page 124
“Modifying the value of a COBOL variable” on page 125
“Halting on a COBOL line only if a condition is true” on page 126
“Debugging COBOL when only a few parts are compiled with TEST” on page 127
“Capturing COBOL I/O to the system console” on page 127
“Displaying raw storage in COBOL” on page 128
“Getting a COBOL routine traceback” on page 128
“Tracing the run-time path for COBOL code compiled with TEST” on page 128
“Generating a COBOL run-time paragraph trace” on page 129
“Finding unexpected storage overwrite errors in COBOL” on page 130
“Halting before calling an invalid program in COBOL” on page 130
Related references
“Format for a COBOL source listing and debug file” on page 187
This program calls two subprograms to calculate a loan payment amount and the
future value of a series of cash flows. Several COBOL intrinsic functions are
utilized.
PROCEDURE DIVISION.
DISPLAY "CALC Begins." UPON CONSOLE.
MOVE 1 TO BUFFER-PTR.
MOVE SPACES TO INPUT-1.
* Keep processing data until END requested
PERFORM ACCEPT-INPUT UNTIL INPUT-1 EQUAL TO "END".
* END requested
DISPLAY "CALC Ends." UPON CONSOLE.
GOBACK.
* End of program.
*
* Accept input data from buffer
*
ACCEPT-INPUT.
MOVE BUFFER-ARRAY (BUFFER-PTR) TO INPUT-1.
ADD 1 BUFFER-PTR GIVING BUFFER-PTR.
* Allow input data to be in UPPER or lower case
EVALUATE FUNCTION UPPER-CASE(INPUT-1) CALC1
WHEN "END"
MOVE "END" TO INPUT-1
WHEN "LOAN"
PERFORM CALCULATE-LOAN
WHEN "PVALUE"
PERFORM CALCULATE-VALUE
WHEN OTHER
DISPLAY "Invalid input: " INPUT-1
END-EVALUATE.
*
* Calculate Loan via CALL to subprogram
*
CALCULATE-LOAN.
CALL "COBLOAN" USING CALL-FEEDBACK.
IF CALL-FEEDBACK IS NOT EQUAL "OK" THEN
DISPLAY "Call to COBLOAN Unsuccessful.".
*
* Calculate Present Value via CALL to subprogram
*
CALCULATE-VALUE.
CALL "COBVALU" USING CALL-FEEDBACK.
IF CALL-FEEDBACK IS NOT EQUAL "OK" THEN
DISPLAY "Call to COBVALU Unsuccessful.".
Subroutine COBLOAN
**********************************************************
* COBLOAN *
* *
* A simple subprogram that calculates payment amount *
* for a loan. *
* *
**********************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. COBLOAN.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 FIELDS.
05 INPUT-1 PIC X(26).
05 PAYMENT PIC S9(9)V99 USAGE COMP.
05 PAYMENT-OUT PIC $$$$,$$$,$$9.99 USAGE DISPLAY.
05 LOAN-AMOUNT PIC S9(7)V99 USAGE COMP.
05 LOAN-AMOUNT-IN PIC X(16).
Subroutine COBVALU
**********************************************************
* COBVALU *
* *
* A simple subprogram that calculates present value *
* for a series of cash flows. *
* *
**********************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. COBVALU.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 CHAR-DATA.
05 INPUT-1 PIC X(10).
05 PAYMENT-OUT PIC $$$$,$$$,$$9.99 USAGE DISPLAY.
05 INTEREST-IN PIC X(5).
05 NO-OF-PERIODS-IN PIC X(3).
05 INPUT-BUFFER PIC X(10) VALUE "5069837544".
05 BUFFER-ARRAY REDEFINES INPUT-BUFFER
OCCURS 5 TIMES
PIC XX.
05 OUTPUT-LINE PIC X(79).
01 NUM-DATA.
05 PAYMENT PIC S9(9)V99 USAGE COMP.
05 INTEREST PIC S9(3)V99 USAGE COMP.
05 COUNTER PIC 99 USAGE COMP.
05 NO-OF-PERIODS PIC 99 USAGE COMP.
05 VALUE-AMOUNT OCCURS 99 PIC S9(7)V99 COMP.
LINKAGE SECTION.
01 PARM-1.
05 CALL-FEEDBACK PIC XX.
PROCEDURE DIVISION USING PARM-1.
Related tasks
Chapter 21, “Debugging a COBOL program in full-screen mode,” on page 121
If the CU COBVALU is known to Debug Tool (that is, it has been called
previously), to halt just after COBVALU is called, issue the command:
AT ENTRY COBVALU ;
If the CU COBVALU is not known to Debug Tool (that is, it has not been called
previously), to halt just before COBVALU is entered the first time, issue the
command:
AT APPEARANCE COBVALU ;
You can display a list of all compile units that are known to Debug Tool by
entering the command:
LIST NAMES CUS ;
The purpose for the appearance breakpoint is to gain control the first time the
COBVALU compile unit is run.
If you have many breakpoints set in your program, you can issue the command:
QUERY LOCATION
to indicate where in your program execution has been interrupted. The Debug Tool
Log window displays something similar to:
QUERY LOCATION ;
You were prompted because STEP ended.
The program is currently entering block COBVALU.
To list the contents of a single variable, move the cursor to an occurrence of the
variable name in the Source window and press PF4 (LIST). Remember that Debug
Tool starts after program initialization but before symbolic COBOL variables are
initialized, so you cannot view or modify the contents of variables until you have
performed a step or run. The value is displayed in the Log window. This is
equivalent to entering LIST TITLED variable on the command line. Run the
COBCALC program to the statement labeled CALC1, and enter AT 46 ; GO ; on
the Debug Tool command line. Move the cursor over INPUT-1 and press LIST (PF4).
The following appears in the Log window:
LIST ( INPUT-1 ) ;
INPUT-1 = ’LOAN ’
Now step into the call to COBVALU by pressing PF2 (STEP) and step until the
statement labeled VALU2 is reached. To view the attributes of the variable
INTEREST, issue the Debug Tool command:
DESCRIBE ATTRIBUTES INTEREST ;
Note: If you use the LIST command to list the contents of an uninitialized variable,
or a variable that contains invalid data, Debug Tool displays INVALID DATA.
Related tasks
“Using COBOL variables with Debug Tool” on page 189
For example, in COBVALU you want to stop at the calculation of present value
only if the discount rate is less than or equal to -1 (before the exception occurs).
First run COBCALC, step into COBVALU, and stop at the statement labeled
VALU1. To accomplish this, issue these Debug Tool commands at the start of
COBCALC:
AT 67 ; GO ;
CLEAR AT 67 ; STEP 4 ;
Line 44 is the statement labeled VALU3. The command causes Debug Tool to stop
at line 44. If the value of INTEREST is greater than -1, the program continues. The
command causes Debug Tool to remain on line 44 only if the value of INTEREST is
less than or equal to -1.
To force the discount rate to be negative, enter the Debug Tool command:
MOVE ’-2 5’ TO INPUT-1 ;
Run the program by issuing the GO command. Debug Tool halts the program at
line 44. Display the contents of INTEREST by issuing the LIST INTEREST command.
To view the effect of this breakpoint when the discount rate is positive, begin a
new debug session and repeat the Debug Tool commands shown in this section.
However, do not issue the MOVE ’-2 5’ TO INPUT-1 command. The program
execution does not stop at line 44 and the program runs to completion.
Suppose you want to set a breakpoint at entry to COBVALU. COBVALU has been
compiled with TEST but the other programs have not. Debug Tool comes up with
an empty Source window. You can use the LIST NAMES CUS command to determine
if the COBVALU compile unit is known to Debug Tool and then set the
appropriate breakpoint using either the AT APPEARANCE or the AT ENTRY command.
Related tasks
“Halting when certain routines are called in COBOL” on page 124
For example, if you run COBCALC and issue the Debug Tool SET INTERCEPT ON
CONSOLE command, followed by the STEP 3 command, you will see the following
output displayed in the Debug Tool Log window:
SET INTERCEPT ON CONSOLE ;
STEP 3 ;
CONSOLE : CALC Begins.
The phrase CALC Begins. is displayed by the statement DISPLAY "CALC Begins."
UPON CONSOLE in COBCALC.
The SET INTERCEPT ON CONSOLE command not only captures output to the system
console, but also allows you to input data from your Debug Tool terminal instead
of the system console by using the Debug Tool INPUT command. For example, if
the next COBOL statement executed is ACCEPT INPUT-DATA FROM CONSOLE, the
following message appears in the Debug Tool Log window:
CONSOLE : IGZ0000I AWAITING REPLY.
The program is waiting for input from CONSOLE.
Use the INPUT command to enter 114 characters for the intercepted
fixed-format file.
Note: Whenever Debug Tool intercepts system console I/O, and for the duration
of the intercept, the display in the Source window is empty and the Location
field in the session panel header at the top of the screen shows Unknown.
For example, if you run the COBCALC example with the commands:
AT APPEARANCE COBVALU AT ENTRY COBVALU;
GO;
GO;
LIST CALLS;
Tracing the run-time path for COBOL code compiled with TEST
To trace a program showing the entry and exit points without requiring any
changes to the program, place the following Debug Tool commands in a file or
data set and USE them when Debug Tool initially displays your program.
Assuming you have a PDS member, USERID.DT.COMMANDS(COBCALC), that
contains the following Debug Tool commands:
* Commands in a COBOL USE file must be coded in columns 8-72.
* If necessary, commands can be continued by coding a ’-’ in
* column 7 of the continuation line.
01 LEVEL PIC 99 USAGE COMP;
MOVE 1 TO LEVEL;
AT ENTRY * PERFORM;
COMPUTE LEVEL = LEVEL + 1;
LIST ( "Entry:", LEVEL, %CU);
GO;
END-PERFORM;
AT EXIT * PERFORM;
LIST ( "Exit:", LEVEL);
COMPUTE LEVEL = LEVEL - 1;
GO;
END-PERFORM;
You can use this file as the source of commands to Debug Tool by entering the
following command:
USE USERID.DT.COMMANDS(COBCALC)
If you do not want to create the USE file, you can enter the commands through the
command line, and the same effect is achieved.
When Debug Tool initially displays your program, enter the following command:
USE USERID.DT.COMMANDS(COBCALC2)
After executing the USE file, you can run COBCALC and the following trace (or
similar) is displayed in the Log window:
59 CALCULATE-LOAN.
42 ACCEPT-INPUT.
66 CALCULATE-VALUE.
64 GET-AMOUNTS.
64 GET-AMOUNTS.
64 GET-AMOUNTS.
64 GET-AMOUNTS.
64 GET-AMOUNTS.
42 ACCEPT-INPUT.
66 CALCULATE-VALUE.
64 GET-AMOUNTS.
64 GET-AMOUNTS.
64 GET-AMOUNTS.
64 GET-AMOUNTS.
64 GET-AMOUNTS.
42 ACCEPT-INPUT.
Suppose the result is X'0000F559'. To set a breakpoint that watches for a change in
storage values starting at that address for the next 8 bytes, issue the command:
AT CHANGE %STORAGE(H’0000F559’,8)
When the program runs, Debug Tool halts if the value in this storage changes.
When Debug Tool stops at this breakpoint, you can bypass the CALL by entering
the GO BYPASS command. This allows you to continue your debug session without
raising a condition.
Related tasks
Chapter 29, “Debugging PL/I programs,” on page 199
“Halting when certain PL/I functions are called” on page 136
“Modifying the value of a PL/I variable” on page 136
“Halting on a PL/I line only if a condition is true” on page 137
“Debugging PL/I when only a few parts are compiled with TEST” on page 137
“Displaying raw storage in PL/I” on page 138
“Getting a PL/I function traceback” on page 138
“Tracing the run-time path for PL/I code compiled with TEST” on page 138
“Finding unexpected storage overwrite errors in PL/I” on page 140
“Halting before calling an undefined program in PL/I” on page 140
This program is a simple calculator that reads its input from a character buffer. If
integers are read, they are pushed on a stack. If one of the operators (+ - * /) is
read, the top two elements are popped off the stack, the operation is performed on
them and the result is pushed on the stack. The = operator writes out the value of
the top element of the stack to a buffer.
TOK function
atoi: procedure(tok) returns (fixed bin(31,0));
/*------------------------------------------------------------------*/
/* */
/* convert character string to number */
/* (note: string validated by readtok) */
/* */
/*------------------------------------------------------------------*/
dcl 1 tok char (100) varying;
dcl 1 num fixed bin (31,0);
dcl 1 j fixed bin(15,0);
num = 0;
do j = 1 to length(tok);
num = (10 * num) + (index(’0123456789’,substr(tok,j,1))-1);
end;
return (num);
end atoi;
end plicalc;
PUSH function
POP function
pop: procedure(stack) returns (fixed bin(31,0));
/*------------------------------------------------------------------*/
/* */
/* a simple pop function for a stack of integers */
/* */
/*------------------------------------------------------------------*/
dcl 1 stack connected,
2 stkptr fixed bin(15,0),
2 stknum(50) fixed bin(31,0);
stkptr = stkptr - 1;
return (stknum(stkptr+1));
end pop;
READTOK function
readtok: procedure(bufin) returns (char (100) varying);
/*------------------------------------------------------------------*/
/* */
/* a function to read input and tokenize it for a simple calculator */
/* */
/* action: get next input char, update index for next call */
/* return: next input char(s) */
/*------------------------------------------------------------------*/
dcl length builtin;
dcl substr builtin;
dcl verify builtin;
dcl 1 bufin connected,
2 bufptr fixed bin(15,0),
2 bufchr char (100) varying;
dcl 1 tok char (100) varying;
dcl 1 tstop char(1) init (’s’);
dcl 1 j fixed bin(15,0);
/* start of processing */
if bufptr > length(bufchr) then do;
tok = tstop;
return ( tok );
end;
bufptr = bufptr + 1;
do while (substr(bufchr,bufptr,1) = ’ ’);
bufptr = bufptr + 1;
if bufptr > length(bufchr) then do;
tok = tstop;
return ( tok );
end;
end;
tok = substr(bufchr,bufptr,1); /* get ready to return single char */
select (tok);
when (’+’,’-’,’/’,’*’,’=’)
bufptr = bufptr;
otherwise do; /* possibly an integer */
tok = ’’;
Related tasks
Chapter 22, “Debugging a PL/I program in full-screen mode,” on page 133
To take advantage of the AT ENTRY command, you must compile your program
with the TEST option.
If you have many breakpoints set in your program, you can issue the command:
QUERY LOCATION
to indicate where in your program execution has been interrupted. The Debug Tool
Log window displays something similar to:
QUERY LOCATION ;
You are executing commands in the ENTRY READTOK breakpoint.
The program is currently entering block READTOK.
To modify the value of NUM to 22, type over the NUM = 18 line with NUM = 22,
press Enter to put it on the command line, and press Enter again to issue the
command.
You can list all the values of the members of the structure pointed to by STACK with
the command:
LIST STACK;
You can change the value of a structure member by issuing the assignment as a
command as in the following example:
STKNUM(STKPTR) = 33;
For example, in PLICALC you want to stop at the division selection only if the
divisor is 0 (before the exception occurs). Set the breakpoint like this:
AT 31 DO; IF NUM ^= 0 THEN GO; END;
Line 31 is the statement labeled CALC2. The command causes Debug Tool to stop
at line 31. If the value of NUM is not 0, the program continues. The command
causes Debug Tool to stop on line 31 only if the value of NUM is 0.
Debugging PL/I when only a few parts are compiled with TEST
“Example: sample PL/I program for debugging” on page 133
Suppose you want to set a breakpoint at entry to subroutine PUSH. PUSH has
been compiled with TEST, but the other files have not. Debug Tool comes up with
an empty Source window. To display the compile units, enter the command:
LIST NAMES CUS
The LIST NAMES CUS command displays a list of all the compile units that are
known to Debug Tool. If PUSH is fetched later on by the application, this compile
unit might not be known to Debug Tool. If it is displayed, enter:
The only purpose for this appearance breakpoint is to gain control the first time a
function in the PUSH compile unit is run. When that happens, you can set a
breakpoint at entry to PUSH like this:
AT ENTRY PUSH;
For example, if you run the PLICALC example with the commands:
AT ENTRY READTOK ;
GO ;
LIST CALLS ;
Tracing the run-time path for PL/I code compiled with TEST
To trace a program showing the entry and exit without requiring any changes to
the program, place the following Debug Tool commands in a file or data set and
USE them when Debug Tool initially displays your program. Assuming you have a
PDS member, USERID.DT.COMMANDS(PLICALL), that contains the following
Debug Tool commands:
SET PROGRAMMING LANGUAGE PLI ;
DCL LVLSTR CHARACTER (50);
DCL LVL FIXED BINARY (15); LVL = 0;
AT ENTRY *
DO;
LVLSTR = ’ ’ ;
LVL = LVL + 1 ;
SUBSTR ( LVLSTR, LVL, 1 ) = ’>’ ;
You can use this file as the source of commands to Debug Tool by entering the
following command:
USE USERID.DT.COMMANDS(PLICALL)
If, after executing the USE file, you run the following program sequence:
*PROCESS MACRO,OPT(TIME);
*PROCESS S STMT TEST(ALL);
INIT(’STACK(20K,20K),TEST’);
CALL PLISUB;
PLISUB: PROC;
CALL PLISUB1;
END PLISUB;
PLISUB1: PROC;
CALL PLISUB2;
END PLISUB1;
PLISUB2: PROC;
Suppose the result is X'00521D42'. To set a breakpoint that watches for a change in
storage values starting at that address for the next 8 bytes, issue the command:
AT CHANGE %STORAGE(’00521D42’px,8)
When the program is run, Debug Tool halts if the value in this storage changes.
When Debug Tool stops at this breakpoint, you can bypass the CALL by entering
the GO BYPASS command. This allows you to continue your debug session without
raising a condition.
Related tasks
Chapter 30, “Debugging C and C++ programs,” on page 207
“Halting when certain functions are called in C” on page 144
“Modifying the value of a C variable” on page 144
“Halting on a line in C only if a condition is true” on page 145
“Debugging C when only a few parts are compiled with TEST” on page 145
“Capturing C output to stdout” on page 146
“Calling a C function from Debug Tool” on page 146
“Displaying raw storage in C” on page 147
“Debugging a C DLL” on page 147
“Getting a function traceback in C” on page 147
“Tracing the run-time path for C code compiled with TEST” on page 148
“Finding unexpected storage overwrite errors in C” on page 148
“Finding uninitialized storage errors in C” on page 149
“Halting before calling a NULL C function” on page 150
This program is a simple calculator that reads its input from a character buffer. If
integers are read, they are pushed on a stack. If one of the operators (+ − * /) is
read, the top two elements are popped off the stack, the operation is performed on
them, and the result is pushed on the stack. The = operator writes out the value of
the top element of the stack to a buffer.
CALC.H
/*----- FILE CALC.H --------------------------------------------------*/
/* */
/* Header file for CALC.C PUSHPOP.C READTOKN.C */
/* a simple calculator */
/*--------------------------------------------------------------------*/
typedef enum toks {
T_INTEGER,
T_PLUS,
T_TIMES,
T_MINUS,
T_DIVIDE,
T_EQUALS,
T_STOP
} Token;
Token read_token(char buf[]);
typedef struct int_link {
struct int_link * next;
int i;
} IntLink;
typedef struct int_stack {
CALC.C
/*----- FILE CALC.C --------------------------------------------------*/
/* */
/* A simple calculator that does operations on integers that */
/* are pushed and popped on a stack */
/*--------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include "calc.h"
IntStack stack = { 0 };
main()
{
Token tok;
char word[100];
char buf_out[100];
int num, num2;
for(;;)
{
tok=read_token(word);
switch(tok)
{
case T_STOP:
break;
case T_INTEGER:
num = atoi(word);
push(&stack,num); /* CALC1 statement */
break;
case T_PLUS:
push(&stack, pop(&stack)+pop(&stack) );
break;
case T_MINUS:
num = pop(&stack);
push(&stack, num-pop(&stack));
break;
case T_TIMES:
push(&stack, pop(&stack)*pop(&stack));
break;
case T_DIVIDE:
num2 = pop(&stack);
num = pop(&stack);
push(&stack, num/num2); /*CALC2 statement */
break;
case T_EQUALS:
num = pop(&stack);
sprintf(buf_out,"= %d ",num);
push(&stack,num);
break;
}
if (tok==T_STOP)
break;
}
return 0;
}
PUSHPOP.C
/*----- FILE PUSHPOP.C -----------------------------------------------*/
/* */
/* A push and pop function for a stack of integers */
/*--------------------------------------------------------------------*/
#include <stdlib.h>
#include "calc.h"
}
/*--------------------------------------------------------------------*/
/* return: int value popped from stack */
/* action: pops top element from stack and gets return value from it */
/*--------------------------------------------------------------------*/
extern int pop(IntStack * stk)
{
IntLink * ptr;
int num;
ptr = stk–>top;
num = ptr–>i;
stk–>top = ptr–>next;
free(ptr);
return num;
}
READTOKN.C
/*----- FILE READTOKN.C ----------------------------------------------*/
/* */
/* A function to read input and tokenize it for a simple calculator */
/*--------------------------------------------------------------------*/
#include <ctype.h>
#include <stdio.h>
#include "calc.h"
/*--------------------------------------------------------------------*/
/* action: get next input char, update index for next call */
/* return: next input char */
/*--------------------------------------------------------------------*/
static char nextchar(void)
{
/*--------------------------------------------------------------------*/
/* input action: */
/* 2 push 2 on stack */
/* 18 push 18 */
/* + pop 2, pop 18, add, push result (20) */
/* = output value on the top of the stack (20) */
/* 5 push 5 */
/* / pop 5, pop 20, divide, push result (4) */
/* = output value on the top of the stack (4) */
/*--------------------------------------------------------------------*/
char * buf_in = "2 18 + = 5 / = ";
static int index; /* starts at 0 */
char ret;
ret = buf_in[index];
++index;
return ret;
}
/*--------------------------------------------------------------------*/
/* output: buf - null terminated token */
/* return: token type */
/* action: reads chars through nextchar() and tokenizes them */
/*--------------------------------------------------------------------*/
Token read_token(char buf[])
Related tasks
Chapter 23, “Debugging a C program in full-screen mode,” on page 141
To take advantage of either of the above actions, you must compile your program
with the TEST compiler option.
Run the CALC program above to the statement labeled CALC1, move the cursor
over num and press PF4 (LIST). The following appears in the Log window:
LIST ( num ) ;
num = 2
Now step into the call to push() by pressing PF2 (STEP) and step until the
statement labeled PUSHPOP2 is reached. To view the attributes of variable ptr,
issue the Debug Tool command:
DESCRIBE ATTRIBUTES *ptr;
You can list all the values of the members of the structure pointed to by ptr with
the command:
LIST *ptr ;
You can change the value of a structure member by issuing the assignment as a
command as in the following example:
(* ptr).i = 33 ;
For example, in the main procedure of the program above, you want to stop at
T_DIVIDE only if the divisor is 0 (before the exception occurs). Set the breakpoint
like this:
AT 40 { if(num2 != 0) GO; }
Line 40 is the statement labeled CALC2. The command causes Debug Tool to stop
at line 40. If the value of num2 is not 0, the program continues. You can enter
Debug Tool commands to change the value of num2 to a nonzero value.
The LIST NAMES CUS command displays a list of all the compile units that are
known to Debug Tool. Depending on the compiler you are using, or if
"USERID.MFISTART.C(PUSHPOP)" is fetched later on by the application, this compile
unit might not be known to Debug Tool. If it is displayed, enter:
SET QUALIFY CU "USERID.MFISTART.C(PUSHPOP)"
AT ENTRY push;
GO ;
or
AT ENTRY "USERID.MFISTART.C(PUSHPOP)":>push
GO;
The only purpose for this appearance breakpoint is to gain control the first time a
function in the PUSHPOP compile unit is run. When that happens, you can set
breakpoints at entry to push():
AT ENTRY push;
With this SET command, you will capture not only stdout from your program, but
also from interactive function calls. For example, you can interactively call printf
on the command line to display a null-terminated string by entering:
printf(sptr);
Below, we call push() interactively to push one more value on the stack just before
a value is popped off.
AT CALL pop ;
GO ;
push(77);
GO ;
If the string is null terminated, you can also use an interactive function call on the
command line, as in:
puts(ptr) ;
Debugging a C DLL
“Example: sample C program for debugging” on page 141
Build PUSHPOP.C as a DLL, exporting push() and pop(). Build CALC.C and
READTOKN.C as the program that imports push() and pop() from the DLL
named PUSHPOP. When the application CALC starts the DLL, PUSHPOP will not
be known to Debug Tool. Use the AT APPEARANCE breakpoint to gain control in the
DLL the first time code in that compile unit appears, as shown in the following
example:
AT APPEARANCE "USERID.MFISTART.C(PUSHPOP)" ;
GO ;
The only purpose of this appearance breakpoint is to gain control the first time a
function in the PUSHPOP compile unit is run. When this happens, you can set
breakpoints in PUSHPOP.
For example, if you run the CALC example with the commands:
AT ENTRY read_token ;
GO ;
LIST CALLS ;
You can use this file as the source of commands to Debug Tool by entering the
following command:
USE USERID.DTUSE(TRACE)
The trace of running the program listed below after executing the USE file will be
displayed in the Log window.
int foo(int i, int j) {
return i+j;
}
int main(void) {
return foo(1,2);
}
The following trace in the Log window is displayed after running the sample
program, with the USE file as a source of input for Debug Tool commands:
>main
>foo
<foo
<main
If you do not want to create the USE file, you can enter the commands through the
command line, and the same effect is achieved.
Suppose the result is 0x7042A04. To set a breakpoint that watches for a change in
storage values starting at that address for the next 4 bytes, issue the command:
AT CHANGE %STORAGE(0x7042A04,4)
When the program is run, Debug Tool will halt if the value in this storage changes.
the first subparameter of STORAGE is the fill byte for storage allocated from the
heap. For example, storage allocated through malloc() is filled with the byte 0xFD.
If you see this byte repeated through storage, it is likely uninitialized heap storage.
The second subparameter of STORAGE is the fill byte for storage allocated from the
heap but then freed. For example, storage freed by calling free() might be filled
with the byte 0xFB. If you see this byte repeated through storage, it is likely
storage that was allocated on the heap, but has been freed.
The third subparameter of STORAGE is the fill byte for auto storage variables in a
new stack frame. If you see this byte repeated through storage, it is likely
uninitialized auto storage.
The values chosen in the example are odd and large, to maximize early problem
detection. For example, if you attempt to branch to an odd address you will get an
exception immediately.
You will see the byte fill for uninitialized heap storage as the following example
shows:
LIST * ptr ;
(* ptr).next = 0xFDFDFDFD
(* ptr).i = −33686019
When Debug Tool stops at this breakpoint, you can bypass the CALL by entering
the GO BYPASS command. This allows you to continue your debug session without
raising a condition.
Related tasks
Chapter 30, “Debugging C and C++ programs,” on page 207
“Halting when certain functions are called in C++” on page 155
“Modifying the value of a C++ variable” on page 155
“Halting on a line in C++ only if a condition is true” on page 156
“Viewing and modifying data members of the this pointer in C++” on page 157
“Debugging C++ when only a few parts are compiled with TEST” on page 157
“Capturing C++ output to stdout” on page 158
“Calling a C++ function from Debug Tool” on page 158
“Displaying raw storage in C++” on page 158
“Debugging a C++ DLL” on page 158
“Getting a function traceback in C++” on page 159
“Tracing the run-time path for C++ code compiled with TEST” on page 159
“Finding unexpected storage overwrite errors in C++” on page 160
“Finding uninitialized storage errors in C++” on page 160
“Halting before calling a NULL C++ function” on page 161
This program is a simple calculator that reads its input from a character buffer. If
integers are read, they are pushed on a stack. If one of the operators (+ − * /) is
read, the top two elements are popped off the stack, the operation is performed on
them, and the result is pushed on the stack. The = operator writes out the value of
the top element of the stack to a buffer.
CALC.HPP
/*----- FILE CALC.HPP ------------------------------------------------*/
/* */
/* Header file for CALC.CPP PUSHPOP.CPP READTOKN.CPP */
/* a simple calculator */
/*--------------------------------------------------------------------*/
typedef enum toks {
T_INTEGER,
T_PLUS,
T_TIMES,
T_MINUS,
T_DIVIDE,
T_EQUALS,
T_STOP
} Token;
extern "C" Token read_token(char buf[]);
class IntLink {
private:
int i;
IntLink * next;
public:
IntLink();
CALC.CPP
/*----- FILE CALC.CPP ------------------------------------------------*/
/* */
/* A simple calculator that does operations on integers that */
/* are pushed and popped on a stack */
/*--------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include "calc.hpp"
IntStack stack;
int main()
{
Token tok;
char word[100];
char buf_out[100];
int num, num2;
for(;;)
{
tok=read_token(word);
switch(tok)
{
case T_STOP:
break;
case T_INTEGER:
num = atoi(word);
stack.push(num); /* CALC1 statement */
break;
case T_PLUS:
stack.push(stack.pop()+stack.pop());
break;
case T_MINUS:
num = stack.pop();
stack.push(num-stack.pop());
break;
case T_TIMES:
stack.push(stack.pop()*stack.pop() );
break;
case T_DIVIDE:
num2 = stack.pop();
num = stack.pop();
stack.push(num/num2); /* CALC2 statement */
break;
case T_EQUALS:
num = stack.pop();
sprintf(buf_out,"= %d ",num);
stack.push(num);
break;
}
if (tok==T_STOP)
PUSHPOP.CPP
/*----- FILE: PUSHPOP.CPP --------------------------------------------*/
/* */
/* Push and pop functions for a stack of integers */
/*--------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include "calc.hpp"
/*--------------------------------------------------------------------*/
/* input: num - value to push on the stack */
/* action: get a link to hold the pushed value, push link on stack */
/*--------------------------------------------------------------------*/
void IntStack::push(int num) {
IntLink * ptr;
ptr = new IntLink;
ptr–>set_i(num);
ptr–>set_next(top);
top = ptr;
}
/*--------------------------------------------------------------------*/
/* return: int value popped from stack (0 if stack is empty) */
/* action: pops top element from stack and get return value from it */
/*--------------------------------------------------------------------*/
int IntStack::pop() {
IntLink * ptr;
int num;
ptr = top;
num = ptr–>get_i();
top = ptr–>get_next();
delete ptr;
return num;
}
IntStack::IntStack() {
top = 0;
}
IntStack::~IntStack() {
while(top)
pop();
}
IntLink::IntLink() { /* constructor leaves elements unassigned */
}
IntLink::~IntLink() {
}
void IntLink::set_i(int j) {
i = j;
}
int IntLink::get_i() {
return i;
}
void IntLink::set_next(IntLink * p) {
next = p;
}
IntLink * IntLink::get_next() {
return next;
}
READTOKN.CPP
/*----- FILE READTOKN.CPP --------------------------------------------*/
/* */
/* A function to read input and tokenize it for a simple calculator */
/*--------------------------------------------------------------------*/
Related tasks
Chapter 24, “Debugging a C++ program in full-screen mode,” on page 151
To facilitate entering the breakpoint, you can display PUSHPOP.CPP in the Source
window by typing over the name of the file on the top line of the Source window.
This makes PUSHPOP.CPP your currently qualified program. You can then issue
the command:
LIST NAMES
which displays the names of all the blocks and variables for the currently qualified
program. Debug Tool displays information similar to the following in the Log
window:
There are no session names.
The following names are known in block CALC ::> "USERID.MFISTART.CPP(PUSHPOP)"
IntStack::~IntStack()
IntStack::IntStack()
IntLink::get_i()
IntLink::get_next()
IntLink::~IntLink()
IntLink::set_i(int)
IntLink::set_next(IntLink*)
IntLink::IntLink()
Now you can save some keystrokes by inserting the command next to the block
name.
To be able to halt, the file with the calling code must be compiled with the TEST
compiler option.
Run the CALC program and step into the first call of function
IntStack::push(int) until just after the IntLink has been allocated. Enter the
Debug Tool command:
LIST TITLED num
To modify the value of num to 22, type over the num = 2 line with num = 22, press
Enter to put it on the command line, and press Enter again to issue the command.
To view the attributes of variable ptr in IntStack::push(int), issue the Debug Tool
command:
DESCRIBE ATTRIBUTES *ptr;
So for most classes, structures, and unions, this can act as a browser.
You can list all the values of the data members of the class object pointed to by ptr
with the command:
LIST *ptr ;
You can change the value of data member of a class object by issuing the
assignment as a command, as in this example:
(* ptr).i = 33 ;
Related tasks
“Using C and C++ variables with Debug Tool” on page 208
For example, in main you want to stop in T_DIVIDE only if the divisor is 0 (before
the exception occurs). Set the breakpoint like this:
AT 40 { if(num2 != 0) GO; }
Line 40 is the statement labeled CALC2. The command causes Debug Tool to stop
at line 40. If the value of num is not 0, the program will continue. Debug Tool stops
on line 40 only if num2 is 0.
you will see the types of the data elements pointed to by the this pointer. With the
command:
LIST *this ;
you will list the data member of the object pointed to and see something like:
LIST * this ;
(* this).i = 4
(* this).next = 0x0
or, if you have ambiguity (for example, you also have an auto variable named i),
enter:
(* this).i = 2001 ;
Debugging C++ when only a few parts are compiled with TEST
“Example: sample C++ program for debugging” on page 151
The LIST NAMES CUS command displays a list of all the compile units that are
known to Debug Tool.
or
AT ENTRY "USERID.MFISTART.CPP(PUSHPOP)":>push
GO
With this SET command, you will not only capture stdout from your program, but
also from interactive function calls. For example, you can interactively use cout on
the command line to display a null terminated string by entering:
cout << sptr ;
The calculator produces different results than before because of the additional
token removed from input.
If the string is null terminated, you can also use an interactive function call on the
command line as shown in this example:
puts(ptr) ;
The only purpose of this appearance breakpoint is to gain control the first time a
function in the PUSHPOP compile unit is run. When this happens, you can set
breakpoints in PUSHPOP.
For example, if you run the CALC example with the following commands:
AT ENTRY read_token ;
GO ;
LIST CALLS ;
Tracing the run-time path for C++ code compiled with TEST
To trace a program showing the entry and exit of that program without requiring
any changes to it, place the following Debug Tool commands, shown in the
example below, in a file and USE them when Debug Tool initially displays your
program. Assume you have a data set that contains USERID.DTUSE(TRACE) and
contains the following Debug Tool commands:
int indent;
indent = 0;
SET INTERCEPT ON FILE stdout;
AT ENTRY * { \
++indent; \
if (indent < 0) indent = 0; \
printf("%*.s>%s\n", indent, " ", %block); \
GO; \
}
AT EXIT * {\
if (indent < 0) indent = 0; \
printf("%*.s<%s\n", indent, " ", %block); \
--indent; \
GO; \
}
You can use this file as the source of commands to Debug Tool by entering the
following command:
USE USERID.DTUSE(TRACE)
The trace of running the program listed below after executing the USE file is
displayed in the Log window:
The following trace in the Log window is displayed after running the sample
program, using the USE file as a source of input for Debug Tool commands:
>main
>foo(int,int)
<foo(int,int)
<main
If you do not want to create the USE file, you can enter the commands through the
command line, and the same effect will be achieved.
Suppose the result is 0x7042A04. To set a breakpoint that watches for a change in
storage values, starting at that address for the next 4 bytes, issue the command:
AT CHANGE %STORAGE(0x7042A04,4)
When the program is run, Debug Tool will halt if the value in this storage changes.
the first subparameter of STORAGE is the fill byte for storage allocated from the
heap. For example, storage allocated through operator new is filled with the byte
0xFD. If you see this byte repeated throughout storage, it is likely uninitialized
heap storage.
The second subparameter of STORAGE is the fill byte for storage allocated from the
heap but then freed. For example, storage freed by the operator delete might be
The third subparameter of STORAGE is the fill byte for auto storage variables in a
new stack frame. If you see this byte repeated throughout storage, it is likely that it
is uninitialized auto storage.
The values chosen in the example are odd and large, to maximize early problem
detection. For example, if you attempt to branch to an odd address, you will get an
exception immediately.
As an example of uninitialized heap storage, run program CALC, with the STORAGE
run-time option as STORAGE(FD,FB,F9), to the line labeled PUSHPOP2 and issue the
command:
LIST *ptr ;
You will see the byte fill for uninitialized heap storage as the following example
shows:
LIST * ptr ;
(* ptr).next = 0xFDFDFDFD
(* ptr).i = −33686019
Related references
z/OS Language Environment Programming Guide
When Debug Tool stops at this breakpoint, you can bypass the call by entering the
GO BYPASS command. This command allows you to continue your debug session
without raising a condition.
Related tasks
Chapter 31, “Debugging an assembler program,” on page 231
“Defining a compilation unit as assembler and loading debug data” on page 166
“Defining a compilation unit in a different load module as assembler” on page 167
“Halting when certain assembler routines are called” on page 168
“Displaying and modifying the value of assembler variables or storage” on page 168
“Halting on a line in assembler only if a condition is true” on page 169
“Debugging assembler when debug data is only available for a few parts” on page 169
“Getting an assembler routine traceback” on page 170
“Finding unexpected storage overwrite errors in assembler” on page 170
This program is a small example of an assembler main routine (SUBXMP) that calls
an assembler subroutine (DISPARM).
SUBXMP.ASM
**************************************************************
* *
* NAME: SUBXMP *
* *
* A simple main assembler routine that brings up *
* Language Environment, calls a subroutine, and *
* returns with a return code of 0. *
* *
**************************************************************
SUBXMP CEEENTRY PPA=XMPPPA,AUTO=WORKSIZE
USING WORKAREA,R13
* Invoke CEEMOUT to issue the greeting message
CALL CEEMOUT,(HELLOMSG,DEST,FBCODE),VL,MF=(E,CALLMOUT)
* No plist to DISPARM, so zero R1. Then call it.
SLR R0,R0
ST R0,COUNTER
LA R0,HELLOMSG
SR R01,R01 ssue a message
* CONSTANTS
HELLOMSG DC Y(HELLOEND-HELLOSTR)
HELLOSTR DC C’Hello from the sub example.’
HELLOEND EQU *
BYEMSG DC Y(BYEEND-BYESTART)
BYESTART DC C’Terminating the sub example.’
BYEEND EQU *
DEST DC F’2’ Destination is the LE message file
COUNTER DC F’-1’
DISPARM.ASM
**************************************************************
* *
* NAME: DISPARM *
* *
* Shows an assembler subroutine that displays inbound *
* parameters and returns. *
* *
**************************************************************
DISPARM CEEENTRY PPA=PARMPPA,AUTO=WORKSIZE,MAIN=NO
USING WORKAREA,R13
* Invoke CEE3PRM to retrieve the command parameters for us
SLR R0,R0
ST R0,COUNTER
CALL CEE3PRM,(CHARPARM,FBCODE),VL,MF=(E,CALL3PRM) CALL2
* Check the feedback code from CEE3PRM to see if everything worked.
CLC FBCODE(8),CEE000
BE GOT_PARM
* Invoke CEEMOUT to issue the error message for us
CALL CEEMOUT,(BADFBC,DEST,FBCODE),VL,MF=(E,CALLMOUT)
B GO_HOME Time to go....
GOT_PARM DS 0H
* See if the parm string is blank.
LA R1,1
SAVECTR ST R1,COUNTER
CL R1,=F’5’ BUMPCTR
BH LOOPEND
LA R1,1(,R1)
B SAVECTR
LOOPEND DS 0H
CLC CHARPARM(80),=CL80’ ’ Is the parm empty?
BNE DISPLAY_PARM No. Print it out.
* Invoke CEEMOUT to issue the error message for us
DISPLAY_PARM DS 0H
* Set up the plist to CEEMOUT to display the parm.
LA R0,2
ST R0,COUNTER
LA R02,80 Get the size of the string
STH R02,BUFFSIZE Save it for the len-prefixed string
* Invoke CEEMOUT to display the parm string for us
CALL CEEMOUT,(BUFFSIZE,DEST,FBCODE),VL,MF=(E,CALLMOUT)
* AMODE Testing
GO_TEST DS 0H
L R15,INAMODE24@
BSM R14,R15
InAMode24 Equ *
LA R1,DEST
O R1,=X’FF000000’
L R15,0(,R1)
LA R15,2(,R15)
ST R15,0(,R1)
L R15,INAMODE31@
BSM R14,R15
InAMode31 Equ *
* Return to the caller
GO_HOME DS 0H
LA R0,3
ST R0,COUNTER
CEETERM RC=0
* CONSTANTS
DEST DC F’2’ Destination is the LE message file
CEE000 DS 3F’0’ Success feedback code
InAMode24@ DC A(InAMode24)
InAMode31@ DC A(InAMode31+X’80000000’)
BADFBC DC Y(BADFBEND-BADFBSTR)
BADFBSTR DC C’Feedback code from CEE3PRM was nonzero.’
BADFBEND EQU *
NOPARM DC Y(NOPRMEND-NOPRMSTR)
NOPRMSTR DC C’No user parm was passed to the application.’
NOPRMEND EQU *
PARMPPA CEEPPA , Constants describing the code block
* ===================================================================
WORKAREA DSECT
ORG *+CEEDSASZ Leave space for the DSA fixed part
CALL3PRM CALL ,(,),VL,MF=L 2-argument parameter list
CALLMOUT CALL ,(,,),VL,MF=L 3-argument parameter list
FBCODE DS 3F Space for a 12-byte feedback code
COUNTER DS F
BUFFSIZE DS H Halfword prefix for following string
CHARPARM DS CL255 80-byte buffer
DS 0D
WORKSIZE EQU *-WORKAREA
PRINT NOGEN
CEEDSA , Mapping of the dynamic save area
CEECAA , Mapping of the common anchor area
MYDATA DSECT ,
MYF DS F
R0 EQU 0
R1 EQU 1
R2 EQU 2
R3 EQU 3
R4 EQU 4
R5 EQU 5
R6 EQU 6
R7 EQU 7
R8 EQU 8
After doing these steps, you must define the CU as an assembler CU and load the
debug data that is associated with that program. To accomplish these objectives,
use the LOADDEBUGDATA command (abbreviated as LDD) as follows:
v If your assembler debug data is in a partitioned data set where the high-level
qualifier is the current user ID, the low-level qualifier is EQALANGX, and the
member name is the same as the name of the CU that you want to debug, enter
the following command:
LDD membername
v If your assembler debug data is in a different partitioned data set than
userid.EQALANGX but the member name is the same as the name of the CU that
you want to debug, enter the following command before or after you enter LDD
membername:
SET DEFAULT LISTINGS
v If your assembler debug data is in a sequential data set or is a member of a
partitioned data set but the member name is different from the CU name, enter
the following command before or after you enter LDD membername:
SET SOURCE
After you have entered an LDD command for a CU, you cannot view the CU as a
disassembly CU.
If Debug Tool cannot find the associated assembler debug data after you have
entered an LDD command, the CU is an assembler CU rather than a disassembly
CU. You cannot enter another LDD command for this CU. However, you can enter a
SET DEFAULT LISTING command or a SET SOURCE command to cause the associated
debug data to be loaded from a different data set.
First, make sure that you have previously issued a SET ASSEMBLER ON or SET
DISASSEMBLY ON command. The CU will not be recognized by the following
command if you have not previously issued one of these commands. Next, issue
the AT APPEARANCE cuname or AT APPEARANCE * command. When the AT APPEARANCE
breakpoint is triggered for the desired CU, you can then issue the LDD command
for that CU.
For example, you have an assembly that generates two CSECTs: MYPROG and
MYPROGA. The debug information for both of these CSECTs is in the data set
yourid.EQALANGX(MYPROG). If you enter the LOADDEBUGDATA (LDD) command for
MYPROG, Debug Tool finds and loads the debug information for both MYPROG
and MYPROGA. However, because you entered the LDD command only for
MYPROG, Debug Tool uses only the debug information for MYPROG. Then, if you
enter the command LDD MYPROGA, Debug Tool looks for debug information in
yourid.EQALANGX(MYPROGA). If it finds an EQALANGX file in that location, it uses
that file. If it doesn’t find an EQALGANX file, it displays a message indicating that
no debug information was found.
To instruct Debug Tool to use the debug information for MYPROGA that is located
in yourid.EQALANGX(MYPROG), enter the SET SOURCE command, either before or after
you enter the LDD MYPROGA command. The SET SOURCE command instructs Debug
Tool to associate the data set name yourid.EQALANGX(MYPROG) with the CU
MYPROGA.
The following set of commands instruct Debug Tool to load debug information for
MYPROG and MYPROGA from the MYPROG member of the EQALANGX data
set:
LDD MYPROG ;
SET SOURCE ON (MYPROGA) myuserid.EQALANGX(MYPROG) ;
LDD MYPROGA ;
The AT CALL command is not supported for assembler routines. Do not use the AT
CALL command to stop Debug Tool when an assembler routine is called.
If you have many breakpoints set in your program, you can issue the command:
QUERY LOCATION
to indicate where in your program execution has been interrupted. The Debug Tool
Log window displays something similar to:
QUERY LOCATION
You are executing commands in the ENTRY XMPLOAD ::> DISPARM breakpoint.
The program is currently entering block XMPLOAD ::> DISPARM.
For example, run the SUBXMP program to the statement labeled CALL1 by
entering AT 70 ; GO ; on the Debug Tool command line. Scroll up until you see
line 67. Move the cursor over COUNTER and press PF4 (LIST). The following
appears in the Log window:
LIST ( COUNTER )
COUNTER = 0
To modify the value of COUNTER to 1, type over the COUNTER = 0 line with
COUNTER = 1, press Enter to put it on the command line, and press Enter again
to issue the command.
To list the contents of the 16 bytes of storage 2 bytes past the address contained in
register R0, type the command LIST STORAGE(R0->+2,16) on the command line and
press Enter. The contents of the specified storage are displayed in the Log window.
LIST STORAGE( R0 -> + 2 , 16 )
000C321E C8859393 96408699 969440A3 888540A2 *Hello from the s*
To modify the first two bytes of this storage to X’C182’, type the command R0->+2
<2> = X’C182’; on the command line and press Enter to issue the command.
Now step into the call to DISPARM by pressing PF2 (STEP) and step until the line
labeled CALL2 is reached. To view the attributes of variable COUNTER, issue the
Debug Tool command:
DESCRIBE ATTRIBUTES COUNTER
In the DISPARM program, to stop Debug Tool when the COUNTER variable is set to
3, enter the following command:
AT 78 DO; IF COUNTER ^= 3 THEN GO; END;
Line 78 is the line labeled BUMPCTR. The command causes Debug Tool to stop at
line 78. If the value of COUNTER is not 1, the program continues. The command
causes Debug Tool to stop on line 78 only if the value of COUNTER is 3.
Suppose you want to set a breakpoint at the entry point to subroutine DISPARM
and that debug data is available for DISPARM but not for SUBXMP. In this
circumstance, Debug Tool would display an empty Source window. To display the
compile units, enter the following commands:
SET ASSEMBLER ON
LIST NAMES CUS
The LIST NAMES CUS command displays a list of all the compile units that are
known to Debug Tool. If DISPARM is fetched later on by the application, this
compile unit might not be known to Debug Tool. If DISPARM is displayed in the
output of the LIST NAMES CUS command, enter the following commands:
SET QUALIFY CU DISPARM
AT ENTRY DISPARM LDD DISPARM
GO
If DISPARM is not displayed in the output of the LIST NAMES CUS command, enter
the following commands:
AT APPEARANCE DISPARM
AT ENTRY DISPARM LDD DISPARM
GO
The purpose of the AT APPEARANCE commands is to give Debug Tool control of the
DISPARM compile unit when it is first loaded. After it is loaded, you can set a
breakpoint at the entry point to DISPARM by entering the following command:
AT ENTRY DISPARM LDD DISPARM
For example, if you run the SUBXMP example with the following commands, the
Log window displays the traceback of callers:
AT ENTRY DISPARM
GO
LIST CALLS
To find the address of the operand being loaded, enter the following command:
LIST R3->+X’24’
Suppose the result is X'00521D42'. To set a breakpoint that watches for a change in
storage values starting at that address and for the next 4 bytes, enter the following
command:
AT CHANGE %STORAGE(X’00521D42’,4)
When the program runs, Debug Tool stops if the value in this storage changes.
The window acted upon as you customize your session is determined by one of
several factors. If you specify a window name (for example, WINDOW OPEN MONITOR
to open the Monitor window), that window is acted upon. If the command is
cursor-oriented, such as the WINDOW SIZE command, the window containing the
cursor is acted upon. If you do not specify a window name and the cursor is not
in any of the windows, the window acted upon is determined by the setting of
Default window under the Profile Settings panel.
Related tasks
Chapter 20, “Using full-screen mode: overview,” on page 93
Chapter 26, “Customizing your full-screen session”
“Defining PF keys”
“Defining a symbol for commands or other strings”
“Customizing the layout of windows on the session panel” on page 172
“Customizing session panel colors” on page 174
“Customizing profile settings” on page 175
“Saving customized settings in a preferences files” on page 177
Defining PF keys
To define your PF keys, use the SET PFKEY command. For example, to define the
PF8 key as SCROLL DOWN PAGE, enter one of the following commands:
v For PL/I:
SET PF8 'Down' = SCROLL DOWN PAGE ;
v For C and C++:
SET PF8 "Down" = SCROLL DOWN PAGE ;
Use single quotation marks for PL/I, double quotation marks for C and C++.
Assembler, COBOL, and disassembly allow the use of single or double quotation
marks. The string set apart by the quotation marks (Down in this example) is the
label that appears next to PF8 when you SET KEYS ON and your PF key definitions
are displayed at the bottom of your screen.
Related references
“Initial PF key settings” on page 103
The PANEL LAYOUT command displays the panel below, showing the six possible
window layouts.
Window Layout Selection Panel
Command ===>
Initially, the session panel uses the default window layout 1.
Follow the instructions on the screen, then press the END PF key to save your
changes and return to the main session panel in the new layout.
Note: You can choose only one of the six layouts. Also, only one of each type of
window can be visible at a time on your session panel. For example, you
cannot have two Log windows on a panel.
Related tasks
“Opening and closing session panel windows” on page 173
“Resizing session panel windows” on page 173
“Zooming a window to occupy the whole screen” on page 173
“Saving customized settings in a preferences files” on page 177
or
v Enter the WINDOW CLOSE LOG, WINDOW CLOSE MONITOR, or WINDOW CLOSE SOURCE
command.
When you close a window, the remaining windows occupy the full area of the
screen.
To open a window, enter the WINDOW OPEN LOG, WINDOW OPEN MONITOR, or WINDOW
OPEN SOURCE command.
If you want to monitor the values of selected variables as they change during your
Debug Tool session, the Monitor window must be open. If it is closed, open it as
described above. The Monitor window occupies the available space according to
your selected window layout.
If at any time during your session you open a window and the contents assigned
to it are not available, the window is empty.
Rather than using the cursor, you can also explicitly specify the number of rows or
columns you want the window to contain (as appropriate for the window layout).
For example, to change the Source window from 10 rows deep to 12 rows deep,
enter:
WINDOW SIZE 12 SOURCE
To restore window sizes to their default values for the current window layout,
enter the PANEL LAYOUT RESET command.
PF11 (ZOOM LOG) toggles the Log window in the same way, without the cursor
needing to be in the Log window.
To change the color, intensity, or highlighting of various fields of the session panel
on a color terminal, use the PANEL COLORS command. When you issue this
command, the panel shown below appears.
Color Selection Panel
Command ===>
Color Highlight Intensity
Title : field headers TURQ NONE HIGH
output fields GREEN NONE LOW Valid Color:
Monitor: contents TURQ REVERSE LOW White Yellow Blue
line numbers TURQ REVERSE LOW Turq Green Pink Red
Source : listing area WHITE REVERSE LOW
prefix area TURQ REVERSE LOW Valid Intensity:
suffix area YELLOW REVERSE LOW High Low
current line RED REVERSE HIGH
breakpoints GREEN NONE LOW Valid Highlight:
Log : program output TURQ NONE HIGH None Reverse
test input YELLOW NONE LOW Underline Blink
test output GREEN NONE HIGH
line numbers BLUE REVERSE HIGH Color and Highlight
Command line WHITE NONE HIGH are valid only with
Window headers GREEN REVERSE HIGH color terminals.
Tofeof delimiter BLUE REVERSE HIGH
Search target RED NONE HIGH
Enter END/QUIT to return with current settings saved.
CANCEL to return without current settings saved.
Initially, the session panel areas and fields have the default color and attribute
values shown above.
The usable color attributes are determined by the type of terminal you are using. If
you have a monochrome terminal, you can still use highlighting and intensity
attributes to distinguish fields.
To change the color and attribute settings for your Debug Tool session, enter the
desired colors or attributes over the existing values of the fields you want to
change. The changes you make are saved when you enter QUIT.
You can also change the colors or intensity of selected areas by issuing the
equivalent SET COLOR command from the command line. Either specify the fields
explicitly, or use the cursor to indicate what you want to change. Changing a color
or highlight with the equivalent SET command changes the value on the Color
Selection Panel.
To preserve any changes you make to the default color fields, specify a file before
you begin your session using the ddname inspsafe and the dsname or fileid of
your choice. Debug Tool recognizes any file with this ddname as the file where it
saves session panel settings for use during subsequent sessions. If you do not
allocate this file before your session, Debug Tool begins the next debug session
with the default values shown in the panel above.
Current Setting
---------------
Change Test Granularity STATEMENT (All,Blk,Line,Path,Stmt)
DBCS characters NO (Yes or No)
Default Listing PDS name
Default scroll amount PAGE (Page,Half,Max,Csr,Data,int)
Default window SOURCE (Log,Monitor,Source)
Execute commands YES (Yes or No)
History YES (Yes or No)
History size 100 (nonnegative integer)
Logging YES (Yes or No)
Pace of visual trace 2 (steps per second)
Refresh screen NO (Yes or No)
Rewrite interval 50 (number of output lines)
Session log size 1000 (number of retained lines)
Show log line numbers YES (Yes or No)
Show message ID numbers NO (Yes or No)
Show monitor line numbers YES (Yes or No)
Show scroll field YES (Yes or No)
Show source/listing suffix YES (Yes or No)
Show warning messages YES (Yes or No)
Test level ALL (All,Error,None)
Enter END/QUIT to return with current settings saved.
CANCEL to return without current settings saved.
You can change the settings either by typing your desired values over them, or by
issuing the appropriate SET command at the command line or from within a
command file.
The profile parameters, their descriptions, and the equivalent SET commands are as
follows:
Change Test Granularity
Specifies the granularity of testing for AT CHANGE. Equivalent to SET CHANGE.
DBCS characters
Controls whether the shift-in or shift-out characters are recognized. Equivalent
to SET DBCS.
Default Listing PDS name
If specified, the data set where Debug Tool looks for the source or listing.
Equivalent to SET DEFAULT LISTINGS.
Default scroll amount
Specifies the default amount assumed for SCROLL commands where no amount
is specified. Equivalent to SET DEFAULT SCROLL.
Default window
Selects the default window acted upon when WINDOW commands are issued
with the cursor on the command line. Equivalent to SET DEFAULT WINDOW.
A field indicating scrolling values is shown only if the screen is not large enough
to show all the profile parameters at once. This field is not shown in the example
panel above.
You can change the settings of these profile parameters at any time during your
session. For example, you can increase the delay that occurs between the execution
To modify the profile settings for your session, enter a new value over the old
value in the field you want to change. Equivalent SET commands are issued when
you QUIT from the panel.
Entering the equivalent SET command changes the value on the Profile Settings
panel as well.
To preserve any changes you make to the default profile settings, specify a file
before you begin your session using the ddname inspsafe and the dsname or
fileid of your choice. Debug Tool recognizes any file with this ddname as the file
where it saves session panel settings for use during subsequent sessions. All PANEL
settings are saved, except the setting for the Listing panel and the following
settings:
COUNTRY
FREQUENCY
INTERCEPT
LOG
NATIONAL LANGUAGE
PROGRAMMING LANGUAGE
QUALIFY
SOURCE
TEST
If you do not allocate this file before your session, Debug Tool begins the next
debug session with the values shown in the example panel above.
Related tasks
“Saving customized settings in a preferences files”
For input typed directly at the terminal, input is free-form, optionally starting in
column 1.
For input that comes from a commands file or USE file, all of the Debug Tool
commands must be terminated with a semicolon, except for the C block command.
Related tasks
“Entering commands on the session panel” on page 100
“Abbreviating Debug Tool keywords” on page 182
“Entering multiline commands in full-screen and line mode” on page 183
“Entering multiline commands in a command file” on page 183
“Entering multiline commands without continuation” on page 184
“Using blanks in Debug Tool commands” on page 184
“Entering comments in Debug Tool commands” on page 184
“Using constants in Debug Tool commands” on page 185
“Getting online help for Debug Tool command syntax” on page 185
Related references
Debug Tool for z/OS Reference and Messages
DBCS
When the DBCS setting is ON, you can specify DBCS characters in the following
portions of all the Debug Tool commands:
v Commentary text
v Character data valid in the current programming language
v Symbolic identifiers such as variable names (for COBOL, this includes session
variables), entry names, block names, and so forth (if the names contain DBCS
characters in the application program).
When the DBCS setting is OFF, double-byte data is not correctly interpreted or
displayed. However, if you use the shift-in and shift-out codes as data instead of
DBCS indicators, you should issue SET DBCS OFF.
If you are debugging in full-screen mode and your terminal is not DBCS capable,
the SET DBCS ON command is not available.
The system keywords, and COMMENT, INPUT, and USE keywords, take precedence
over other keywords and identifiers. If one of these keywords is followed by a
blank, it is always parsed as the corresponding command. Hence, if you want to
assign the value 2 to a variable named TSO and the current programming
language setting is C, the "=" must be abutted to the reference, as in "TSO<no
space>= 2;" not "TSO<space>= 2;". If you want to define a procedure named USE,
you must enter "USE<no space>: procedure;" not "USE<space>:: procedure;".
When you truncate, you need only enter enough characters of the command to
distinguish the command from all other valid Debug Tool commands. You should
not use truncations in a commands file or compile them into programs because
they might become ambiguous in a subsequent release. The following shows
examples of Debug Tool command truncations:
When you are entering a command in interactive mode, the continuation character
must be the last nonblank character in each line that is to be continued. In the
following example:
LIST (" this is a very very very vvvvvvvvvvvvvvvvvvvvvvvvvvvvv –
very long string");
the continuation character is the single-byte character set (SBCS) hyphen (-).
Continuation is not allowed within a DBCS name or literal string when the
current programming language setting is COBOL.
For C++ only: Comments in the form "//" are not processed by Debug Tool in
C++.
v For all supported programming languages, comments can be entered by:
– Enclosing the text in comment brackets "/*" and "*/". Comments can occur
anywhere a blank can occur between keywords, identifiers, and numeric
constants. Comments entered in this manner do not appear in the session log.
– Using the COMMENT command to insert commentary text in the session log.
Comments entered in this manner cannot contain embedded semicolons.
v When the current programming language setting is COBOL, comments can also
be entered by using an asterisk (*) in column 7. This is valid for file input only.
Comments are most helpful in file input. For example, you can insert comments in
a USE file to explain and describe the actions of the commands.
Debug Tool allows the use of hexadecimal addresses in COBOL and PL/I.
The COBOL H constant is a fullword address value that can be specified in hex
using numeric-hex-literal format (hexadecimal characters only, delimited by either
double (") or single (') quotes and preceded by H). The value is right-justified and
padded on the left with zeros.
Note: The H constant can only be used where an address or POINTER variable can
be used. You can use this type of constant with the SET command. For
example, to assign a hexadecimal value of 124BF to the variable ptr, specify:
SET ptr TO H"124BF";
The PL/I PX constant is a hexadecimal value, delimited by single quotes (') and
followed by PX. The value is right-justified and can be used in any context in
which a pointer value is allowed. For example, to display the contents at a given
address in hexadecimal format, specify:
LIST STORAGE ('20CD0'PX);
Related tasks
“Using constants in COBOL expressions” on page 194
Related references
“C and C++ expressions” on page 211
The Debug Tool SYSTEM and TSO commands followed by ? do not invoke the syntax
help; instead the ? is sent to the host as part of the system command. The COMMENT
command followed by ? also does not invoke the syntax help.
Debug Tool can use a separate debug file that is in a PDS, sequential file, or an
HFS file. The format for a PDS file or a sequential file must be fixed or fixed block
with a record length between 80 and 1024. You can create a separate debug file
when you specify the SEPARATE suboption of the TEST compiler option. This
suboption is available only on the following COBOL compilers:
v Enterprise COBOL for z/OS and OS/390, Version 3
v COBOL for OS/390 & VM, Version 2 Release 2
v COBOL for OS/390 & VM, Version 2 Release 1 with APAR PQ40298
The table below shows the interpretive subset of COBOL statements recognized by
Debug Tool.
Command Description
CALL Subroutine call
COMPUTE Computational assignment (including expressions)
Declarations Declaration of session variables
This subset of commands is valid only when the current programming language is
COBOL.
Related references
Debug Tool for z/OS Reference and Messages
However, when you use a file as the source of command input, the format for your
commands is similar to the source format for the COBOL compiler. The first six
positions are ignored, and an SBCS hyphen in column 7 indicates continuation
from the previous line. You must start the command text in column 8 or later, and
end it in column 72.
The continuation line (with a hyphen in column 7) optionally has one or more
blanks following the hyphen, followed by the continuing characters. In the case of
the continuation of a literal string, an additional quote is required. When the token
being continued is not a literal string, blanks following the last nonblank character
on the previous line are ignored, as are blanks following the hyphen.
When Debug Tool copies commands to the log file, they are formatted according to
the rules above so that you can use the log file during subsequent Debug Tool
sessions.
Continuation is not allowed within a DBCS name or literal string. This restriction
applies to both interactive and command file input.
Related references
“COBOL compiler options in effect for Debug Tool commands”
“COBOL reserved keywords” on page 189
Enterprise COBOL for z/OS and OS/390 Language Reference
Related references
Enterprise COBOL for z/OS and OS/390 Language Reference
Related references
Enterprise COBOL for z/OS and OS/390 Language Reference
In addition to being allowed to assign values to variables and display the values of
variables during your session, you can declare session variables to suit your testing
needs.
Related tasks
“Accessing COBOL variables”
“Assigning values to COBOL variables”
“Displaying values of COBOL variables” on page 191
“Declaring session variables in COBOL” on page 193
Related tasks
Chapter 5, “Preparing a COBOL program,” on page 25
You can also use table elements in such assignments as shown in the following
example:
COMPUTE itm−2(1,2)=(a + 1)/e(2);
The value assigned to a variable is always assigned to the storage for that variable.
In an optimized program, a variable can be temporarily assigned to a register, and
a new value assigned to that variable does not necessarily alter the value used by
the program.
Assign to the program variable c , found in structure d , the value of the program
variable a , found in structure b:
MOVE a OF b TO c OF d;
You can also use reference modification to assign values to variables as shown in
the following two examples:
MOVE aa(2:3)TO bb;
MOVE aa TO bb(1:4);
Debug Tool sets a breakpoint at statement 52 (AT), begins execution of the program
(GO), stops at statement 52, and displays the variable names (TITLED) and their
values.
Put commas between the variables when listing more than one. If you do not want
to display the variable names when issuing the LIST command, issue LIST
UNTITLED instead of LIST TITLED.
The value displayed for a variable is always the value that was saved in storage
for that variable. In an optimized program, a variable can be temporarily assigned
to a register, and the value shown for that variable might differ from the value
being used by the program.
If you use the LIST command to display a National variable, Debug Tool converts
the Unicode data to EBCDIC before displaying it. If the conversion results in
characters that cannot be displayed, enter the LIST %HEX() command to display the
unconverted Unicode data in hexadecimal format.
If you are debugging in full-screen mode and your terminal is not DBCS capable,
the SET DBCS ON is not available.
The DBCS syntax and continuation rules you must follow to use DBCS variables in
Debug Tool commands are the same as those for the COBOL language.
For COBOL you must type a DBCS literal, such as G, in front of a DBCS value in a
Monitor or Data pop-up window if you want to update the value.
Related references
Enterprise COBOL for z/OS and OS/390 Language Reference
Note: Values in the range 3–16 can be assigned to %PATHCODE only if your program
was compiled with an option supporting path hooks.
The following declarations are for a string variable, a decimal variable, a pointer
variable, and a floating-point variable. To declare a string named description,
enter:
77 description PIC X(25)
Related tasks
“Using session variables across different languages” on page 272
Related references
Enterprise COBOL for z/OS and OS/390 Language Reference
Only simple relation conditions are supported. Sign conditions, class conditions,
condition-name conditions, switch-status conditions, complex conditions, and
abbreviated conditions are not supported. When either of the comparands in a
relation condition is stated in the form of an arithmetic expression (using operators
such as plus and minus), the restriction concerning floating-point operands applies
to both comparands. See Debug Tool for z/OS Reference and Messages for a table that
Related tasks
“Displaying the results of COBOL expression evaluation”
“Using constants in COBOL expressions”
Enterprise COBOL for z/OS and OS/390 Programming Guide
Related references
Debug Tool for z/OS Reference and Messages
You can also use structure elements in expressions. If e is an array, the following
two examples are valid:
LIST a + e(1) / c * two;
LIST xx / e(two + 3);
Conditions for expression evaluation are the same ones that exist for program
statements.
Related references
“COBOL compiler options in effect for Debug Tool commands” on page 188
Enterprise COBOL for z/OS and OS/390 Language Reference
Additionally, Debug Tool allows the use of a hexadecimal constant that represents
an address. This H-constant is a fullword value that can be specified in hex using
numeric-hex-literal format (hexadecimal characters only, delimited by either
quotation marks (") or apostrophes (') and preceded by H). The value is
right-justified and padded on the left with zeros. The following example:
LIST STORAGE (H'20cd0');
You can use qualification to specify to what compile unit or block a particular
variable belongs. When Debug Tool is invoked, there is a default qualification
established for the currently executing block; it is implicitly qualified. Thus, you
must explicitly qualify your references to all statement numbers and variable
names in any other block. It is necessary to do this when you are testing a compile
unit that calls one or more blocks or compile units. You might need to specify
what block contains a particular statement number or variable name when issuing
commands.
If required, load_name is the name of the load module. It is required only when the
program consists of multiple load modules and you want to change the
qualification to other than the current load module. load_name can also be the
Debug Tool variable %LOAD.
If required, cu_name is the name of the compile unit. The cu_name must be the fully
qualified compile unit name. It is required only when you want to change the
qualification to other than the currently qualified compile unit. It can be the Debug
Tool variable %CU.
If required, block_name is the name of the block. The block_name is required only
when you want to change the qualification to other than the currently qualified
block. It can be the Debug Tool variable %BLOCK. Remember to enclose the block
name in double (") or single (') quotes if case sensitive. If the name is not inside
quotes, Debug Tool converts the name to upper case.
You can distinguish between the main and subprog blocks using qualification. If
you enter the following MOVE commands when main is the currently executing
block:
MOVE 8 TO var4;
MOVE 9 TO subprog:>var4;
MOVE 'A' TO var3 OF var2 OF var1;
MOVE 'B' TO subprog:>var3 OF var2 OF var1;
and the following LIST commands when subprog is the currently executing block:
LIST TITLED var4;
LIST TITLED main:>var4;
LIST TITLED var3 OF var2 OF var1;
LIST TITLED main:>var3 OF var2 OF var1;
each LIST command results in the following output (without the commentary) in
your Log window:
You can then issue commands using the variables declared in subprog without
using qualifiers. Debug Tool does not see the variables declared in procedure main.
For example, the following assignment commands are valid with the subprog point
of view:
MOVE 10 TO var5;
However, if you want to display the value of a variable in main while the point of
view is still in subprog, you must use a qualifier, as shown in the following
example:
LIST (main:>var-name);
The above method of changing the point of view is necessary for command files.
When you are at a breakpoint in a method, the currently qualified block is the
method. If you enter the LIST TITLED command with no parameters, Debug Tool
lists all of the data items associated with the method. To list all of the data items in
a FACTORY or OBJECT, do the following steps:
1. Enter the QUALIFY command to set the point of view to the FACTORY or
OBJECT.
2. Enter the LIST TITLED command.
For example, to list all of the object instance data items for a class called
ACCOUNT, enter the following command:
QUALIFY BLOCK ACCOUNT:>OBJECT; LIST TITLED;
Debug Tool does not get control of the program at breakpoints that you set by the
following commands:
v AT PATH
v AT CALL
v AT ENTRY
v AT EXIT
However, if you set the breakpoint with an AT CALL command that calls a non-VS
COBOL II program, Debug Tool does get control of the program. Use the AT ENTRY
*, AT EXIT *, AT GLOBAL ENTRY, and AT GLOBAL EXIT commands to set breakpoints
that Debug Tool can use to get control of the program.
Breakpoints that you set at entry points and exit statements have no statement
associated with them. Therefore, they are triggered only at the compile unit level.
When they are triggered, the current view of the listing moves to the top and no
statement is highlighted. Breakpoints that you set at entry points and exit
statements are ignored by the STEP command.
If you are debugging your VS COBOL II program in remote debug mode, use the
same TEST run-time options as for any COBOL program.
Related concepts
“Debug Tool evaluation of PL/I expressions” on page 204
Related tasks
Chapter 22, “Debugging a PL/I program in full-screen mode,” on page 133
Chapter 29, “Debugging PL/I programs”
“Accessing PL/I program variables” on page 202
Related references
“Debug Tool subset of PL/I commands”
“Supported PL/I built-in functions” on page 204
Command Description
Assignment Scalar and vector assignment
BEGIN Composite command grouping
CALL Debug Tool procedure call
DECLARE or DCL Declaration of session variables
DO Iterative looping and composite command grouping
IF Conditional execution
ON Define an exception handler
SELECT Conditional execution
The following types of Debug Tool commands will support the syntax of the PL/I
statements:
Expression
This command evaluates an expression.
Block BEGIN/END, DO/END, PROCEDURE/END
These commands provide a means of grouping any number of Debug Tool
commands into ″one″ command.
The table below shows the commands that are new or changed for this release of
Debug Tool when the current programming language is PL/I.
Note: The Debug Tool condition ALLOCATE raises the ON ALLOCATE condition when a
PL/I program encounters an ALLOCATE statement for a controlled variable.
These PL/I language-oriented commands are only a subset of all the commands
that are supported by Debug Tool.
This will result in different behavior depending upon the language. For example,
the following will find a<kk>b in C and <.Akk.b> in PL/I.
LIST NAMES a<kk>*
Freeform will be added to the parser and will be in effect while the current
programming language is PL/I.
Related tasks
“Using session variables across different languages” on page 272
Debug Tool uses the symbol table to obtain information about program variables,
controlled variables, automatic variables, and program control constants such as
file and entry constants and also CONDITION condition names. Based variables,
controlled variables, automatic variables and parameters can be used with Debug
Tool only after storage has been allocated for them in the program. An exception to
this is DESCRIBE ATTRIBUTES, which can be used to display attributes of a variable.
You would not be able to reference the variable directly by name. You can only
reference it by specifying either:
P2->DX
or
P1->P2->DX
The following types of program variables cannot be used with Debug Tool:
v iSUB defined variables
v Variables defined:
– On a controlled variable
– On an array with one or more adjustable bounds
– With a POSITION attributed that specifies something other than a constant
v Variables that are members of a based structure declared with the REFER options.
Related tasks
Chapter 6, “Preparing a PL/I program,” on page 29
Given the way PAYROLL is declared, the following examples of commands are
valid in Debug Tool:
LIST ( PAYROLL(1).NAME.LAST, PAYROLL(1).HOURS.REGULAR );
Given the way PAYROLL is declared, the following examples of commands are
invalid in Debug Tool:
LIST ( PAYROLL(1) );
The Debug Tool expression is similar to the PL/I expression. If the source of the
command is a variable-length record source (such as your terminal) and if the
expression extends across more than one line, a continuation character (an SBCS
hyphen) must be specified at the end of all but the last line.
All PL/I constant types are supported, plus the Debug Tool PX constant.
Related references
“Unsupported PL/I language elements” on page 205
Notes:
1. Abbreviation for BINARYVALUE
2. Abbreviation for CURRENTSTORAGE
3. Abbreviation for POINTERADD
4. Abbreviation for POINTERVALUE
Related tasks
“Using SET WARNING PL/I command with built-in functions”
These checks are restrictions that can be removed by issuing SET WARNING OFF.
Related concepts
“C and C++ expressions” on page 211
“Debug Tool evaluation of C and C++ expressions” on page 215
“Scope of objects in C and C++” on page 218
“Blocks and block identifiers for C” on page 220
“Blocks and block identifiers for C++” on page 220
“Monitoring storage in C++” on page 228
Related tasks
Chapter 23, “Debugging a C program in full-screen mode,” on page 141
Chapter 24, “Debugging a C++ program in full-screen mode,” on page 151
“Using C and C++ variables with Debug Tool” on page 208
“Declaring session variables with C and C++” on page 210
“Calling C and C++ functions from Debug Tool” on page 212
“Intercepting files when debugging C and C++ programs” on page 216
“Displaying environmental information” on page 222
“Stepping through C++ programs” on page 225
“Setting breakpoints in C++” on page 225
“Examining C++ objects” on page 227
“Qualifying variables in C and C++” on page 223
Related references
“Debug Tool commands that resemble C and C++ commands”
“%PATHCODE values for C and C++” on page 209
“C reserved keywords” on page 213
“C operators and operands” on page 213
“Language Environment conditions and their C and C++ equivalents” on page 214
The table below shows the interpretive subset of C and C++ commands recognized
by Debug Tool.
Command Description
block ({}) Composite command grouping
break Termination of loops or switch commands
declarations Declaration of session variables
do/while Iterative looping
expression Any C expression except the conditional (?) operator
This subset of commands is valid only when the current programming language is
C or C++.
In addition to the subset of C and C++ commands that you can use is a list of
reserved keywords used and recognized by C and C++ that you cannot abbreviate,
use as variable names, or use as any other type of identifier.
Related references
“C reserved keywords” on page 213
C/C++ Language Reference
Related tasks
“Accessing C and C++ program variables”
“Displaying values of C and C++ variables or expressions”
“Assigning values to C and C++ variables” on page 209
Related tasks
Chapter 7, “Preparing a C program,” on page 31
Chapter 8, “Preparing a C++ program,” on page 35
Suppose you want to display the program variables X, row[X], and col[X], and
their values at line 25. If you issue the following command:
AT 25 LIST ( X, row[X], col[X] ); GO;
Debug Tool sets a breakpoint at line 25 (AT), begins execution of the program (GO),
stops at line 25, and displays the variable names and their values.
Debug Tool sets a breakpoint at line 25 (AT), begins execution of the program (GO),
stops at line 25, and displays the result of the expression.
Put commas between the variables when listing more than one. If you do not want
to display the variable names when issuing the LIST command, enter LIST
UNTITLED.
You can also list variables with the printf function call as follows:
printf ("X=%d, row=%d, col=%d\n", X, row[X], col[X]);
The output from printf, however, does not appear in the Log window and is not
recorded in the log file unless you SET INTERCEPT ON FILE stdout.
Note: Only the assignment operators that work for C will work for C++, that is,
there is no support for overloaded operators.
The following example demonstrates how to assign the value of number to the
member employee of the structure payroll:
payroll.employee = number;
Debug Tool supports all C operators except the tenary operator, as well as any
other full C language assignments and function calls to user or C library functions.
Related tasks
“Calling C and C++ functions from Debug Tool” on page 212
Values in the range 3–17 can only be assigned to %PATHCODE if your program was
compiled with an option supporting path hooks.
You can only declare scalars, arrays of scalars, structures, and unions in Debug
Tool (pointers for the above are allowed as well).
If you declare a session variable with the same name as a programming variable,
the session variable hides the programming variable. To reference the
programming variable, you must qualify it. For example:
main:>x for the program variable x
x for the session variable x
Session variables remain in effect for the entire debug session, unless they are
cleared using the CLEAR command.
Related tasks
“Using session variables across different languages” on page 272
“Qualifying variables and changing the point of view in C and C++” on page 222
C and C++ language expressions are arranged in the following groups based on
the operators they contain and how you use them:
Primary expression
Unary expression
Binary expression
Conditional expression
Assignment expression
Comma expression
lvalue
Constant
The semantics for C and C++ operators are the same as in a compiled C or C++
program. Operands can be a mixture of constants (integer, floating-point,
character, string, and enumeration), C and C++ variables, Debug Tool variables,
or session variables declared during a Debug Tool session. Language constants are
specified as described in the C and C++ Language Reference publications.
The Debug Tool command DESCRIBE ATTRIBUTES can be used to display the
resultant type of an expression, without actually evaluating the expression.
The C and C++ language does not specify the order of evaluation for function call
arguments. Consequently, it is possible for an expression to have a different
execution sequence in compiled code than within Debug Tool. For example, if you
enter the following in an interactive session:
int x;
int y;
x = y = 1;
the results can differ from results produced by the same statements located in a C
or C++ program segment. Any expression containing behavior undefined by ANSI
standards can produce different results when evaluated by Debug Tool than when
evaluated by the compiler.
The following examples show you various ways Debug Tool supports the use of
expressions in your programs:
v Debug Tool assigns 12 to a (the result of the printf()) function call, as in:
a = (1,2/3,a++,b++,printf("hello world\n"));
v Debug Tool supports structure and array referencing and pointer dereferencing,
as in:
league[num].team[1].player[1]++;
league[num].team[1].total += 1;
++(*pleague);
Related references
“Debug Tool evaluation of C and C++ expressions” on page 215
C/C++ Language Reference
You can make calls to C library functions at any time. In addition, you can use the
C library variables stdin, stdout, stderr, __amrc, and errno in expressions
including function calls.
The library function ctdli cannot be called unless it is referenced in a compile unit
in the program, either main or a function linked to main.
Calls to user functions can be made, provided Debug Tool is able to locate an
appropriate definition for the function within the symbol information in the user
program. These definitions are created when the program is compiled with
TEST(SYM) for C or TEST for C++.
You can turn off this checking by specifying SET WARNING OFF.
Calls can be made to any user functions that have linkage supported by the C or
C++ compiler. However, for C++ calls made to any user function, the function
must be declared as:
extern "C"
For example, use this declaration if you want to debug an application signal
handler. When a condition occurs, control passes to Debug Tool which then passes
control to the signal handler.
Related tasks
Chapter 7, “Preparing a C program,” on page 31
Chapter 8, “Preparing a C++ program,” on page 35
Related references
C/C++ Language Reference
C reserved keywords
The table below lists all keywords reserved by the C language. When the current
programming language is C or C++, these keywords cannot be abbreviated, used
as variable names, or used as any other type of identifiers.
Debug Tool evaluates C and C++ expressions following the rules presented in
C/C++ Language Reference. The result of an expression is equal to the result that
would have been produced if the same expression had been part of your compiled
program.
Implicit string concatenation is supported. For example, "abc" "def" is accepted for
"abcdef" and treated identically. Concatenation of wide string literals to string
literals is not accepted. For example, L"abc"L"def" is valid and equivalent to
L"abcdef", but "abc" L"def" is not valid.
Expressions you use during your session are evaluated with the same sensitivity to
enablement as are compiled expressions. Conditions that are enabled are the same
ones that exist for program statements.
During a Debug Tool session, if the current setting for WARNING is ON, the occurrence
in your C or C++ program of any one of the conditions listed below causes the
display of a diagnostic message.
v Division by zero
v Remainder (%) operator for a zero value in the second operand
v Array subscript out of bounds for a defined array
v Bit shifting by a number that is either negative or greater than 32
v Incorrect number of parameters, or parameter type mismatches for a function
call
v Differing linkage calling conventions for a function call
v Assignment of an integer value to a variable of enumeration data type where the
integer value does not correspond to an integer value of one of the enumeration
constants of the enumeration data type
v Assignment to an lvalue that has the const attribute
v Attempt to take the address of an object with register storage class
v A signed integer constant not in the range −2**31 to 2**31
v A real constant not having an exponent of 3 or fewer digits
v A float constant not larger than 5.39796053469340278908664699142502496E-79 or
smaller than 7.2370055773322622139731865630429929E+75
v A hex escape sequence that does not contain at least one hexadecimal digit
v An octal escape sequence with an integer value of 256 or greater
v An unsigned integer constant greater than the maximum value of 4294967295.
Related references
“C and C++ expressions” on page 211
C/C++ Language Reference
Note: Although you can intercept IOStreams indirectly via C/370 I/O, the
behaviors might be different or undefined in C++.
You can use the following names with the SET INTERCEPT command during a
debug session:
v stdout, stderr, and stdin (lowercase only)
v any valid fopen() file specifier.
The behavior of I/O interception across system() call boundaries is global. This
implies that the setting of INTERCEPT ON for xx in Program A is also in effect for
Program B (when Program A system() calls to Program B). Correspondingly,
setting INTERCEPT OFF for xx in Program B turns off interception in Program A
when Program B returns to A. This is also true if a file is intercepted in Program B
and returns to Program A. This model applies to disk files, memory files, and
standard streams.
Command line redirection of the standard streams is supported under Debug Tool,
as shown below.
1>&2 If stderr is the target of the interception command, stdout is also
intercepted. If stdout is the target of the INTERCEPT command, stderr is
not intercepted. When INTERCEPT is set OFF for stdout, the stream is
redirected to stderr.
2>&1 If stdout is the target of the INTERCEPT command, stderr is also
intercepted. If stderr is the target of the INTERCEPT command, stdout is
not intercepted. When INTERCEPT is set OFF for stderr, the stream is
redirected to stdout again.
1>file.name
stdout is redirected to file.name. For interception of stdout to occur,
stdout or file.name can be specified on the interception request. This also
applies to 1>>file.name
2>file.name
stderr is redirected to file.name. For interception of stderr to occur,
stderr or file.name can be specified on the interception request. This also
applies to 2>>file.name
2>&1 1>file.name
stderr is redirected to stdout, and both are redirected to file.name. If
file.name is specified on the interception command, both stderr and
stdout are intercepted. If you specify stderr or stdout on the INTERCEPT
command, the behavior follows rule 1b above.
The same standard stream cannot be redirected twice on the command line.
Interception is undefined if this is violated, as shown below.
2>&1 2>file.name
Behavior of stderr is undefined.
1>&2 1>file.name
Behavior of stdout is undefined.
Related references
z/OS C/C++ Programming Guide
Note: The use of an object here is not to be confused with a C++ object. Any
reference to C++ will be qualified as such.
For C++, in addition to the scopes defined for C, it also has the class scope.
An object has block scope if its declaration is located inside a block. An object with
block scope is visible from the point where it is declared to the closing brace (})
that terminates the block.
An object has file scope if its definition appears outside of any block. Such an
object is visible from the point where it is declared to the end of the source file. In
Debug Tool, if you are qualified to the compilation unit with the file static
variables, file static and global variables are always visible.
An object has function prototype scope if its declaration appears within the list of
parameters in a function prototype.
A class member has class scope if its declaration is located inside a class.
You cannot reference objects that are visible at function prototype scope, but you
can reference ones that are visible at file or block scope if:
v For C variables and functions, the source file was compiled with TEST(SYM) and
the object was referenced somewhere within the source.
Debug Tool follows the same scoping rules as ANSI, except that it handles objects
at file scope differently. An object at file scope can be referenced from within
Debug Tool at any point in the source file, not just from the point in the source file
where it is declared. Debug Tool session variables always have a higher scope than
program variables, and consequently have higher precedence than a program
variable with the same name. The program variable can always be accessed
through qualification.
Related concepts
“Storage classes in C and C++”
Session variables declared during the Debug Tool session are also available for
reference and change.
An object with auto storage class is available for reference or change in Debug
Tool, provided the block where it is defined is active. Once a block finishes
executing, the auto variables within this block are no longer available for change,
but can still be examined using DESCRIBE ATTRIBUTES.
An object with register storage class might be available for reference or change in
Debug Tool, provided the variable has not been optimized to a register.
An object with static storage class is always available for change or reference in
Debug Tool. If it is not located in the currently qualified compile unit, you must
specifically qualify it.
An object with extern storage class is always available for change or reference in
Debug Tool. It might also be possible to reference such a variable in a program
even if it is not defined or referenced from within this source file. This is possible
provided Debug Tool can locate another compile unit (compiled with TEST(SYM))
with the appropriate definition.
When these block names are used in the Debug Tool commands, you might need
to distinguish between nested blocks in different functions within the same source
file. This can be done by naming the blocks in one of two ways:
Short form
function_name:>%BLOCKzzz
Long form
function_name:>%BLOCKxxx :>%BLOCKyyy: ... :>%BLOCKzzz
The currently active block name can be retrieved from the Debug Tool variable
%BLOCK. You can display the names of blocks by entering:
DESCRIBE CU;
You must always refer to a C++ block identifier in its entirety, even if the function
is not overloaded. That is, you cannot refer to shapes(int,int) as shapes only.
Note: The block name for main() is always main (without the qualifying
parameters after it) even when compiled with C++ because main() has
extern C linkage.
Since block names can be quite long, it is not unusual to see the name truncated in
the LOCATION field on the first line of the screen. If you want to find out where you
are, enter:
QUERY LOCATION
and the name will be shown in its entirety (wrapped) in the session log.
Block identifiers are restricted to a length of 255 characters. Any name longer than
255 characters is truncated.
main()
{
>>> Debug Tool is given <<<
>>> control here. <<<
init();
sort();
}
init()
{
table
. = malloc(sizeof(long)*length);
.
.
}
sort ()
{ /* Block sort */
int i;
for (i = 0; i < length–1; i++) { /* Block %BLOCK2 */
int j;
for (j = i+1; j < length; j++) { /* Block %BLOCK3 */
static int temp;
temp = table[i];
table[i] = table[j];
table[j] = temp;
}
}
}
The block scope variables i, j, and temp are not visible in this scope and cannot be
directly referenced from within Debug Tool at this time. You can list the line
numbers in the current scope by entering:
LIST LINE NUMBERS;
Now let’s assume the program is compiled with TEST(SYM, NOBLOCK). Since the
program is explicitly compiled using NOBLOCK, Debug Tool will never know about
the variables j and temp because they are defined in a block that is nested in
another block. Debug Tool does know about the variable i since it is not in a scope
that is nested.
The following example sets a breakpoint on entry to the second block of sort:
at entry sort:>%BLOCK2;
The following example sets a breakpoint on exit of the first block of main and lists
the entries of the sorted table.
at exit main {
for (i = 0; i < length; i++)
printf("table entry %d is %d\n", i, table[i]);
}
The following example lists the variable temp in the third block of sort. This is
possible since temp has the static storage class.
LIST sort:>%BLOCK3:temp;
Issuing DESCRIBE ENVIRONMENT displays a list of open files and conditions being
monitored by the run-time environment. For example, if you enter DESCRIBE
ENVIRONMENT while debugging a C or C++ program, you might get the following
output:
Currently open files
stdout
sysprint
The following conditions are enabled:
SIGFPE
SIGILL
SIGSEGV
SIGTERM
SIGINT
SIGABRT
SIGUSR1
SIGUSR2
SIGABND
When program execution is suspended and Debug Tool receives control, the
default, or implicit qualification is the active block at the point of program
suspension. All objects visible to the C or C++ program in this block are also
visible to Debug Tool. Such objects can be specified in commands without the use
of qualifiers. All others must be specified using explicit qualification.
Qualifiers depend, of course, upon the naming convention of the system where
you are working.
Related tasks
“Qualifying variables in C and C++”
“Changing the point of view in C and C++”
These are known as qualifiers and some, or all, might be required when
referencing an object in a command. Qualifiers are separated by a combination of
greater than signs (>) and colons and precede the object they qualify. For example,
the following is a fully qualified object:
load_name::>cu_name:>block_name:>object
If required, load_name is the name of the load module. It is required only when the
program consists of multiple load modules and when you want to change the
qualification to other than the current load module. load_name is enclosed in
double quotation marks. If it is not, it must be a valid identifier in the C or C++
programming language. load_name can also be the Debug Tool variable %LOAD.
If required, CU_NAME is the name of the compilation unit or source file. The
cu_name must be the fully qualified source file name or an absolute pathname. It is
required only when you want to change the qualification to other than the
currently qualified compilation unit. It can be the Debug Tool variable %CU. If there
appears to be an ambiguity between the compilation unit name, and (for example),
a block name, you must enclose the compilation unit name in double quotation
marks (").
If required, block_name is the name of the block. block_name can be the Debug Tool
variable %BLOCK.
Related concepts
“Blocks and block identifiers for C” on page 220
table
. = malloc(sizeof(long)*length);
.
.
pf = fetch("SORTMOD");
(*pf)(table);
.
.
.
release(pf);
.
.
.
}
When Debug Tool receives control, variables i, j, temp, table, and length can be
specified without qualifiers in a command. If variable sn is referenced, Debug Tool
uses the variable that is a float. However, the names of the blocks and compile
units differ, maintaining compatibility with the operating system.
Qualifying variables
v Change the file scope variable length defined in the compilation unit
MVSID.SORTSUB.C in the load module SORTMOD:
"SORTMOD"::>"MVSID.SORTSUB.C":>length = 20;
v Assume Debug Tool gained control from main(). The following changes the
variable length:
%LOAD::>"MVSID.SORTMAIN.C":>length = 20;
Because length is in the current load module and compilation unit, it can also
be changed by:
length = 20;
Once the point of view changes, Debug Tool has access to objects accessible from
this point of view. You can specify these objects in commands without qualifiers,
as in:
j = 3;
temp = 4;
v Qualify to the function main in the load module MAINMOD in the compilation
unit MVSID.SORTMAIN.C and list the entries of table.
QUALIFY BLOCK "MAINMOD"::>"MVSID.SORTMAIN.C":>main;
LIST table[i];
If you are debugging a program that calls a function that resides in a header file,
the cursor moves to the applicable header file. You can then view the function
source as you step through it. Once the function returns, debugging continues at
the line following the original function call.
You can step around a header file function by issuing the STEP OVER command.
This is useful in stepping over Library functions (for example, string functions
defined in string.h) that you cannot debug anyway.
A block identifier can be quite long, especially with templates, nested classes, or
class with many levels of inheritance. In fact, it might not even be obvious at first
as to the block name for a particular function. To set a breakpoint for these
When you do a DESCRIBE CU, the methods are always shown qualified by their
class. If a method is unique, you can set a breakpoint by using just the method
name. Otherwise, you must qualify the method with its class name. The following
two examples are equivalent:
AT ENTRY method()
AT ENTRY classname::method()
Related tasks
“Retrieving commands from the Log and Source windows” on page 104
Related tasks
“Example: displaying attributes of C++ objects”
line edge;
A obj;
You can also display the static member by referencing it as A::y since each object
of class A has the same value.
If you are within a member function of A and want to display the value of x at file
scope, enter LIST ::x. If you do not use ::, entering LIST x will display the value
of x for the current object (i.e., this–>x).
You can list the contents of storage in various ways. Using the LIST REGISTERS
command, you can receive a list of the contents of the general-purpose registers or
the floating-point registers.
You can also monitor the contents of storage by specifying a dump-format display
of storage. To accomplish this, use the LIST STORAGE command. You can specify the
address of the storage that you want to view, as well as the number of bytes.
If you compile the program above using the compiler options TEST(ALL),LIST, then
your pseudo assembly listing will be similar to the listing shown below.
* int dbl(int j)
ST r1,152(,r13)
* {
EX r0,HOOK..PGM-ENTRY
* return 2*j;
EX r0,HOOK..STMT
L r15,152(,r13)
L r15,0(,r15)
SLL r15,1
B @5L2
DC A@5L2-ep)
After a few steps, Debug Tool halts on line 1 (the program entry hook, shown in
the listing above). Another STEP takes you to line 3, and halts on the statement
hook. The next STEP takes you to line 4, and halts on the program exit hook. As
indicated by the pseudo assembly listing, only register 15 has changed during this
STEP, and it contains the return value of the function. In the Monitor window,
register 15 now has the value 0x00000014 (decimal 20), as expected.
You can change the value from 20 to 8 just before returning from dbl() by issuing
the command:
%GPR15 = 8 ;
If you are debugging an assembler CU and later decide you want to debug a
disassembly CU, you can enter the SET DISASSEMBLY ON command after you enter
the SET ASSEMBLER ON command.
Debug Tool locates the debug information in a data set with the following name:
yourid.EQALANGX(mypgm). If Debug Tool finds this data set, you can begin to debug
your assembler program. Otherwise, enter the SET SOURCE or SET DEFAULT LISTINGS
command to indicate to Debug Tool where to find the debug information.
The information displayed in the Source window is similar to the listing generated
by the assembler. The Source window displays the following information:
1 statement number
The statement number is a number assigned by the EQALANGX program.
Use this column to set breakpoints and identify statements.
2 offset
The offset from the start of the CSECT. This column matches the left-most
column in the assembler listing.
If you are not familiar with the program that you are debugging, we recommend
that you have a copy of the listing that was created by the compiler or High Level
Assembler (HLASM) available while you debug the program. There are no special
assembly or compile requirements that the program must comply with to use the
disassembly view.
If you are debugging an assembler CU and later decide you want to debug a
disassembly CU, you can enter the SET DISASSEMBLY ON command after you enter
the SET ASSEMBLER ON command.
If you enter a program that does contain debug data, the language setting does not
change and the Source window does not display disassembly code.
When you use the disassembly view, the disassembly instructions displayed in the
source area are not guaranteed to be accurate because it is not always possible to
distinguish data from instructions. Because of the possible inaccuracies, we
recommend that you have a copy of the listing that was created by the compiler or
by HLASM. Debug Tool keeps the disassembly view as accurate as possible by
refreshing the Source window whenever it processes the machine code, for
example, after a STEP command.
If you try to step back into the program that called your program, set a breakpoint
at the instruction to which you return in the calling program. If you try to step
over another program, set a breakpoint immediately after the instruction that calls
another program. When you try to step out of your program, Debug Tool displays
a warning message and lets you set the appropriate breakpoints. Then you can do
the step.
Debug Tool refreshes the disassembly view whenever it determines that the
disassembly instructions that are displayed are no longer correct. This refresh can
happen while you are stepping through your program.
Setting breakpoints
You can use a special breakpoint when you debug your program through the
disassembly view. AT OFFSET sets a breakpoint at the point that is calculated from
the start of the entry point address of the CSECT. You can set a breakpoint by
entering the AT OFFSET command on the command line or by placing the cursor in
the prefix area of the line where you want to set a breakpoint and press the AT
function key or type AT in the prefix area.
Debug Tool lets you set breakpoints anywhere within the starting and ending
address range of the CU or CSECT as long as the address appears to be a valid
op-code and is an even number offset. To avoid setting breakpoints at the wrong
offset, we recommend that you verify the offset by referring to a copy of the listing
that was created by the compiler or by HLASM.
You can also use assembler statements to display and modify storage. For example,
to set the four bytes located by the address in register 2 to zero, enter the following
command:
R2-> <4>=0
To verify that the four bytes are set to zero, enter the following command:
LIST R2->
When you debug a program through the disassembly view, Debug Tool cannot
stop the application in any of the following situations:
v The program does not comply with the first three restrictions that are listed
above.
v Between the following instructions:
– After the LE stack extend has been called in the prologue code, and
– Before R13 has been set with a savearea or DSA address and the backward
pointer has been properly set.
The application runs until Debug Tool encounters a valid save area backchain.
Related tasks
DB2 UDB for OS/390 Application Programming and SQL Guide
The Debug Tool Setup Utility is available through Debug Tool Utilities.
1. Start DTSU by using the TSO command or the ISPF panel option, if available.
Contact your system administrator to determine if the ISPF panel option is
available.
2. Create a setup file. Remember to select the Initialize New setup file for DB2
field.
3. Fill in all the fields with the appropriate information. Remember to enter the
proper commands in the DSN command options and the RUN command
options fields.
4. Enter the RUN command to run the DB2 program.
After your program has been initiated, debug your program by issuing the
required Debug Tool commands.
Note: If your source does not come up in Debug Tool when you launch it, check
that the listing or source file name corresponds to the MVS library name,
and that you have at least read access to that MVS library.
The program listing (for COBOL and PL/I) or program source (for C and C++)
that Debug Tool displays and uses for the debug session is the output from the
compile step and precompile step respectively, and thus includes all the DB2
expansion code produced by the DB2 precompiler. If you are compiling your
program with a COBOL compiler option that support the SQL compiler option, the
program listing does not include all the DB2 expansion code produced by the DB2
precompiler.
Related references
DB2 UDB for OS/390 Administration Guide
The topics below describe the steps for using Debug Tool to debug your DB2
stored procedures.
Related tasks
Chapter 11, “Preparing a DB2 stored procedures program,” on page 45
“Starting Debug Tool from DB2 stored procedures: troubleshooting” on page 85
Related references
Chapter 11, “Preparing a DB2 stored procedures program,” on page 45
DB2 UDB for OS/390 Application Programming and SQL Guide
FSS is the default option when BTS is started in the TSO foreground, and is
available only when you are running BTS in the TSO foreground. FSS can only
be turned off by specifying TSO=NO on the ./O command. When running in the
TSO foreground, all call traces are displayed on your TSO terminal by default.
This can be turned off by parameters on either the ./O or ./T commands.
v To debug your batch IMS programs without BTS, use batch mode, full-screen
mode through a VTAM terminal, or remote debug mode.
v To debug your batch IMS programs with BTS, choose one of the following:
– If you want all interaction to be on a single screen, use full-screen mode.
– If you want BTS data displayed on your TSO terminal and your Debug Tool
session to be displayed on another terminal, use full-screen mode through a
VTAM terminal or remote debug mode.
Related tasks
Chapter 13, “Preparing an IMS program,” on page 53
“Setting up the run-time options for your IMS Version 8 TM program by using
Debug Tool Utilities” on page 54
“Linking IMS programs for debugging” on page 55
“Debugging IMS programs in interactive mode”
Related references
IMS/VS Batch Terminal Simulator Program Reference and Operations Manual
Note: If your source (C and C++) or listing (COBOL and PL/I) does not come up
in Debug Tool when you launch it, check that the source or listing file name
corresponds to the MVS library name, and that you have at least read access
to that MVS library.
Currently, Debug Tool can only be used to debug one iteration of a transaction at a
time. When the program terminates you must close down Debug Tool before you
can view the output of the transaction.
Therefore, if you use an input data set, you can only specify data for one
transaction in that data set. The data for the next transaction must be entered from
your TSO terminal.
A new debug session will be started automatically for the next transaction. When
using FSS, you must enter the /* command on your TSO terminal to terminate the
BTS session.
For example, you can allocate a data set, userid.CODE.BTSINPUT with individual
members of test input data for IMS transactions under BTS.
Under IMS, you can start Debug Tool in the following ways:
v Use the compiler run-time option (#pragma runopts for C and C++)
v Include CSECT CEEUOPT when linking your program (for C and C++)
v Use the Language Environment callable service CEETEST (__ctest() for C and
C++)
Note: For C and C++ and Enterprise PL/I, it is the input to the compiler (that is,
the output from the CICS translator) that needs to be retained. To enhance
performance when using Debug Tool, use a large block size when saving
these files.
Related tasks
“Starting Debug Tool under CICS” on page 86
“Using DTCN to start Debug Tool for CICS programs” on page 87
“Link-editing CEEBXITA into your program” on page 47
“Creating and storing a DTCN profile” on page 47
“Using CEEUOPT to start Debug Tool under CICS” on page 88
“Using compiler directives to start Debug Tool under CICS” on page 88
“Using CEDF to start Debug Tool under CICS” on page 88
“Preventing Debug Tool from stopping at EXEC CICS RETURN” on page 250
“Saving settings while debugging a pseudo-conversational program” on page 250
Related references
“Debug modes under CICS”
“Restrictions when debugging under CICS” on page 250
To prevent Debug Tool from stopping at every EXEC CICS RETURN statement in
your application and suppress this message, set the TEST level to ERROR by
using the SET TEST ERROR command.
v LOCATION: Unknown (Application program has terminated)
This message is displayed at the top of the screen, in the session panel header.
To prevent Debug Tool from stopping at every EXEC CICS RETURN statement in
your application and suppress this message, clear the AT TERMINATION
breakpoints by using the CLEAR AT TERMINATION command.
The rest of this section assumes that you are debugging ISPF applications using the
same emulator session.
When you debug ISPF applications or applications that use line mode input and
output, issue the SET REFRESH ON command. This command is executed and is
displayed in the log output area of the Command/Log window.
Because SET REFRESH ON modifies the Debug Tool environment, the REFRESH setting
is saved in the preferences file (inspsafe), and it is preserved between Debug Tool
invocations. You need to specify it only once; Debug Tool uses the same setting on
subsequent invocations.
Related tasks
Chapter 26, “Customizing your full-screen session,” on page 171
This section helps you determine how much of Debug Tool’s testing functions you
want to continue using after you complete major testing of your application and
move into the final tuning phase. Included are discussions of program size and
performance considerations; the consequences of removing hooks, the statement
table, and the symbol table; and using Debug Tool on optimized programs.
Related tasks
“Fine-tuning your programs with Debug Tool”
“Debugging without hooks, statement tables, and symbol tables” on page 256
“Debugging optimized C, C++, PL/I and older COBOL programs” on page 257
“Debugging optimized COBOL programs” on page 258
Removing hooks
One option for increasing the performance of your program is to compile with a
minimum of hooks or with no hooks.
v For C programs, compiling with the option TEST(NOLINE,BLOCK,NOPATH) causes
the compiler to insert a minimum number of hooks while still allowing you to
perform tasks at block boundaries.
v For COBOL programs, compiling with the option TEST(NONE,SYM) creates
programs that do not have hooks. Using the Dynamic Debug facility, Debug Tool
inserts hooks while debugging the program, allowing you to perform almost any
debugging task.
Before you remove them, however, you should consider their advantages. The
statement table allows you to display the execution history with statement
numbers rather than offsets, and error messages identify statement numbers that
are in error. The symbol table enables you to refer to variables and program
control constants by name. Therefore, you need to look at the trade-offs between
the size of your program and the benefits of having symbol and statement tables.
For programs that are compiled with the following compilers and with the
SEPARATE suboption of the TEST compiler option, the symbol tables are saved in a
separate debug file. This arrangement lets you to retain the symbol table
information and have a smaller program:
v Enterprise COBOL for z/OS and OS/390, Version 3
v COBOL for OS/390 & VM, Version 2 Release 2
v COBOL for OS/390 & VM, Version 2 Release 1, with APAR PQ40298
When Debug Tool receives control in this limited environment, it does not know
what statement is in error (no statement table), nor can it locate variables (no
symbol table). Thus, you must use addresses and interpret hexadecimal data
values to examine variables. In this limited environment, you can:
v Determine the block that is in control:
list (%LOAD, %CU, %BLOCK);
or
list (%LOAD, %PROGRAM, %BLOCK);
v Determine the address of the error and of the compile unit:
list (%ADDRESS, %EPA); (where %EPA is allowed)
v Display areas of the program in hexadecimal format. Using your listing, you can
find the address of a variable and display the contents of that variable. For
example, you can display the contents at address 20058 in a C and C++ program
by entering:
LIST STORAGE (0x20058);
If your program does not contain a statement or symbol table, you can use session
variables to make the task of examining values of variables easier.
Even in this limited environment, HLL library routines are still available.
Programs that are compiled with Enterprise COBOL for z/OS and OS/390 or
COBOL for OS/390 & VM can have the best performance and smallest module
size, while retaining full debugging capabilities, if they are compiled with the
TEST(NONE,SYM,SEPARATE) compiler option. This option specifies that no hooks are
inserted and symbol table information is saved in a separate debug file.
In the case of variable values, Debug Tool displays the contents of the storage
where the variable has been assigned. However, in an optimized program, the
variable might actually reside in a register. For example, consider the following
assignments for the OPTIMIZE compiler option:
a = 5
b = a + 3
If you have requested that your application be optimized, Debug Tool cannot
guarantee that a breakpoint that is set at a particular statement indeed occurs at
the beginning of the code that is generated for that statement.
You must compile your COBOL programs with one of the following combinations
of compiler options:
v OPT(STD) TEST(NONE,SYM)
v OPT(STD) TEST(NONE,SYM,SEPARATE)
v OPT(FULL) TEST(NONE,SYM)
v OPT(FULL) TEST(NONE,SYM,SEPARATE)
The enhancements to the compilers help you create programs that can be
debugged in the same way that you debug unoptimized programs. There are some
exceptions:
v You cannot change the flow of your program.
v You cannot use the GOTO command.
v You cannot use the AT CALL entry_name command. Instead, use the AT CALL *
command.
The Source window does display the variables and statements that the optimizer
removed, but you cannot use any Debug Tool commands on those variables or
statements. For example, you cannot list the value of a variable removed by the
optimizer.
If one or more of the programs you are debugging are in a shared library and you
are using dynamic debugging, you need to assign the environment variable
_BPX_PTRACE_ATTACH a value of YES. This enables Debug Tool to set hooks in the
shared libraries. Programs that have a .so suffix are programs in a shared library.
For more information on how to set environment variables, see your UNIX System
Services documentation.
The topics below describe how Debug Tool makes it possible for you to debug
programs consisting of different languages, structures, conventions, variables, and
methods of evaluating expressions.
A general rule to remember is that Debug Tool tries to let the language itself guide
how Debug Tool works with it.
Related tasks
“Qualifying variables and changing the point of view” on page 267
“Debugging multilanguage applications” on page 271
“Handling conditions and exceptions in Debug Tool” on page 269
Related references
“Debug Tool evaluation of HLL expressions”
“Debug Tool interpretation of HLL variables and constants”
“Debug Tool commands that resemble HLL commands” on page 266
“Coexistence with other debuggers” on page 273
“Coexistence with unsupported HLL modules” on page 274
When you enter an expression that will not be run immediately, you should fully
qualify all program variables. Qualifying the variables assures that proper context
information (such as load module and block) is passed to the language run time
when the expression is run. Otherwise, the context might not be the one you
intended when you set the breakpoint, and the language run time might not
evaluate the expression.
Related references
“Debug Tool evaluation of C and C++ expressions” on page 215
“Debug Tool evaluation of COBOL expressions” on page 193
“Debug Tool evaluation of PL/I expressions” on page 204
HLL variables
Some variable references require language-specific evaluation, such as pointer
referencing or subscript evaluation. Once again, the Debug Tool interprets each
case in the manner of the HLL in question. Below is a list of some of the areas
where Debug Tool accepts a different form of reference depending on the current
programming language:
v Structure qualification
C and C++ and PL/I: dot (.) qualification, high-level to low-level
COBOL: IN or OF keyword, low-level to high-level
v Subscripting
C and C++: name [subscript1][subscript2]...
COBOL and PL/I: name(subscript1,subscript2,...)
v Reference modification
COBOL name(left-most-character-position: length)
HLL constants
You can use both string constants and numeric constants. Debug Tool accepts both
types of constants in C and C++, COBOL, and PL/I.
Use the SET PROGRAMMING LANGUAGE command to set the current programming
language to the desired language. The current programming language determines
how commands are parsed. If you SET PROGRAMMING LANGUAGE to AUTOMATIC, every
time the current qualification changes to a module in a different language, the
current programming language is automatically updated.
The following types of Debug Tool commands have the same syntax (or a subset of
it) as the corresponding statements (if defined) in each supported programming
language:
Assignment
These commands allow you to assign a value to a variable or reference.
Conditional
These commands evaluate an expression and control the flow of execution
of Debug Tool commands according to the resulting value.
Declarations
These commands allow you to declare session variables.
Looping
These commands allow you to program an iterative or logical loop as a
Debug Tool command.
In addition, Debug Tool supports special kinds of commands for some languages.
Related references
“Debug Tool commands that resemble C and C++ commands” on page 207
“Debug Tool commands that resemble COBOL statements” on page 187
You also need a way to change the Debug Tool’s point of view to allow it to
reference variables it cannot currently see (that is, variables that are not within the
scope of the currently executing block or compile unit, depending upon the HLL’s
concept of name scoping).
Related tasks
“Qualifying variables”
“Changing the point of view” on page 268
Qualifying variables
Qualification is a method you can use to specify to what procedure or load module
a particular variable belongs. You do this by prefacing the variable with the block,
compile unit, and load module (or as many of these labels as are necessary),
separating each label with a colon (or double colon following the load module
specification) and a greater-than sign (:>), as follows:
load_name::>cu_name:>block_name:>object
This procedure, known as explicit qualification, lets Debug Tool know precisely
where the variable is.
If required, load_name is the load module name. It is required only when the
program consists of multiple load modules and when you want to change the
qualification to other than the current load module. load_name can be the Debug
Tool variable %LOAD.
If required, cu_name is the compile unit name. The cu_name is required only when
you want to change the qualification to other than the currently qualified compile
unit. cu_name can be the Debug Tool variable %CU.
If required, block_name is the program block name. The block_name is required only
when you want to change the qualification to other than the currently qualified
block. block_name can be the Debug Tool variable %BLOCK.
is valid.
LM::>PROC1:>PROC1:>variable
is not valid.
Use the Debug Tool command DESCRIBE CUS to give you the correct BLOCK or
CU qualification needed.
Use the LIST NAMES command to show all polymorphic functions of a given
name. For the example above, LIST NAMES "ICCD0320*" would list all
polymorphic functions called ICCD0320.
You do not have to preface variables in the currently executing compile unit. These
are already known to Debug Tool; in other words, they are implicitly qualified.
In order for attempts at qualifying a variable to work, each block must have a
name. Blocks that have not received a name are named by Debug Tool, using the
form: %BLOCKnnn, where nnn is a number that relates to the position of the block in
the program. To find out the Debug Tool’s name for the current block, use the
DESCRIBE PROGRAMS command.
Related references
“Qualifying variables and changing the point of view in C and C++” on page 222
“Qualifying variables and changing the point of view in COBOL” on page 195
Each time you update any of the three Debug Tool variables %CU, %PROGRAM, or
%BLOCK, all four variables (%CU, %PROGRAM, %LOAD, and %BLOCK) are automatically
updated to reflect the new point of view. If you change %LOAD using SET QUALIFY
LOAD, only %LOAD is updated to the new point of view. The other three Debug Tool
variables remain unchanged. For example, suppose your program is currently
If you are debugging a program that has multiple enclaves, SET QUALIFY can be
used to identify references and statement numbers in any enclave by resetting the
point of view to a new block, compile unit, or load module.
Related tasks
Chapter 42, “Debugging across multiple processes and enclaves,” on page 277
“Changing the point of view in C and C++” on page 223
“Changing the point of view in COBOL” on page 197
When a condition is signaled in your application, Debug Tool prompts you and
you can then dynamically code around the problem. For example, you can initialize
a pointer, allocate memory, or change the course of the program with the GOTO
command. You can also indicate to Language Environment’s condition handler,
that you have handled the condition by issuing a GO BYPASS command. Be aware
that some of the code that follows the instruction that raised the condition might
rely on data that was not properly stored or handled.
When debugging with Debug Tool, you can (depending on your host system)
either instruct the debugger to handle program exceptions and conditions, or pass
them on to your own exception handler. Programs also have access to Language
Environment services to deal with program exceptions and conditions.
Related tasks
“Handling conditions in Debug Tool” on page 270
“Handling exceptions within expressions (C and C++ and PL/I only)” on page 271
If you specify TEST(ALL) as a run-time option when you begin your debug session,
Debug Tool gains control at the occurrence of most conditions.
Note: Debug Tool recognizes all Language Environment conditions that are
detected by the Language Environment error handling facility.
You can also direct Debug Tool to respond to the occurrence of conditions by using
the AT OCCURRENCE command to define breakpoints. These breakpoints halt
processing of your program when a condition is raised, after which Debug Tool is
given control. It then processes the commands you specified when you defined the
breakpoints.
There are several ways a condition can occur, and several ways it can be handled.
If, after the execution of any defined breakpoint, control returns to your program
with a GO, the condition is raised again in the program (if possible and still
applicable). If you use a GOTO to bypass the failing statement, you also bypass your
program’s error handling facilities.
However, you might want to pass an exception to your program, perhaps to test
an error recovery procedure. In this case, use SET WARNING OFF.
Related tasks
“Using SET WARNING PL/I command with built-in functions” on page 204
When the need to debug a multilanguage application arises, you can find yourself
facing one of the following scenarios:
v You need to debug an application written in more than one language, where
each language is supported by Language Environment and can be debugged by
Debug Tool.
v You need to debug an application written in more than one language, where not
all of the languages are supported by Language Environment, nor can they be
debugged by Debug Tool.
Related tasks
“Debugging an application fully supported by Language Environment”
“Using session variables across different languages” on page 272
When defining session variables you want to access from compile units of different
languages, you must define them with compatible attributes.
Related tasks
“Using session variables across different languages”
Related references
z/OS Language Environment Programming Guide
Related tasks
Chapter 32, “Debugging a disassembled program,” on page 235
Machine attributes PL/I attributes C and C++ attributes COBOL attributes Assembler and
disassembly
attributes
byte CHAR(1) unsigned char PICTURE X DS X or
DS C
byte string CHAR(j) unsigned char[j] PICTURE X(j) DS XLj or
DS CLj
halfword FIXED BIN(15,0) signed short int PICTURE S9(j≤4) DS H
USAGE BINARY
Note: When registering session variables in PL/I, the DECIMAL type is always the
default. For example, if C declares a float, PL/I registers the variable as a
FLOAT DEC(6) rather than a FLOAT BIN(21).
When declaring session variables, remember that C and C++ variable names are
case-sensitive. When the current programming language is C and C++, only
session variables that are declared with uppercase names can be shared with
COBOL or PL/I. When the current programming language is COBOL or PL/I,
session variable names in mixed or lowercase are mapped to uppercase. These
COBOL or PL/I session variables can be declared or referenced using any mixture
of lowercase and uppercase characters and it makes no difference. However, if the
session variable is shared with C and C++, within C and C++, it can only be
referred to with all uppercase characters (since a variable name composed of the
same characters, but with one or more characters in lowercase, is a different
variable name in C and C++).
Related references
“Debug Tool interpretation of HLL variables and constants” on page 265
C, C++, COBOL, and PL/I are dependent upon Language Environment to provide
debugging information.
Related references
“Coexistence with unsupported HLL modules”
Related references
“Coexistence with other debuggers” on page 273
Related references
z/OS Language Environment Programming Guide
In full-screen mode or batch mode, you can debug a non-POSIX program that
spans more than one process, but Debug Tool can be active in only one process. In
remote debug mode, you can debug a POSIX program that spans more than one
process. The remote debugger can display each process.
When you are recording the statements that you run, data collection persists across
multiple enclaves until you stop recording. When you replay your statements, the
data is replayed across the enclave boundaries in the same order as they were
recorded.
Related tasks
“Starting Debug Tool within an enclave”
“Viewing Debug Tool windows across multiple enclaves”
“Using breakpoints within multiple enclaves” on page 278
“Ending a Debug Tool session within multiple enclaves” on page 278
“Using Debug Tool commands within multiple enclaves” on page 278
If Debug Tool is first activated in a nested enclave of a process, and you step or go
back to the parent enclave, you can debug the parent enclave. However, if the
parent enclave contains COBOL but the nested enclave does not, Debug Tool is not
active for the parent enclave, even upon return from the child enclave.
Upon activation of Debug Tool, the initial commands string, primary commands
file, and the preferences file are run. They run only once, and affect the entire
Debug Tool session. A new primary commands file cannot be started for a new
enclave.
Normally, the condition causes the current enclave to terminate. Then, the same
condition will be raised in the parent enclave, which will also terminate. This
sequence continues until all enclaves in the process have been terminated. As a
result, you will see a CEE2529S message for each enclave that is terminated.
For CICS and MVS only: Depending on Language Environment run-time settings,
the application might be terminated with an ABEND 4038. This termination is
normal and should be expected.
Affects entire
Affects current Debug Tool
Debug Tool command enclave only session Comments
%CAAADDRESS X
AT GLOBAL X
AT TERMINATION X
CLEAR AT X X In addition to clearing breakpoints set in the
current enclave, CLEAR AT can clear global
breakpoints.
CLEAR DECLARE X
CLEAR VARIABLES X
Declarations X Session variables are cleared at the termination of
the process in which they were declared.
Notes:
1. SET commands other than those listed in this table affect the entire Debug Tool
session.
2. If no active condition handler exists for the specified condition, the default
condition handler can cause the program to end prematurely.
For example, consider a CICS application that has five programs called PROG1 to
PROG5 and uses EXEC CICS LINK or EXEC CICS XCTL to pass control between
them. If you want to run the application until PROG4 begins, enter the following
commands:
CLEAR AT TERMINATION
AT LOAD PROG4
GO
The COBOL compiler stores the data set name of the separate debug file
inside the load module. Debug Tool uses this data set name to access the
listing and other debug data, such as the symbol table. The DD name used
by the COBOL compiler for the separate debug file is SYSDEBUG.
Because this data set might be read many times by Debug Tool, we
recommend that you do one of the following:
v Define it with the largest block size that your DASD can hold.
v Instruct the system to compute the optimum block size, if your system
has that capability.
Preferences file
Related references
“Format for a COBOL source listing and debug file” on page 187
In all of these cases, there is a default data set name associated with each CU. This
name is either the name of the data set where the compiler processed the source,
listing, or side file or a name constructed from the CU name. The way this default
name is generated differs depending on the source language and compiler used.
See Appendix A, “Data sets used by Debug Tool,” on page 285 for a description of
this default name and how it is generated for each language and compiler.
The source or listing data, side file data, or EQALANGX data is obtained from one
of the following sources:
v the default data set name
v the SET SOURCE command
v the SET DEFAULT LISTINGS command
v the EQADEBUG DD statement
The order in which these are located is different for each type of file. For the
default data set name and the SET DEFAULT LISTINGS command, the EQAUEDAT
user exit might modify the data set name before the file is opened. However, if a
EQADEBUG DD statement in present, the EQAUEDAT user exit is not run.
The SET SOURCE command can be entered only after the CU name appears as a CU
and the side file is not found in any of the other location. The SET DEFAULT
LISTINGS command can be entered at any time before the CU name appears as a
CU or, if the side file is not found in any of the other possible locations, it can be
entered later.
The SET SOURCE command can be entered any time after the CU name appears as a
disassembly CU or, if the EQALANGX file is not found by the LDD command, after
you enter the LDD command. The SET DEFAULT LISTINGS command can be entered
any time before you enter the LDD command or, if the EQALANGX file is not
found by the LDD command, after you enter the LDD command.
Copy the following members of the hlq.SEQASAMP data set into the personal data
sets you just created:
Appendix C. Examples: Preparing programs and modifying setup files with Debug Tool Utilities 293
11. In panel ISRBROBA, browse the file to review the messages. When you are
done reviewing the messages, press PF3 (Exit).
12. One of the following panels is displayed, depending on the language you
selected in step 2 on page 292:
v EQAPPC1C for COBOL programs.
v EQAPPC3C for PL/I programs.
v EQAPPC4C for C and C++ programs.
v EQAPPC5C for assembler programs.
Press PF3 (Exit).
13. One of the following panels is displayed, depending on the language you
selected in step 2 on page 292:
v EQAPPC1B for COBOL programs.
v EQAPPC3B for PL/I programs.
v EQAPPC4B for C and C++ programs.
v EQAPPC5B for assembler programs.
Press PF3 (Exit).
14. One of the following panels is displayed, depending on the language you
selected in step 2 on page 292:
v EQAPPC1 for COBOL programs.
v EQAPPC3 for PL/I programs.
v EQAPPC4 for C and C++ programs.
v EQAPPC5 for assembler programs.
Press PF3 (Exit).
15. In panel EQAPP, press PF3 (Exit) to return to EQA@PRIM panel.
Appendix C. Examples: Preparing programs and modifying setup files with Debug Tool Utilities 295
Run the program in batch
To modify and run the setup file so that the program runs in batch, do the
following steps:
1. In panel EQA@PRIM, select 0. Press Enter.
2. In panel EQAPDEF, review the job card information. If there are any changes
that need to be made, make them. Press PF3 (Exit).
3. In panel EQA@PRIM, select 2. Press Enter.
4. In panel EQAPFOR, select one of the following choices, depending on which
language you selected in step 2 on page 292:
v For the COBOL program, use the following values for each field: Project =
prefix, Group = SAMPLE, Type = DTSF, Member =WSU1
v For the PL/I program, use the following values for each field: Project =
prefix, Group = SAMPLE, Type = DTSF, Member =WSU3
v For the C program, use the following values for each field: Project = prefix,
Group = SAMPLE, Type = DTSF, Member = WSU4
v For the assembler program, use the following values for each field: Project
= prefix, Group = SAMPLE, Type = DTSF, Member = WSU5
Press Enter.
5. If you ran the steps beginning on page 295 (running the program in
foreground), you can skip this step. In panel EQAPFORS, do the following
steps:
a. Replace &LOADDS. with the name of the load data set from step 5 on page
294 of instructions on how to link the object modules.
b. Replace &EQAPRFX. with the prefix your EQAW (Debug Tool) library.
c. Replace &CEEPRFX. with the prefix your CEE (Language Environment)
library.
6. Enter "e" in the Cmd field next to CMDS DD name. If there is not ’QUIT ;’
statement at the end of the data set, then add the statement. Press PF3 (Exit).
7. Type submit in command line. Press Enter.
8. In panel ISREDDE2, type submit in the command line. Press Enter. Make a
note of the job number that is displayed.
9. In panel ISREDDE2, press PF3 (Exit).
10. In panel EQAPFORS, press PF3 (Exit). The changes you made to the setup file
are saved.
11. In panel EQAPFOR, press PF3 (Exit) to return to EQA@PRIM panel. locate the
job output using the job number recorded. Check for zero return code and the
command log output at the end of the job output.
In batch mode, Debug Tool receives its input from the primary commands file, the
USE file, or the command string specified in the TEST run-time option, and writes
its normal output to a log file.
Note: You must ensure that you specify a log data set.
Commands that require user interaction, such as PANEL, are invalid in batch mode.
You might want to run a Debug Tool session in batch mode if:
v You want to restrict the processor resources used. Batch mode generally uses
fewer processor resources than interactive mode.
v You have a program that might tie up your terminal for long periods of time.
With batch mode, you can use your terminal for other work while the batch job
is running.
v You are debugging an application in its native batch environment, such as
MVS/JES or CICS batch.
When Debug Tool is reading commands from a specified data set or file and no
more commands are available in that data set or file, it forces a GO command until
the end of the program is reached.
Related tasks
“Starting Debug Tool in batch” on page 81
When you use the TCPIP& suboption, verify that the port ID you specify matches
the port number being used by the remote debugger (Compiled language
debugger). The default port number that the Compiled language debugger uses is
8001 and the default port number that Debug Tool uses is 8000. To make the port
numbers match, use 8001 as the port number in your TEST run-time options string.
For example, TEST(ALL,’*’,PROMPT,’TCPIP&8001:’)
When you use the VADTCPIP& suboption, consider the following possible errors:
v The tcpip_workstation_id or port_id parameters must be syntactically and
functionally correct. If they are not and you try to start a remote debug mode
session, Debug Tool starts a full-screen mode session. For example, if you try to
start a remote debug mode session from TSO or a CICS program by using
incorrect parameters, a full-screen mode session is displayed on your 3270 type
terminal. This error is recorded in the MVS SDSF log as an allocation failure.
v If the tcpip_workstation_id or port_id parameters are not syntactically and
functionally correct and you try to debug batch program, Debug Tool terminates
and the batch program runs as though no debug session was started. This error
occurs when, for example, you run a JES batch job or CICS batch transaction.
This error is recorded in the MVS SDSF log as an allocation failure.
v If your z/OS or OS/390 environment is not using the default TCP/IP data set
named TCPIP.TCPIP.DATA and you try to start a remote debug mode session to
debug a batch program, Debug Tool terminates. The batch program runs as
though no debug session was started. This error is recorded in the MVS SDSF
log as an allocation error.
To fix this error, specify the SYSTCPD DDNAME with the appropriate TCP/IP
data set name. For example,
//SYSTCPD DD DISP=SHR,DSN=MY.TCPIP.DATA
v For TCP/IP sessions, the remote debug daemon must be started at the
workstation before you start Debug Tool. Refer to the remote debugger
information for help on using the remote debug daemon.
After you start the IBM Distributed Debugger and start your optimized COBOL
program, do the following steps:
1. Step into your program by using the Step Into button.
The new value of the variable you are monitoring is displayed in the Monitors
window.
This chapter describes the TEST compiler option for C, C++, COBOL, and PL/I. For
more information on how to use the compiler options, refer to the chapters in
Part 2, “Preparing your program for debugging,” on page 19. For a listing of all the
compiler options available for each programming language, see the documentation
provided with each programming language compiler.
The suboptions of the TEST compiler option control the generation of symbol tables
and program hooks that Debug Tool needs to debug your programs. The choices
that you make when compiling your program affect the amount of Debug Tool
function available during your debug session. When a program is under
development, you should compile the program with TEST(ALL) to get the full
capability of Debug Tool.
Related tasks
z/OS C/C++ User’s Guide
z/OS C/C++ Programming Guide
COBOL for OS/390 & VM Programming Guide
Enterprise COBOL for z/OS and OS/390 Programming Guide
VisualAge PL/I for OS/390 Programming Guide
Enterprise PL/I for z/OS and OS/390 Programming Guide
Related references
C/C++ Language Reference
COBOL for OS/390 & VM Language Reference
Enterprise COBOL for z/OS and OS/390 Language Reference
Enterprise PL/I for z/OS and OS/390 Language Reference
VisualAge PL/I Language Reference
NOTEST
TEST
,
BLOCK
( NOBLOCK )
LINE
NOLINE
PATH
NOPATH
SYM
NOSYM
ALL
NONE
;
NOTEST (1)
TEST ( )
HOOK
NOHOOK
Notes:
1 The HOOK and NOHOOK options are available only with OS/390 C/C++, Version
2 Release 4, or later.
The following list explains what is produced by each option and how Debug Tool
uses them when debugging your program:
NOTEST
Specifies that no debugging information is to be generated. That is, no hooks
are compiled into your program, no symbol tables are created, and Debug Tool
does not have access to any symbol information.
v You cannot step through program statements. You can suspend execution of
the program only at the initialization of the main compile unit.
v You cannot examine or use any program variables.
v You can list storage and registers.
NOTEST
(ALL, SYM)
TEST
(1)
, NOSEPARATE
( ALL , SYM )
BLOCK (1)
NONE , SEPARATE
PATH NOSYM
STMT (1)
, NOSEPARATE
;
Notes:
1 The SEPARATE and NOSEPARATE suboptions are available for programs compiled
only with Enterprise COBOL for z/OS and OS/390 or COBOL for OS/390 &
VM compilers.
If you compile your program with the TEST or NOTEST options and their
corresponding suboptions, Debug Tool can do the following:
NOTEST
Specifies that no debug information is to be generated: no hooks are compiled
into your program, no symbol tables are created, and Debug Tool does not
have access to any symbol information. Using NOTEST produces the following
results:
Related references
Debug Tool for z/OS Reference and Messages
Enterprise COBOL for z/OS and OS/390 Programming Guide
COBOL for OS/390 & VM Programming Guide
Syntax for the PL/I and Enterprise PL/I TEST compiler options
The syntax for the PL/I TEST compiler option is:
NOTEST
TEST
NONE
( BLOCK )
STMT SYM
PATH , NOSYM
ALL
SYM
NOSYM
NONE
, BLOCK
STMT
PATH
ALL
;
The syntax for the Enterprise PL/I TEST compiler option is:
NOTEST
TEST
NONE
( STMT )
ALL SYM
, NOSYM
SYM
NOSYM
NONE
, STMT
ALL
;
The following list explains each option and suboption and the capabilities of
Debug Tool when your program is compiled using these options:
Related references
PL/I for MVS and VM Programming Guide
VisualAge PL/I for OS/390 Programming Guide
IBM may have patents or pending patent applications covering subject matter in
this document. The furnishing of this document does not give you any license to
these patents. You can send license inquiries, in writing, to:
IBM Corporation
J46A/G4
555 Bailey Avenue
San Jose, CA 95141-1003
U.S.A.
For license inquiries regarding double-byte (DBCS) information, contact the IBM
Intellectual Property Department in your country or send inquiries, in writing, to:
The following paragraph does not apply to the United Kingdom or any other
country where such provisions are inconsistent with the local law:
Other company, product, and service names, which may be denoted by a double
asterisk (**), may be trademarks or service marks of others.
Java™ and all Java-based trademarks and logos are trademarks or registered
trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.
TSO/E
Command Reference, SA22-7782
Programming Guide, SA22-7788
System Programming Command Reference,
SA22-7793
User’s Guide, SA22-7794
CICS
Application Programming Guide, SC34-5993
Application Programming Primer, SC33-0674
Application Programming Reference, SC34-5994
IMS
IMS Application Programming: Database
Manager, SC26-8727
IMS Application Programming: EXEC DLI
Commands for CICS & IMS, SC26-8726
IMS Application Programming: Transaction
Manager, SC26-8729
Softcopy publications
Online publications are distributed on CD-ROMs
and can be ordered through your IBM
representative. Debug Tool for z/OS User’s Guide,
Debug Tool for z/OS Customization Guide, and
Debug Tool for z/OS Reference and Messages are
distributed on the following collection kit:
batch. Pertaining to a predefined series of actions conversational. A transaction type that accepts input
performed with little or no interaction between the user from the user, performs a task, then returns to get more
and the system. Contrast with interactive. input from the user.
batch job. A job submitted for batch processing. See currently qualified. See qualification.
batch. Contrast with interactive.
debug. To detect, diagnose, and eliminate errors in execution time. See run time.
programs.
execution-time environment. See run-time environment.
DTCN. Debug Tool Control utility, a CICS transaction
that enables the user to identify which CICS programs expanded date field. A COBOL date field containing
to debug. an expanded (four-digit) year. See also date field and
expanded year.
Debug Tool procedure. A sequence of Debug Tool
commands delimited by a PROCEDURE and a expanded year. In COBOL, four digits representing a
corresponding END command. year, including the century (for example, 1998).
Appears in expanded date fields. Compare with
Debug Tool variable. A predefined variable that windowed year.
provides information about the user’s program that the
user can use during a session. All of the Debug Tool expression. A group of constants or variables
variables begin with %, for example, %BLOCK or %CU. separated by operators that yields a single value. An
expression can be arithmetic, relational, logical, or a
default. A value assumed for an omitted operand in a character string.
command. Contrast with initial setting.
listing. A printout that lists the source language PDS. See partitioned data set.
statements of a program with all preprocessor
prefix area. The eight columns to the left of the
statements, includes, and macros expanded.
program source or listing containing line numbers.
Statement breakpoints can be set in the prefix area.
Glossary 317
primary entry point. See entry point. array or array element, or a structure or structure
element. Any of the above can be pointer-qualified
procedure. In a programming language, a block, with where applicable.
or without formal parameters, whose execution is
invoked by means of a procedure call. A set of related run. To cause a program, utility, or other machine
control statements. For example, an MVS CLIST. function to execute. An action that causes a program to
begin execution and continue until a run-time
process. The highest level of the Language exception occurs. If a run-time exception occurs, the
Environment program management model. It is a user can use Debug Tool to analyze the problem. A
collection of resources, both program code and data, choice the user can make to start or resume regular
and consists of at least one enclave. execution of a program.
Profile. A choice that allows the user to change some run time. Any instant when a program is being
characteristics of the working environment, such as the executed.
pace of statement execution in the Debug Tool.
run-time environment. A set of resources that are
program. A sequence of instructions suitable for used to support the execution of a program.
processing by a computer. Processing can include the
use of an assembler, a compiler, an interpreter, or a run unit. A group of one or more object programs that
translator to prepare the program for execution, as well are run together.
as to execute it.
record. A group of related data, words, or fields source. The HLL statements in a file that make up a
treated as a unit, such as one name, address, and program.
telephone number.
Source window. A Debug Tool window that contains
record format. The definition of how data is a display of either the source code or the listing of the
structured in the records contained in a file. The program being debugged.
definition includes record name, field names, and field
descriptions, such as length and data type. The record SPOC. See 318.
formats used in a file are contained in the file
static. In programming languages, pertaining to
description.
properties that can be established before execution of a
reference. In programming languages, a language program; for example, the length of a fixed-length
construct designating a declared language object. A variable is static. Contrast with dynamic.
subset of an expression that resolves to an area of
step. One statement in a computer routine. To cause a
storage; that is, a possible target of an assignment
computer to execute one or more statements. A choice
statement. It can be any of the following: a variable, an
the user can make to execute one or more statements in
the application being debugged.
U
utility. A computer program in general support of
computer processes; for example, a diagnostic program,
a trace program, or a sort program.
Glossary 319
320 Debug Tool Version 4 Release 1 User’s Guide
Index
Special characters assembler programs
assembling, requirements 38
breakpoints (continued)
halting when certain functions are
__ctest() function 75 requirements for debugging 37 called (continued)
%CONDITION variable using Debug Tool Utilities to assemble in PL/I 136
for PL/I 201 and create 39 recording, using SET
%PATHCODE variable assembler, definition of xiii AUTOMONITOR 108
for C and C++ 209 assembling your program, requirements setting a line 109
for PL/I 200 for 38 setting, in C++ 225
values for COBOL 192 assigning values to variables 189, 209 using within multiple enclaves 278
#pragma 33 AT commands
specifying TEST compiler option 33 AT CALL
specifying TEST run-time option
with 67
breakpoints, for C++ 226
AT ENTRY
C
C
breakpoints, for C++ 225
debugging a program in full-screen
AT EXIT
A breakpoints, for C++ 225
mode
calling a C function from Debug
ABEND 4038 278 attention interrupt
Tool 146
abnormal end of application, setting effect of during Dynamic Debug 118
capturing output to stdout 146
breakpoint at 269 effect of during interactive
debugging a DLL 147
accessing PL/I program variables 202 sessions 118
displaying raw storage 147
ALLOCATE command how to initiate 118
displaying strings 147
managing file allocations 116 required Language Environment
finding storage overwrite
ambiguous names 115 run-time options 118
errors 148
applications 253 attributes of variables 272
finding uninitialized storage
assembler errors 149
debugging a program in full-screen getting a function traceback 147
mode B halting on line if condition
defining CU as assembler 166 batch mode 64 true 145
displaying variable or storage 168 debugging CICS programs in 250 halting when certain functions are
finding storage overwrite debugging DB2 programs in 243 called 144
errors 170 debugging IMS programs in 248 modifying value of variable 144
getting a function traceback 170 description of 5 setting breakpoint to halt 150
identifying a CU 166 starting Debug Tool in 81 tracing run-time path for code
identifying assembler in a different using Debug Tool in 297 compiled with TEST 148
CU 167 binding DB2 programs 43 when not all parts compiled with
loading debug information 166 blanks, significance of 184 TEST 145
modifying variables or blocks and block identifiers sample program for debugging 141
storage 168 using, for C 220 syntax of TEST compiler option 301
multiple CUs in single breakpoint C and C++
assembly 167 clearing 17 AT ENTRY/EXIT breakpoints 225
stopping at assembler routine implicit 64 blocks and block identifiers 220
call 168 using DISABLE and ENABLE 16 commands
stopping when condition is breakpoints summary 207
true 169 before calling a NULL function equivalents for Language
when not all parts have debug in C 150 Environment conditions 214
information 169 in C++ 161 function calls for 212
restrictions 233 before calling an invalid program, in notes on using 182
using Language Environment COBOL 130 reserved keywords 213
services 233 before calling an undefined program, C++ 121
while debugging MAIN in PL/I 140 AT CALL breakpoints 226
program 233 halting if a condition is true debugging a program in full-screen
with STORAGE run-time in C 145 mode
option 233 in C++ 156 calling a C++ function from Debug
sample program for debugging 163 in COBOL 126 Tool 158
self-modifying code, restrictions 233, in PL/I 137 capturing output to stdout 158
237 halting when certain COBOL routines debugging a DLL 158
assembler program are called 124 displaying raw storage 158
loading debug information 231 halting when certain functions are displaying strings 158
locating EQALANGX 231 called finding storage overwrite
making assembler CUs known to in C 144 errors 160
Debug Tool 232 in C++ 155
Index 323
E examples (continued)
changing point of view, general 268
finding (continued)
storage overwrite errors (continued)
editing COBOL in PL/I 140
setup file using Debug Tool Setup %HEX function 195 uninitialized storage errors
Utility 59 %STORAGE function 195 in C 149
elements, unsupported, for PL/I 205 assigning values to COBOL in C++ 160
enclave variables 189 FREE command
multiple, debugging interlanguage changing point of view 197 managing file allocations 116
communication application in 281 displaying results of expression freeform input, PL/I statements 202
starting 277 evaluation 194 full-screen mode
ending displaying values of COBOL continuation character, using in 183
debug session 119 variables 191 CURSOR 102
Debug Tool within multiple qualifying variables 196 CURSOR command 104
enclaves 278 using constants in debugging in 93
entering expressions 194 description of 5
commands on session panel 100 declaring variables, for COBOL 193 introduction to 11
file allocation statements into setup displaying program variables 208 PANEL COLORS 174
file 60 modifying setup files by using Debug PANEL LAYOUT 172
program parameters into setup Tool Utilities 291 PANEL PROFILE 175
file 60 PL/I screen 12
run-time option into setup file 60 in PL/I 136 SCROLL 105
entering multiline commands without sample program for WINDOW CLOSE 173
continuation 184 debugging 133 WINDOW OPEN 173
entering PL/I statements, freeform 202 PLITEST calls for PL/I 75 WINDOW SIZE 173
Enterprise PL/I, definition of xii preparing programs by using Debug WINDOW ZOOM 173
EQADCCXT 47 Tool Utilities 291 full-screen mode through a VTAM
EQADCCXT user exit 65, 87 remote debug mode 67 terminal
EQADTCN2 51 specifying TEST run-time option with description of 5
EQALANGX file #pragma 67 starting a debugging session 85
how to create 38 TEST run-time option 66 function calls, for C and C++ 212
EQALANGX files, how Debug Tool using #pragma for TEST compiler function, calling C and C++ from Debug
locates 289, 290 option 33 Tool
EQASTART, entering command 9 using constants 185 C 146
EQUATE, SET command using continuation characters 183 C++ 158
description 171 using qualification 222 function, unsupported for PL/I 205
error numbers in Log window 117 exception handling for C and C++ and functions
evaluating expressions PL/I 271 PL/I 204
COBOL 193 EXEC CICS RETURN functions, Debug Tool
HLL 265 under CICS 250 %HEX
evaluation of expressions executing using with COBOL 195
C and C++ 215 See running %STORAGE
examining C++ objects 227 expressions using with COBOL 195
examples diagnostics, for C and C++ 215 using with COBOL 195
assembler displaying values, for C and
sample program for C++ 208
debugging 163
C
displaying values, for COBOL 194
evaluation for C and C++ 211, 215
G
sample program for global data 228
evaluation for COBOL 193
debugging 141 global scope operator 228
evaluation of HLL 265
C and C++ evaluation, operators and operands
assigning values to variables 209 for C 213
blocks and block identifiers 221 for PL/I 204 H
expression evaluation 211 using constants in, for COBOL 194 H constant (COBOL) 185
monitoring and modifying halted location, displaying 106
registers and storage 228 header fields, Debug Tool session
referencing variables and setting
breakpoints 221 F panel 94
help, online
scope and visibility of objects 221 FIND command
for command syntax 185
C++ using with windows 105
hexadecimal format, displaying values
displaying attributes 227 finding
in 114
sample program for characters or strings 105
hexadecimal format, displaying variable
debugging 121, 151 renamed source, listing or separate
values in 112
setting breakpoints 226 debug file 117
hexadecimal format, how to display
CEDF procedure 89 storage overwrite errors
value of variable 114
CEETEST calls, for PL/I 73 in assembler 170
hexadecimal format, how to monitor
CEETEST function calls, for C 71 in C 148
value of variable 114
CEETEST function calls, for in C++ 160
COBOL 72 in COBOL 130
Index 325
overwrite errors, finding storage point of view, changing qualification (continued)
(continued) description 268 general description 267
in COBOL 130 for C and C++ 223 qualifying variables
in PL/I 140 with COBOL 197 with COBOL 195
positioning lines at top of windows 105
precompiling DB2 programs 41
P preference file 50, 63
preferences file 286
R
panel recording
customizing with 177
header fields, session 94 breakpoints using SET
prefix area
Profile 175 AUTOMONITOR 108
Debug Tool 100
PANEL command (full-screen mode) number of times each source line
prefix commands
changing session panel colors and runs 108
prefix area on session panel 100
highlighting 174 restrictions on, statements 111
using in Debug Tool 102
paragraph trace, generating a COBOL session with the log file 107
prepare an assembler program, steps
run-time 129 statements, introduction to 13
to 37
performance, improving Debug Tool 255 statements, using PLAYBACK
preparing
PF keys ENABLE command 110
a PL/I program for debugging 29
defining 171 stopping, using PLAYBACK DISABLE
COBOL programs for debugging 25
using 102 command 111
DB2 stored procedures 45
PF4 key, using 112 recording a debug session 98
to replay recorded statements using
PL/I 133 referencing variables, implications of 22
PLAYBACK START command 111
built-in functions 204 remote debug mode
previous commands, retrieving 103
condition handling 201 description of 5
profile settings, changing in Debug
constants 204 examples of 67
Tool 175
debugging a program in full-screen list of supported remote debuggers 4
program
mode using Debug Tool in 299
CICS, debugging 249
displaying raw storage 138 removing statement and symbol
compiling an IMS 53
finding storage overwrite tables 256
DB2, debugging 243
errors 140 replaying
hook
getting a function traceback 138 statements, introduction to 13
compiling with, C 31
halting on line if condition is replaying recorded statements 111
compiling with, COBOL 25
true 137 replaying statements
compiling with, PL/I 29
modifying value of variable 136 changing direction of 111
removing 255, 256
setting a breakpoint to halt 136 direction of 111
rules for placing 33, 36
setting breakpoint to halt 140 restrictions on 111
IMS, debugging 247
tracing run-time path for code stopping using PLAYBACK STOP
linking an IMS 55
compiled with TEST 138 command 111
multithreading, debugging 275
when not all parts compiled with using PLAYBACK commands 109
preparation
TEST 137 using PLAYBACK START
considerations, size and
expressions 204 command 111
performance 255, 256
notes on using 182 requirements
TEST compiler option, for C 31
preparing a program for for debugging CICS programs 249
TEST compiler option, for C++ 35
debugging 29 reserved keywords
TEST compiler option, for
run-time options 67 for C 213
COBOL 25
sample program for debugging 133 for COBOL 189
TEST compiler option, for
session variables 202 RESIDENT compiler option 26
PL/I 29
statements 199 resources to collect 23
TEST compiler option, for VS
structures, accessing 203 restrictions 188
COBOL II 26
syntax of TEST compiler option 307 accessing COBOL data, for 112
reducing size 255
PL/I listing, data set 286 arithmetic expressions, for
source, displaying with Debug
PL/I source, data set 285 COBOL 193
Tool 96
PLAYBACK commands debugging VS COBOL II
starting for a debug session 79
introduction to 14 programs 198
stepping through 109
PLAYBACK BACKWARD expression evaluation, for
UNIX System Services,
using 111 COBOL 193
debugging 261
PLAYBACK DISABLE location of source on HFS 29, 32, 35
variables
using 111 modifying variables in Monitor
accessing for C and C++ 208
PLAYBACK ENABLE window 115
variables, accessing for COBOL 189
using 110 recording and replaying statements,
pseudo-conversational program, saving
PLAYBACK FORWARD for 111
settings 250
using 111 string constants in COBOL 194
PX constant (PL/I) 185
PLAYBACK START when debugging multilanguage
using 111 applications 275
PLAYBACK STOP when debugging under CICS 250
using 111 Q when using a continuation
PLITEST 75 qualification character 188
description, for C and C++ 222 when using TEST 302, 304
Index 327
string substitution, using 171 TRAP(ON) run-time option, VS COBOL II, finding list for 198
strings specifying 67 VTAM
C, displaying 147 trigraph 182 starting a debugging session through
C++, displaying 158 trigraphs a, terminal 85
searching for in a window 105 using with C 182
substitution, using string 171 TSO
symbol tables, removing 256
syntax diagrams
starting Debug Tool using TEST
run-time option 83
W
warning, for PL/I 204
how to read xiii TSO command
what you need to debug 23
SYSDEBUG 286 using to debug DB2 program 243
window id area, Debug Tool 100
SYSTCPD 299 TSO, starting Debug Tool under 79
window, error numbers in 117
system commands, issuing, Debug
windows, Debug Tool session panel
Tool 101
changing configuration 172
U opening and closing 173
uninitialized storage errors, finding resizing 173
T in C 149 zooming 173
template in C++ 225 in C++ 160 workstation debugging
terminology, Debug Tool xii UNIX System Services See remote debug mode
TEST compiler option compiling a C program on 32
benefit of using 301 compiling a C++ program 35
debugging C when only a few parts
are compiled with 145
compiling a Enterprise PL/I program
on 29
Z
zooming a window, Debug Tool 173
debugging C++ when only a few using Debug Tool with 261
parts are compiled with 157 unsupported
debugging COBOL when only a few HLL modules, coexistence with 274
parts are compiled with 127 PL/I language elements 205
debugging PL/I when only a few UP, SCROLL command 105
parts are compiled with 137 USE file 64
for C 31 using Debug Tool
for C++ 35 finding renamed source, listing, or
for COBOL 25 separate debug file 117
for DB2 41
for PL/I 29
restrictions 302
specifying NUMBER option with 26
V
values
suboptions 25
assigning to C and C++
syntax of C 301
variables 209
syntax of C++ 303
assigning to COBOL variables 189
syntax of COBOL 304
variable
syntax of PL/I 307
modifying value
using #pragma statement to
in C 144
specify 33
in C++ 155
using for IMS 53
in COBOL 125
TEST run-time option
in PL/I 136
as parameter on RUN
using SET AUTOMONITOR ON
subcommand 244
command to monitor value of 113
example of 66
value, displaying 112
for PL/I 202
variables
specifying with #pragma 67
accessing program, for C and
suboption processing order 63
C++ 208
this pointer, in C++ 157
accessing program, for COBOL 189
trace, generating a COBOL run-time
assigning values to, for C and
paragraph 129
C++ 209
traceback, COBOL routine 128
assigning values to, for COBOL 189
traceback, function
compatible attributes in multiple
in assembler 170
languages 272
in C 147
displaying, for C and C++ 208
in C++ 159
displaying, for COBOL 191
in PL/I 138
HLL 266
tracing run-time path
qualifying 267
in C 148
session
in C++ 159
declaring, for C and C++ 210
in COBOL 128
session, for PL/I 202
in PL/I 138
viewing and modifying data members in
TRAP, Language Environment run-time
C++ 157
option 118, 269
VS COBOL II programs, debugging 198
Overall, how satisfied are you with the information in this book?
How satisfied are you that the information in this book is:
When you send comments to IBM, you grant IBM a nonexclusive right to use or distribute your comments in any
way it believes appropriate without incurring any obligation to you.
Name Address
Company or Organization
Phone No.
___________________________________________________________________________________________________
Readers’ Comments — We’d Like to Hear from You Cut or Fold
SC18-9012-00 Along Line
_ _ _ _ _ _ _Fold
_ _ _and
_ _ _Tape
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _Please
_ _ _ _ _do
_ _not
_ _ staple
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _Fold
_ _ _and
_ _ Tape
______
NO POSTAGE
NECESSARY
IF MAILED IN THE
UNITED STATES
IBM Corporation
Department H150/090
International Business Machines Corporation
555 Bailey Ave.
San Jose, CA
95141-9989
_________________________________________________________________________________________
Fold and Tape Please do not staple Fold and Tape
Cut or Fold
SC18-9012-00 Along Line
Printed in USA
SC18-9012-00