COBOL Explorer example

The following is an example of how to use the COBOL Explorer feature of Fault Analyzer.

A fault entry for an abend in a COBOL program is analyzed interactively using the 'I' line command from the Fault Entry List display. The "Event Summary" is selected, and from there the COBOL program event is selected, resulting in the "Event Details" display shown in Sample COBOL Explorer Event Details display.

Figure 1. Sample COBOL Explorer Event Details display
  File  View  Services  Help
───────────────────────────────────────────────────────────────────────────────
Event 1 of 1: Abend S0CB *** Point of Failure ***              Line 1 Col 1 80
Command ===> ________________________________________________ Scroll ===> CSR 
JOBNAME: COBPERF6  SYSTEM ABEND: 0CF            FAE1      2019/07/21  16


Abend Code. . . . . . . . . : S0CB
Program-Interruption Code . : 000B (Decimal-Divide Exception)
  The divisor was zero in a signed decimal division.

The source code below was executed via the following sequence of PERFORM
statements:
  Source
  Line #
  000105             PERFORM READ-FILE UNTIL END-OF-FILE = '1'.
  000122               NOT AT END PERFORM PROCESS-VEHICLE 
  000133                 PERFORM PROCESS-CAR  
  000151               PERFORM CALC-TAX.

COBOL Source Code:
  Source
  Line #
  000175               COMPUTE BASE-AMOUNT = PRICE / CC       

Data Field Declarations:
  Source
  Line #
  000033            03 PRICE             PIC 9(6).   
  000049                  07 CC          PIC 9(4).    
  000094         01 BASE-AMOUNT          PIC 9(3)V99 COMP-3.   

Data Field Values:
  BASE-AMOUNT = 0.00  
  CC          = 0  *** Cause of error *** 
  PRICE       = 50000   

COBOL Explorer  ❶
  
The listing file used for the above was found in
MY.LISTING.COBOL(COBPERF6).

⋮

By selecting the "COBOL Explorer" point-and-shoot field shown at ❶, the "Source Line and Data Values" display in Sample COBOL Explorer Source Line and Data Values display is shown.

Figure 2. Sample COBOL Explorer Source Line and Data Values display
Source Line and Data Values                                Line 1 Col 1 76
Command ===> ________________________________________________ Scroll ===> CSR 
                                                                          
                                                                          
Source:                                                                   
  000175             COMPUTE BASE-AMOUNT = PRICE / CC                     
                                                                          
Data Field Declarations:                                                  
  000033          03 PRICE             PIC 9(6).                          
  000049                07 CC          PIC 9(4).                          
  000094       01 BASE-AMOUNT          PIC 9(3)V99 COMP-3.                
                                                                          
Data Field Values:                                                        
s BASE-AMOUNT = 0.00                                                      
s CC          = 0  *** Cause of error ***  ❷
s PRICE       = 50000                                                     
                                                                          
                                                                          
Select data fields to use with source line to create view.                
                                                                          
*** Bottom of data.                                                       

Because the data field "CC" at ❷ has been identified as the cause of the error (divide by zero), we want to look at this data field more closely. To do this, unselect the other two data fields ("BASE-AMOUNT" and "PRICE") by over-typing with blanks, and press Enter. The result is the display shown in Sample COBOL Explorer Debug View display.

Figure 3. Sample COBOL Explorer Debug View display
  File  View  Services  Help
───────────────────────────────────────────────────────────────────────────────
Exploring COBOL Program COBEX1                                 Line 1 Col 1 80
Command ===> ________________________________________________ Scroll ===> CSR 
JOBNAME: COBEX1    SYSTEM ABEND: 0CB            FAE1      2019/04/14  20:40:31
+ Expand all / - Collapse all    - Comments  + Level 88  - Redefines          
                                                                              
