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.

Handling run-time errors for C


Code Debug TSO intercepts program abends and prevents the system from producing a dump.

When an abend occurs in a program for which the source is available, execution automatically pauses, the execution arrow points to the offending statement, and a message indicating the action to take is displayed.

The following figure is an example of Code Debug TSO responding to an abend.

Intercepting an Abend

--------------------------- CODE DEBUG TSO - SOURCE --------------------------
COMMAND ===>                                                  SCROLL ===> CSR
  S0C4 ABEND ENCOUNTERED, USE "AA SNAP" COMMAND FOR ADDITIONAL INFORMATION
000134      triangle_type                   > +0                      FULLWORD
000041      tarray[triangle_type-1].tricnt  >                           NO ADDR
        ** END **

------   ------------------------------ SOC4 Abend at TRIMAINC:142/AMODE 31 <>
000139         if (bytesread == 80)  /* fread success */
000140            {
000141             triangle_type = tritstc(&work_rec);
000142             tarray??(triangle_type-1??).tricnt++;
=====>             tarray[triangle_type-1].tricnt++;
000143             return('n');
000144            }
000145            else    /* fread() failed */
000146            {
000147             if ( feof(stream))       /* possibility 2 */
000148                {
000149                 return('Y');
000150                }
000151                else
000152                {

Important

When an abend occurs in a program that has not been compiled with the CSS C language processor (no source listing is available), the session log is automatically displayed with a message indicating the action to take. For example:

ABEND IN MODULE WITHOUT SOURCE USE AA SNAP COMMAND FOR MORE INFORMATION

To assist you in determining the cause of the abend and how to correct the problem, Code Debug TSO provides the following:

  • Enter AA SNAP to display an Abend-AID Snapshot report.

Important

In order to properly view the Snapshot report, the Abend-AID product must have been installed with LANGTYP=USAUC in the GLOBAL table. See Task 14.9 Modify Batch Global Options in the Abend-AID Advanced Configuration space for additional information.

  • Use the LOG command to display the diagnostic summary contained in the session log.
  • Use the HELP command to display help information about the abend.
  • Use debugging commands to investigate the cause of the abend.

Viewing the session log

Code Debug TSO records the cause of the abend, the exact location, and a diagnostic summary in the session log. To look at the session log, enter LOG on the command line of the Source display screen.

Important

If you have Abend-AID installed at your site, you can also display the session log from the Snapshot report.

An example of the diagnostic summary in the session log is shown in the following figure.

Diagnostic Summary in the Session Log

-------------------------- CODE DEBUG TSO - LOG ---------------------------------
COMMAND ===>                                                  SCROLL ===> CSR
PROGRAM: TRIMAINC   MODULE: TRIMAINC COMP DATE:  08/31/2000 COMP TIME:14:31:30
--------------------------------------- SOC4 Abend at TRIMAINC:142/AMODE 31 ->
  go
XPD0439 RA105      S0C4 ABEND AT 105C694E  REASON CODE 00000004

    PSW AT TIME OF ERROR  078D1400 - 905C694E
    DATA AT PSW - 06204C20  30E25802  10184A00
    GP REGISTERS AT ABEND   0 00000004   1 00142280   2 1BFFFFC8   3 105C68D2
                            4 801118F4   5 105C69E8   6 001349C8   7 105C6BC8
                            8 00000001   9 80000000  10 90949A22  11 80111810
                           12 00135A38  13 001422F8  14 905C693A  15 00000004
    AR REGISTERS AT ABEND   0 00F46600   1 00000000   2 00000000   3 00000000
                            4 00000000   5 00000000   6 00000000   7 00000000
                            8 00000000   9 00000000  10 00000000  11 00000000
                           12 00000000  13 00000000  14 00000000  15 00000000
    INTERRUPT ADDRESS AT OFFSET 0004F6 IN LOAD MODULE TRIMAINC

*** S0C4    ABEND IN USER MODULE TRIMAINC  AT STATE 000142 AT OFFSET 000468
*** ACTIVE APPLICATION MODULE AT TIME OF ABNORMAL TERMINATION IS TRIMAINC ***

*** LAST INTERCEPTED CALL BY MODULE TRIMAINC PRIOR TO TERMINATION WAS MADE TO
   MODULE TRITSTC  BEFORE STATE 000141 IN PROC analyze_next_rec

*** APPLICATION MODULE CONTROL HIERARCHY AT TIME OF ABNORMAL TERMINATION ***
LVL     MODULE   ENTRY    MEMBER        RETURN LOCATION FOR MOST RECENT CALL
 1                      CODEDEBG
 2    CEESTART CEESTART TRIMAINC  OFFSET 70080
 3 X  TRIMAINC MAIN     TRIMAINC  STATE 000141 analyze_next_rec
 4    $PRIVATE TRITSTC  TRIMAINC  OFFSET 00448
 5    ATOI     ATOI     TRIMAINC

The first part of the diagnostic summary identifies the error message, PSW, data at PSW, general-purpose registers, offset, and the module in which the error occurred.

The last part shows the abend type, module name, statement number, offset, paragraph name, and the failing verb. This information is followed by the module stack that identifies the last call that took place.

If desired, the load modules can also be displayed by entering SHOW MODULES.

Displaying the Abend-AID snapshot report

When an abend occurs in your program during a Code Debug TSO test session, you can display an Abend-AID Snapshot report. This report contains context sensitive diagnostic information. (The report will not contain source support.)

In a non-abending situation, you can request the Snapshot report to display environment specific run-time characteristics and subsystem-related debugging information for VSAM, IDMS, IMS, and Db2 (if you have these Abend-AID options). See the Displaying Environmental Data for more information.

To display the Snapshot report, enter AA SNAP on the command line of any run-time screen. The Snapshot report is formatted according to your terminal size (80 or 133) and written to a temporary data set DD called ABENDAID.

Important

If you want to save the abend information for printing, you must allocate the ABENDAID DD to a permanent data set. This data set must be RECFM=VBA and LRECL=133.

The following figure shows the header page of the Snapshot report:

Abend-AID Snapshot Report Header

|                                                                                
|----------------------- CODE DEBUG TSO - BROWSE -----------------------------   
|  COMMAND ===>                                                  SCROLL ===> C   
|  PROGRAM: TRITST     MODULE: TRIMAIN   COMP DATE: 08/23/95  COMP TIME: 18:05   
|  ---------------------------------------------------S0C7  Abend at TRITST:18   
|  SYS95054.T181542.RA000.FLGDAA1.R0134656                dd ABENDAID  line 00   
| ********************************* TOP OF DATA ******************************   
|1                              A B E N D - A I D                      PAGE 1    
|                                                                                
|    MONDAY   16 APR 2023                  H17.02.00             R17.02.00    
|    ***********************************************************************     
|    *              A b e n d - A I D   D i a g n o s t i c s              *     
|    ***********************************************************************     
|    Copyright (C) 1976, 2023, BMC CorporationUnpublished.                    
|    Rights Reserved Under The Copyright Laws Of The United States.              
|                                                                                
|    Licensed for use at: XXXXXX                                                 
|    YOUR COMPANY NAME                                                           
|                                                                                
|    Online Technical Support available athttps://support.bmc.com             
|                                                                                
|    JESID - T0883121       OPSYS     - z/OS   2.4.0       Model   - 8562        
|    Job   - FLGDAA1        DFSMS/MVS - V2R4M0             CP FMID - HBB77C0    
|    Step  - TSOPROC        JES2      - z/OS 2.4           System  - LPAR     
|    Time  - 09.02.27                                                         
+-----------------------------------------------------------------------------

Optionally, you can display a column template at the top of the report by using SET COLS ON. The column template can be useful when viewing records or data. Enter SET COLS OFF (the default) to turn off the column template.

Browsing the snapshot report

The Snapshot report can be browsed using the PF8 (DOWN) and PF7 (UP) keys. You can also bypass the header page and go directly to a specific section of the Snapshot report from the source display. For example, to go directly to the Diagnostic Section, you can enter the following: AA SNAP; FIND 'DIAGNOSTIC'

The Diagnostic Section of the Snapshot report is displayed on the following page, as shown in the following figure.

Snapshot Report Diagnostic Section

-------------------------- CODE DEBUG TSO - BROWSE ---------------------------
COMMAND ===>                                                  SCROLL ===> CSR
                           CHARS 'DIAGNOSTIC' FOUND.
--------------------------------------- SOC4 Abend at TRIMAINC:142/AMODE 31 ->
SYS00251.T091929.RA000.USERID1.R0112882                dd ABENDAID line 000024
                       **********************
                       * Diagnostic Section *
                       **********************

        The system completion code of 0C4 is issued when the
        program attempts to use storage that is not accessible.


                 *** List of Probable 0C4 Causes ***

       1.  Missing or incorrect DD statement -
           Check system messages from abending step.

       2.  Tried to read or write an unopened file.

       3.  Tried to reference record area before file opened.

       4.  Indexing or subscripting outside defined limits.

When you have finished viewing the Snapshot report, press PF3 (END) to return to the source display.

If you inadvertently press PF3 (END) while viewing the Snapshot report, you can enter BROWSE ABENDAID on the command line of the source or session log display to redisplay the Snapshot report.

Displaying HELP information

The HELP command can be used to obtain further information to determine the cause and possible resolution of the abend. Any of the most commonly occurring abends (listed as follows) can be entered as a keyword with the HELP command.

SB14 S0C1 S0C7 S031 S806
SB37 S0C4 S001 S106
SD37 S0C5 S013 S213

The following figure displays HELP information for a S0C7 abend.

HELP Information on S0C7
--------------------------- CODE DEBUG TSO - HELP ----------------------------
COMMAND ===>                                                  SCROLL ===> CSR
PROGRAM: TRIMAINC   MODULE: TRIMAINC COMP DATE:  08/31/2000 COMP TIME:14:31:30
--------------------------------------- SOC4 Abend at TRIMAINC:142/AMODE 31 --
********************************* TOP OF DATA **********************************
S0C4


An invalid main storage address was generated.

POSSIBLE CAUSES

1.  Uninitialized index  or a runaway  index due to a program  loop.  (This
   could also cause a S0C7).

2.  An attempt to reference an output area before the data set was opened or
   after it was closed.

3.  An attempt to execute a module with unresolved link-edit references.

4.  The items specified in  the USING lists of the calling  and called pro-
   grams are assumed  by the compiler to be identical in order, data type,
   and field length. Any discrepancy in  this correspondence may result in
   a S0C4.

Analyzing the problem

When an abend occurs, you can use Code Debug TSOdebugging commands to investigate the cause of the abend. For example, you can view the contents of the data referenced on the statement causing the abend, analyze the data flow and control structure, and optionally, review the path and data values that lead to the error.

Applying fixes

Even when Code Debug TSOintercepts an abend, you have the opportunity to temporarily apply fixes to the problem and resume execution as if the abend had never occurred. The GO (PF12) command resumes execution. However, there may be times that you will not be able to continue normal program execution until the abend is resolved.

Using all of the information provided by the Abend-AID Snapshot report, you can experiment with possible solutions and test the fixes.

Obtaining a memory dump

If a dump is necessary, the SET DUMP ON command can be issued immediately to direct Code Debug TSOto allow the dump to be written if one of the standard dump DD files (SYSUDUMP, SYSMDUMP, or SYSABEND) is allocated to the test session. The dump file can be dynamically allocated just prior to the issuance of the SET DUMP ON command or could have been preallocated through various methods such as the File Allocation Utility (FAU), the TSO ALLOCATE command, JCL if in Batch Connect, etc. (See Using the File Allocation Utility.)

 

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