Testing without Breakpoint
Related Topics
- On a blank CICS screen, type XPED and press Enter.
This activates Code Debug CICS, sets the abend trap option, and displays the Primary Menu as shown in following figure. The Primary Menu will only display certain choices if the corresponding BMC product or functionality—such as Xchange, Code Coverage, or CICSPlex support—is installed and active in the CICS region.
Primary Menu (XPED/XPRT)
COMMAND ===>
MODULE: CSECT:
0 SESSION PROFILE - Set default session attributes
1 SESSION CONTROL - Analyze summary of session events
2 DEBUGGING FACILITIES - Interactively debug application programs
5 FILE UTILITY - Access datasets, temp stg, trans data, DLI, DB2
7 ABEND-AID FOR CICS - Interface to Abend-AID for CICS
C CODE COVERAGE - Interface to Code Coverage
G XCHANGE/CICS - Interface to Xchange CICS Facilities
P CICSPLEX FACILITIES - Access CICSPlex Control Facilities
X EXIT - Exit
To set breakpoints in your program or keep specific data fields,
enter your program name and use either the SOURCE command or PF key.
For Online Technical Support refer to:www.bmc.com/support
NOTICE: Press PF2/PF14 to display the Copyright/Trade Secret Notice
Code Debug CICS is now turned on and ready to intercept any abends that may occur.
2. Press Clear to return to CICS to start your test.
3. Type XCCC and press Enter. The Demonstration Transaction screen appears as shown in following figure.
Demonstration Transaction Screen
*** Compuware Corporation ***
Demonstration Transaction (C)
Enter desired employee above:
00001 - Causes ASRA Abend
00003 - Causes a write to temporary storage
00004 - Starts up XCCC as an asynchronous task
00005 - Used to show multiple CSECT support: ASM subroutine
00006 - Used to show multiple CSECT support: C subroutine
00007 - Used to show multiple MODULE support: ASM fetchable subroutine
00008 - Used to show multiple MODULE support: C fetchable subroutine
00009 - Used to show multiple MODULE support: ASM DLL subroutine
00010 - Used to show multiple MODULE support: C DLL subroutine
00333 - Causes a storage violation of an SAA
00999 - Ends normally
4. To cause an ASRA abend, type 00001 and press Enter. The CWDEMC demo program is intercepted when the abend occurs, and the Source Listing screen (2.L) is displayed as shown in following figure. This gives you the opportunity to fix the problem, re-execute the statement, and continue the test.
Source Listing Screen (2.L) Showing an ASRA
COMMAND ===> SCROLL ===> CSR
MODULE: CWDEMC CSECT: CWDEMC COMPILED: 11 OCT 2005 - 14:43:36
LV ----- C VARIABLE KEEPS -------- -- ATTRIBUTES -- ----+---10----+---20--->
dGrossPay decimal +0
dHoursWorked decimal ???
dHourlyRate decimal +525
**END**
------ ----------------------------- ASRA (DATA EXCEPTION) at CWDEMC.10344 ->
010342 850 383 | dTaxRate = pPayrollParms -> dTaxRate;
010343 851 |
=====> 852 384 | dGrossPay = dHoursWorked * dHourlyRate;
010345 853 |
010346 854 385 | dGrossTax = dGrossPay * dTaxRate;
010347 855 |
010348 856 386 | memset ( chConvertBuffer, Null, sizeof (chConvertBuffer)
010348 856 386 + __memset(chConvertBuffer,'\0',sizeof (chConvertBuffer));
010349 857 |
010350 858 | memcpy ( chConvertBuffer,
010350 858 +
010351 859 | WsPayrollWorkArea.YearToDatePay,
010352 860 387 | sizeof (WsPayrollWorkArea.YearToDatePay) );
The module and CSECT names, as well as the compile date and time, of the executing program are displayed at the top of the screen to verify that the correct program is running. The keep window appears next. Notice that all data items from the current statement automatically appear. These are called automatic keeps. Scroll through this window by positioning the cursor and using PF keys to scroll up, down, left, and right.
The status line is displayed after the keep window. The message indicates that an ASRA abend caused by a data exception has been intercepted at statement 10344 in CWDEMC.
The source code follows the STATUS line. Scroll through this section by positioning the cursor anywhere on the screen outside the keep window. An arrow indicates the current statement.
5. The contents of other data items can be checked by using the PEEK primary command. Type PEEK dTaxRate in the COMMAND field and press Enter. Code Debug CICS will transfer to the Variable Storage screen (2.3) with the contents of dTaxRate positioned to the top of the screen as shown in following figure.
Variable Storage Screen (2.3) Accessed with PEEK Command
COMMAND ===> SCROLL ===> CSR
MODULE: CWDEMC CSECT: CWDEMC COMPILED: 29 JUN 2005 - 10:46:24
Scope: BLOCK0
LV ----- C VARIABLE -------------- -- ATTRIBUTES -- ----+---10----+---2--->
dTaxRate decimal +150
dGrossPay decimal +0
dYTDPay decimal +0
dGrossTax decimal +0
dYTDTax decimal +0
chConvertBuffer char[16] ???
ErrorMsg void Function-Parameter List
pszErrorText char * << Out of scope >>
ErrorMsg void Function-Local Variables
sErrorTextLength short int << Out of scope >>
Cleanup void Function-Parameter List
%NONAME void << Optimized out >>
**END**
6. Press PF3 (END) to return to the Source Listing screen (2.L).
7. Note the value of dHoursWorked. The bad data in this field (denoted by ???) is causing the ASRA. To change it, position the cursor on the bad data, type 040, and press Enter.
8. Press PF9 (GO 1) to execute one statement. Notice that the values of the data fields in the keep window change (following figure).
After GO 1 on the Source Listing Screen (2.L)
COMMAND ===> SCROLL ===> CSR
MODULE: CWDEMC ****** STATEMENT 010344 EXECUTED STEP=00001 *******
LV ----- C VARIABLE KEEPS -------- -- ATTRIBUTES -- ----+---10----+---20--->
dGrossTax decimal +0
dGrossPay decimal +21000
dTaxRate decimal +150
**END**
------ ----------------------------------------------- Before CWDEMC.10346 ->
010342 850 383 | dTaxRate = pPayrollParms -> dTaxRate;
010343 851 |
010344 852 384 | dGrossPay = dHoursWorked * dHourlyRate;
010345 853 |
=====> 854 385 | dGrossTax = dGrossPay * dTaxRate;
010347 855 |
010348 856 386 | memset ( chConvertBuffer, Null, sizeof (chConvertBuffer)
010348 856 386 + __memset(chConvertBuffer,'\0',sizeof (chConvertBuffer));
010349 857 |
010350 858 | memcpy ( chConvertBuffer,
010350 858 +
010351 859 | WsPayrollWorkArea.YearToDatePay,
010352 860 387 | sizeof (WsPayrollWorkArea.YearToDatePay) );
9. Press PF12 (GO), which continues the test. If any other abends occur, Code Debug CICS intercepts them. Otherwise, the transaction completes, and the Demonstration Transaction screen appears as shown in following figure.
Demonstration Transaction Screen
Demonstration Transaction (C)
Employee Number: 00001
Employee Name: Mr. David Abend
Hours Worked: 40
Hourly Rate: 5.25
Gross Pay: 210.00
*** Transaction XCCC complete ***
10. Remember to end the session as described in Exiting Code Debug CICS and Ending a Debugging Session.
In this example, an ASRA occurred because dHoursWorked contained bad data. In the next example, we will find out how the bad data got there.