+ 000001 IDENTIFICATION DIVISION.                                             
+ 000003 ENVIRONMENT DIVISION.                                                
+ 000011 FILE SECTION.                                                        
+ 000017 WORKING-STORAGE SECTION.                                             
+ 000026 01 VEHICLE-RECORD.                                                   
  000038    03 SPECIFICATION.                                                 
  000042       05 ENGINE.                                                     
  000049          07 CC          PIC 9(4).                                    
+ 000081 01 HEADINGS REDEFINES VEHICLE-RECORD.                                
+ 000084 01 WS-REC REDEFINES VEHICLE-RECORD.                                  
+ 000098 LINKAGE SECTION.                                                     
+ 000101 PROCEDURE DIVISION USING PARMS.                                      
  000105     PERFORM READ-FILE UNTIL END-OF-FILE = '1'.                       
+ 000119 READ-FILE.                                                           
  000122       NOT AT END PERFORM PROCESS-VEHICLE                             
+ 000125 PROCESS-VEHICLE.                                                     
  000126     MOVE FS-REC TO WS-REC.
  000133         PERFORM PROCESS-CAR               
+ 000149 PROCESS-CAR.                              
  000151       PERFORM CALC-TAX.                   
+ 000173 CALC-TAX.                                 
  000175       COMPUTE BASE-AMOUNT = PRICE / CC
  000178       COMPUTE BASE-AMOUNT = CC / CYLINDERS

The above Debug View display consists of a branch-analysis showing how the program got to the source line, and any source lines that reference the selected variable (or variables, if more than one had been selected from the previous Source Line and Data Values display).

This view shows that the abending source line 175 is in procedure CALC_TAX, and the branch analysis reveals the execution path to the source line.

In addition to selected variables, any references to containing group items or redefines are also shown. Any source lines that modify a reference are highlighted (often these are used to create a new view as variables that modify referenced variables might be of particular interest, use PF10/PF11 to scroll views).

You can select the following by placing the cursor on the appropriate line and pressing Enter (or just double-click, if you have selected the "Fnn" and "ENTER at cursor position" Personal Communications options available through Settings > Hotspots):

  • Select any highlighted source line to create a new view.
  • Select a DATA DIVISION section (for example, WORKING-STORAGE SECTION) to invoke the Associated Storage Areas display for that section (this shows all variables and their values). The FILE SECTION also allows you to edit/browse/view open files with ISPF or File Manager.
  • Select a data item to show all references to it and the section/paragraph in which the reference occurs. For group items and group members, an aggregate map is also shown.
  • Select a procedure name to show all branches to it and the procedure in which the branch occurs.
  • Select an executable source line to show the value of its variables and optionally create a new view for that source line and selected variables. If the source line is a branch (for example, PERFORM, GO TO), the target procedure is expanded (subsequent collapse returns to the branch statement).
  • Select an MQI call (MQOPEN/MQGET/MQPUT/MQCLOSE) to edit/browse the queue or list queue managers with File Manager WebSphere® MQ.

Section Expand/Collapse, by means of placing the cursor on the '+' or '-' signs on the left of the display and pressing Enter, is used to explore the program. Sections comprise FILE SECTION, WORKING-STORAGE SECTION and so on, plus any sections and paragraphs in the PROCEDURE DIVISION.

DATA DIVISION level 01 group items are initially collapsed. These can be expanded to show group members.

Expand the PROCEDURE DIVISION to reveal all procedures. These can then be expanded individually to show source.

Global Expand/Collapse, by means of placing the cursor on the '+' or '-' signs at the top of the display and pressing Enter, provides more filtering of the source program:
  • "Expand all" expands all sections and group items. (Note that this causes all source records to be searched when using the Find command.)
  • "Collapse all" restores the view's initial display.
  • "Comments" expands or collapses comment lines.
  • "Level 88" expands or collapses level 88 items showing only the high-level item when collapsed.
  • "Redefines" expands or collapses REDEFINES showing only the high-level item when collapsed.

View the video introducing COBOL Explorer at https://www.youtube.com/watch?v=ZXwsaBnfk2Q.