Testing without Breakpoints (Code Debug CICS PL/I)
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 the 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)
------------BMC AMI DevX Code Debug for CICS 17.02.00 PRIMARY MENU --------C024
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's 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 NoticeCode Debug CICS is now turned on and ready to intercept any abends that may occur.
- To turn on the trace facility, type SET TRACE ON on the COMMAND line and press Enter.
- Press Clear to return to CICS to start your test.
Type XPLE and press Enter. The Demonstration Transaction screen appears as shown in the following figure.
Demonstration Transaction Screen
XPLE _____ - ENTER EMPLOYEE NUMBER C123
*** COMPUWARE CORPORATION ***
DEMONSTRATION TRANSACTION (PL/1)
ENTER DESIRED EMPLOYEE ABOVE:
00001 - CAUSES ASRA ABEND (DATA EXCEPTION)
00002 - CAUSES AEIM (DSIDERROR)
00003 - CAUSES A WRITE TO TEMPORARY STORAGE
00004 - STARTS UP XPLE AS AN ASYNCHRONOUS TASK
00005 - USED TO SHOW MULTIPLE CSECT SUPPORT
00333 - CAUSES A STORAGE VIOLATION OF A SAA
00999 - ENDS NORMALLYTo cause an ASRA abend, type 00001 and press Enter. The CWDEMPE demo program is intercepted when the abend occurs, and the Source Listing screen (2.L) is displayed as shown in the 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
-------------------------------- SOURCE LISTING (2.L) --------------------C024
COMMAND ===> SCROLL ===> CSR
MODULE: CWDEMPE CSECT: CWDEMPE COMPILED: 11 AUG 2006 - 10:51:01
LV ---- PL/I VARIABLE KEEPS ----- -- ATTRIBUTES -- ----+---10----+---20--->
CURR_PAY FIXED DEC(7,2) 0.00
02 WA_HOURS PIC'999' $$$
02 WA_RATE FIXED DEC(5,2) 9.50
**END**
------ ------------------------------ ASRA (DATA EXCEPTION) at CWDEMPE.842 ->
000839 SELECT(WA_TYPE);
000840 WHEN('N','I','S')
000841 DO;
=====> CURR_PAY = WA_HOURS * WA_RATE ;
000843 CURR_TAXES = CURR_PAY * WA_TAX_RAT ;
000844 WA_YTD_GRS = CURR_PAY + WA_YTD_GRS ;
000845 WA_YTD_TAX = CURR_TAXES + WA_YTD_TAX ;
000846 END ;
000847 OTHERWISE;
000848 END;
000849
000850 L400_TRANSACTION_COMPLETE:
000851
000852 EMPNUMB = PAYEMP1 ;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 842 in CWDEMPE.
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.
The contents of other data items can be checked by using the PEEK primary command. Type PEEK WA_TAX_RAT in the COMMAND field and press Enter. Code Debug CICS will transfer to the Variable Storage screen (2.3) with the contents of WA_TAX_RAT positioned to the top of the screen as shown in the following figure.
Variable Storage Screen (2.3) Accessed with PEEK Command
------------------------------ VARIABLE STORAGE (2.3) --------------------C024
COMMAND ===> SCROLL ===> CSR
MODULE: CWDEMPE CSECT: CWDEMPE COMPILED: 11 AUG 2006 - 10:51:01
PROCEDURE: CWDEMPE
LV ---- PL/I VARIABLE ----------- -- ATTRIBUTES -- ----+---10----+---20--->
02 WA_TAX_RAT FIXED DEC(4,1) 0.2
02 WA_YTD_GRS FIXED DEC(7,2) 15000.00
02 WA_YTD_TAX FIXED DEC(7,2) 3000.00
02 WA_HOURS PIC'999' $$$
02 WA_MSG CHAR(26)
WA_PTR PTR ALIGN 'X 0010941C
01 VSAM_EMP_RECORD GROUP
02 EMP_NUM_KEY CHAR(5)
02 EMP_NAME CHAR(15)
02 EMP_HOURS PIC'ZZZ'
02 EMP_TOTPAY PIC'ZZZZZVZZ'
02 FILLER CHAR(50)
01 EMP_RECORD_TABLE GROUP ....
02 EMP_RECORD_TBL GROUP ....
BOUNDS(5) 1
03 EMP_NUM_KEY_TBL CHAR(5)
BOUNDS(5) 1
03 EMP_NAME_TBL CHAR(15)- Press PF3 (END) to return to the Source Listing screen (2.L).
- Note the value of WA_HOURS. The bad data ($$$) in this field is causing the ASRA. To change it, position the cursor on the bad data, type 040, and press Enter.
Press PF9 (GO 1) to execute one statement. Notice that the values of the data fields in the keep window change.
After GO 1 on the Source Listing Screen (2.L)
------------------------------- SOURCE LISTING (2.L) ----------------------C024
COMMAND ===> SCROLL ===> CSR
MODULE: CWDEMPE ****** STATEMENT 000842 EXECUTED STEP=00001 *******
LV ---- PL/I VARIABLE KEEPS ----- -- ATTRIBUTES -- ----+---10----+---20--->
* CURR_PAY FIXED DEC(7,2) 380.00
CURR_TAXES FIXED DEC(7,2) 0.00
02 WA_TAX_RAT FIXED DEC(4,1) 0.2
**END**
------ ------------------------------------------------ Before CWDEMPE.843 ->
000839 SELECT(WA_TYPE);
000840 WHEN('N','I','S')
000841 DO;
000842 CURR_PAY = WA_HOURS * WA_RATE ;
=====> CURR_TAXES = CURR_PAY * WA_TAX_RAT ;
000844 WA_YTD_GRS = CURR_PAY + WA_YTD_GRS ;
000845 WA_YTD_TAX = CURR_TAXES + WA_YTD_TAX ;
000846 END ;
000847 OTHERWISE;
000848 END;
000849
000850 L400_TRANSACTION_COMPLETE:
000851
000852 EMPNUMB = PAYEMP1 ;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 the following figure.
Demonstration Transaction Screen
*** COMPUWARE CORPORATION *** C123
DEMONSTRATION TRANSACTION
EMPLOYEE NUMBER: 00001
EMPLOYEE NAME: MR. DAVID ABEND
HOURS WORKED: 040
HOURLY RATE: 9.50
GROSS PAY: 380.00
*** TRANSACTION COMPLETE ***- Remember to end the session as described in Exiting Code DebugCICS and Ending a Debugging Session for PLI.
In this example, an ASRA occurred because WA_HOURS contained bad data. In the next example, we will find out how the bad data got there.