Code Coverage with Code Debug CICS
Related Topics
Using Code Coverage with Code Debug CICS is a three-stage process:
Stage 1: Program preparation
During the program preparation step, your programs are set up for Code Coverage collection. In addition to the load module needed to execute any program in CICS, a BMC source listing member and a Code Coverage Program Inventory member are also required.
Running the BMC language processor creates the BMC source listing member. This step is also required to debug a program using source in Code Debug CICS. Creating a source listing member is discussed in greater detail in the Code Debug for CICS User Guide for the language being compiled.
In addition to the load module and source listing, Code Coverage in CICS requires that an entry for the program/load module combination be added to the Code Coverage Program Inventory file. This member is used to provide a correlation between the verbs in a program and the generated machine instructions in the load module. This accelerates Code Coverage collection in CICS. Adding a member to the Program Inventory file is called population and can be accomplished in batch or by using the ISPF Program Inventory Utility.
Code Coverage Process in a CICS Environment
Stage 2: Online data collection
Code Coverage collection in CICS is a four-stage process:
- Define the test criteria
- Start the Code Coverage data collection
- Execute the CICS transactions
- Halt the Code Coverage collection.
Define the Code Coverage test
The Code Coverage test name is defined using the following screen. The test name is comprised of a system name and a test identifier.
Test Definition Screen
COMMAND ===> SCROLL ===> CSR
Userid: CFHRCB0
Entry 0 of 0
Available Commands are highlighted:
(S) Specify Collection (H) Halt Collection (V) View Collection Activity
(SC) Start Code Coverage (SF) Start System Flow (SB) Start Both
(E) Extract Entry (ES) Extract System Next Full Extract: 17:09:35
(D) Delete Entry (DS) Delete System Current Time: 16:49:09
(B) Browse (A) Archive
Code System
CMD System Name Test Identifier Owner Status Coverage Flow
---- *************** *************** ******** -----------------------------
__ _______________ _______________
__ _______________ _______________
__ _______________ _______________
__ _______________ _______________
__ _______________ _______________
__ _______________ _______________
__ _______________ _______________
__ _______________ _______________
__ _______________ _______________
__ _______________ _______________
PF1 Help PF3 End Extract All (Y/N): N
The following screen is used to specify which users, transactions, programs, and CSECTs should be collected during the Code Coverage test. This screen can also optionally be used to validate that all required elements (Program Inventory member, load module/program, and source listing) are available within CICS before running the Code Coverage collection. The status of the test on the Test Definition screen will be shown as Available after definition and before starting the test.
Test Definition/Collection Specification Screen
COMMAND ===>
Userid: ACMJET0
System Name: PAYROLL Testid: ACCOUNTING Owner: ACMJET0
Status: Available User added
Available Line Commands: (D) Delete (V) Validate
------------------------- Include ------------------- | -------- Exclude --------
CMD User CMD User CMD User CMD User | CMD User CMD User
U _ ******** _ ________ _ ________ _ ________ | _ CARTMAN _ KENNY
S _ ________ _ ________ _ ________ _ ________ | _ ________ _ ________
E _ ________ _ ________ _ ________ _ ________ | _ ________ _ ________
R _ ________ _ ________ _ ________ _ ________ | _ ________ _ ________
S _ ________ _ ________ _ ________ _ ________ | _ ________ _ ________
_ ________ _ ________ _ ________ _ ________ | _ ________ _ ________
_ ________ _ ________ _ ________ _ ________ | _ ________ _ ________
_ ________ _ ________ _ ________ _ ________ | _ ________ _ ________
_ ________ _ ________ _ ________ _ ________ | _ ________ _ ________
Tran Program CSECT Tran Program CSECT | Tran Program CSECT
M _ **** ******** ******** _ ____ ________ ________ | _ SPIN SOUTH PARK
A _ ____ ________ ________ _ ____ ________ ________ | _ ____ ________ ________
S _ ____ ________ ________ _ ____ ________ ________ | _ ____ ________ ________
K _ ____ ________ ________ _ ____ ________ ________ | _ ____ ________ ________
S _ ____ ________ ________ _ ____ ________ ________ | _ ____ ________ ________
PF1 HELP PF3 EXIT PF4 Validate All
Start the test
Enter the SC line command on the Test Definition screen to start Code Coverage collection. The status of the test on the Test Definition screen as shown above is then shown as Collecting.
Execute the CICS transactions
In this stage, the user runs the transactions that will cause the programs specified on the Test Definition/Collection Specification screen to be executed. Code Coverage keeps track of what parts of each program are executed. When all the transactions/programs have been run, Code Coverage collection can be halted.
Halt the Code Coverage collection
Return to the Test Definition screen to halt the collection. After entering the H (Halt Collection) line command, the status of the test on the Test Definition screen will initially be shown as Quiescing, and then change to Available. A message will be displayed indicating that data extraction is complete. This means that the Code Coverage data has been written from CICS storage to the Code Coverage extract file. At this point (by default), a batch job will be submitted that will write the Code Coverage data from the CICS extract file to the Code Coverage repository. The process of writing the Code Coverage data from the CICS extract file to the Code Coverage repository is known as hardening.
Stage 3: Reporting
After the Code Coverage data has been written to the repository, it can be reported on. On the mainframe, reporting is done using the ISPF Code Coverage reporting screen. This process is described in Generating Code Coverage Reports.
Before Code Coverage can be used under Code Debug CICS, several considerations must be taken into account:
- A Program Inventory file must be created. This is normally done during Code Coverage installation.
- The Program Inventory file must be populated with the names of all the programs for which you want to collect data. You can use COLLECT control statements from within the Populater to designate specific programs for Code Coverage monitoring, or use the Program Inventory Utility to select covered programs. For more information, see to CICS Populater and Program Inventory Utility.
- You must ensure the value of the Code Debug CICSglobal parameter ACTIVATE_CODE_COVERAGE_AT_INITIALIZATION is set to YES (the default).
- You must ensure the value of the Code Debug CICSCode Coverage global parameters TRANSID_XVCC and TRANSID_XVSC match the transaction codes which default to XVCC and XVSC.
- You must ensure the load library containing Code Debug CICS has been added to the DFHRPL concatenation. This loadlib is provided as CPWR.cMXDnnn.SMXDOxxL.
- You must ensure the load library containing Code Coverage has been added to the DFHRPL concatenation. CPWR.MLXV170.SLXVLOAD is the default name for this LOADLIB.
- You must ensure a DD statement for the Code Coverage Program Inventory data set XVTPGINV has been added to your site's startup JCL. Do not define this file with RDO.
- You must create an Extract data set (XVTCEXTR) for the intermediary Code Coverage data.
- Optionally, you can create a JCL Template data set (XVTCEXTJ) that contains the JCL to write the intermediary Code Coverage data to the Code Coverage repository.
- Optionally, you can create a Save Specifications data set (XVTCSPEC) to provide an archive for Code Coverage test definitions.
This section explains how to use Code Coverage with Code Debug CICS and includes the following sections: