Space announcement This documentation space provides the same content as before, but the organization of the content has changed. The content is now organized based on logical branches instead of legacy book titles. We hope that the new structure will help you quickly find the content that you need.

Testing without breakpoints (Code Debug CICS COBOL)


  1. 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 (XPED/XPRT). 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 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. On a blank CICS screen, type XCB2 and press Enter. The Demonstration Transaction screen appears as shown in following figure.

    Demonstration Transaction Screen

    XCB2 _____ - ENTER EMPLOYEE NUMBER                                         C123

      *** COMPUWARE CORPORATION ***
        DEMONSTRATION TRANSACTION

      ENTER DESIRED EMPLOYEE ABOVE:
      00001 - CAUSES ASRA ABEND
      00002 - CAUSES AEIM (AND OTHER ABENDS)
      00003 - CAUSES A WRITE TO TEMPORARY STORAGE
      00004 - STARTS UP XCB2 AS AN ASYNCHRONOUS TASK
      00005 - USED TO SHOW MULTIPLE CSECT SUPPORT
      00333 - CAUSES A STORAGE VIOLATION OF A SAA
      00999 - ENDS NORMAL
  4. To cause an ASRA abend, type 00001 and press Enter. The CWDEMCB2 demonstration 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.

    Important

    The line numbers shown in this guide may vary from those seen during actual program execution. The source for the EXEC CICS commands may also appear different depending on the use of the CICS integrated translator.

    Source Listing Screen (2.L) Showing an ASRA

     -------------------------------- SOURCE LISTING (2.L) --------------------C024
    COMMAND ===>                                                   SCROLL ===> CSR
    MODULE: CWDEMCB2 CSECT: CWDEMCB2          COMPILED: 09 JUN 2005 - 11.23.01
       LV ---- COBOL DATANAME KEEPS ---- -- ATTRIBUTES -- ----+---10----+---20--->
       77 CURR-PAY                       9(5)V99 NUM-DIS  0000000
       02 WA-HOURS                       999 NUM-DIS      $$$
       02 WA-RATE                        9(3)V99 NUM-DIS  00950
       **END**

    ------   ----------------------------- ASRA (DATA EXCEPTION) at CWDEMCB2.423 ->
    000418                         MOVE '*** EMPLOYEE NOT ON FILE ****' TO PAYPROMP
    000419                         GO TO 600-SEND-PAY-MAP.
    000420
    000421                     300-EMPLOYEE-PAY-RTN.
    000422                         IF WA-TYPE EQUAL 'N' OR 'I' OR 'S'
    =====>           1                  COMPUTE CURR-PAY   EQUAL WA-HOURS * WA-RATE
    000424           1                  COMPUTE CURR-TAXES EQUAL CURR-PAY * WA-TAX-
    000425           1                  ADD CURR-PAY   TO WA-YTD-GRS
    000426           1                  ADD CURR-TAXES TO WA-YTD-TAX.
    000427
    000428                         IF PAYEMP1 EQUAL '00001'
    000429           1                  MOVE WORK-AREA TO PAYROLL-DATA-EMP001.
    000430
    000431                         IF PAYEMP1 EQUAL '00999'

    The module and CSECT names and the compile date and time of the executing program are displayed at the top of the screen. The keep window appears next. All data items from the current statement automatically appear in the window.
    You can scroll this window by positioning the cursor in it and using PF keys to scroll up and down, left and right.
    The status line is displayed after the keep window. The displayed message indicates that an ASRA abend, caused by a data exception, has been intercepted at statement 423 in CWDEMCB2.
    The source code follows the status line. You can scroll through this section by positioning the cursor anywhere on the screen outside the keep window. An arrow in the statement number field indicates the current statement where execution is paused.

  5. 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 Working Storage screen (2.3) with the contents of WA-TAX-RAT positioned to the top of the screen as shown in following figure.


    Working Storage Screen (2.3) Accessed with PEEK Command

     --------------------------------- WORKING STORAGE (2.3) ------------------C024
    COMMAND ===>                                                   SCROLL ===> CSR
     MODULE: CWDEMCB2 CSECT: CWDEMCB2          COMPILED: 09 JUN 2005 - 11.23.01


        LV ---- COBOL DATANAME ---------- -- ATTRIBUTES -- ----+---10----+---20--->
       02 WA-TAX-RAT                     9(3)V9 NUM-DIS   0200
       02 WA-YTD-GRS                     S9(5)V99 NUM-DIS +1500000
       02 WA-YTD-TAX                     S9(5)V99 NUM-DIS +0300000
       02 WA-HOURS                       999 NUM-DIS      $$$
       02 WA-MSG                         X(26)
       01 VSAM-EMP-RECORD                GROUP
       02 EMP-NUM-KEY                    X(5)             .....
       02 EMP-NAME                       X(15)            ...............
       02 EMP-HOURS                      999 NUM-DIS      ...
       02 EMP-TOTPAY                     9(5)V99 NUM-DIS  .......
       02 FILLER                         X(50)            ........................
       01 EMP-RECORD-TABLE               GROUP
       02 EMP-RECORD-TBL                 GROUP
        OCCURS 5 TIMES                                     1
       03 EMP-NUM-KEY-TBL                X(5)             .....
        OCCURS 5 TIMES                                     1
       03 EMP-NAME-TBL                   X(15)            ...............
        OCCURS 5 TIMES                                     1
  6. Press PF3 (END) to return to the Source Listing screen (2.L).

  7. 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.
  8. Press PF9 (GO 1) to execute one line of code. Notice that the values of the data fields in the keep window change as shown in following figure.
    After GO 1 on the Source Listing Screen (2.L)

    ----------------------------------- SOURCE LISTING (2.L) ------------------C024
    COMMAND ===>                                                   SCROLL ===> CSR
    MODULE: CWDEMCB2    ****** STATEMENT 000423 EXECUTED         STEP=00001 *******
       LV ---- COBOL DATANAME KEEPS ---- -- ATTRIBUTES -- ----+---10----+---20--->
    *  77 CURR-PAY                       9(5)V99 NUM-DIS  0038000
       77 CURR-TAXES                     9(5)V99 NUM-DIS  0000000
       02 WA-TAX-RAT                     9(3)V9 NUM-DIS   0200
       **END**

    ------   ----------------------------------------------- Before CWDEMCB2.424 ->
    000418                         MOVE '*** EMPLOYEE NOT ON FILE ****' TO PAYPROMP
    000419                         GO TO 600-SEND-PAY-MAP.
    000420
    000421                     300-EMPLOYEE-PAY-RTN.
    000422                         IF WA-TYPE EQUAL 'N' OR 'I' OR 'S'
    000423           1                  COMPUTE CURR-PAY   EQUAL WA-HOURS * WA-RATE
    =====>           1                  COMPUTE CURR-TAXES EQUAL CURR-PAY * WA-TAX-
    000425           1                  ADD CURR-PAY   TO WA-YTD-GRS
    000426           1                  ADD CURR-TAXES TO WA-YTD-TAX.
    000427
    000428                         IF PAYEMP1 EQUAL '00001'
    000429           1                  MOVE WORK-AREA TO PAYROLL-DATA-EMP001.
    000430
    000431                         IF PAYEMP1 EQUAL '00999'
  9. Press PF12 (GO) to continue the test. If any other abends occur, Code Debug CICS will intercept them. Otherwise, the transaction completes, and the Demonstration Transaction screen appears as shown in 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 ***
  10. Remember to end the session as described in Exiting Code Debug CICS and Ending a Debugging Session.
    In the example just completed, an ASRA occurred because WA-HOURS contained bad data. In the next example, we will find out how the bad data got there.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*