Tuesday, December 13, 2011

COBOL: Find out the COBOL statement causing the S0C4 , S0C7 or any abends

When a COBOL program abends, it produces a message something like the below one in the SYSOUT.

   Display  Filter  View  Print  Options  Search  Help                         
 -------------------------------------------------------------------------------
 SDSF OUTPUT DISPLAY TSXXXGRP J0018447  DSID   102 LINE 61      COLUMNS 02- 81 
 COMMAND INPUT ===>                                            SCROLL ===> CSR 
CEE3204S The system detected a protection exception (System Completion Code=0C4).
         From compile unit TESTPRGM at entry point TESTPRGM at compile unit
         offset +00001FBA at entry offset +00001FBA at address 19901FBA.        
<> LEAID ENTERED (LEVEL 08/30/2010 AT 12.37)                                   
<> LEAID PROCESSING COMPLETE. RC=0                                             
******************************** BOTTOM OF DATA ********************************

Take the last 4 characters of offset from the above message. In this case, it is “1FBA”. Go to the compiler listing of the abended program. Now do a find on “1FBA” and the FIND will locate a line with a assembler statement something like the below statement highlighted in yellow. Just prior to the assembler statement you will find a COBOL verb with a statement number. In this case COBOL verb is MOVE and statement number is “006886”

006884  IF                                                                     
   001F8A  D502 300F A586          CLC   15(3,3),1414(10)        INPUT-LOOP-SEGM
   001F90  4770 B1A4               BC    7,420(0,11)             GN=54(001FC0) 
006885  ADD                                                                    
   001F94  F212 D190 20BB          PACK  400(2,13),187(3,2)      TS2=0         
   001F9A  FA10 D190 A5ED          AP    400(2,13),1517(1,10)    TS2=0         
   001FA0  F321 20BB D190          UNPK  187(3,2),400(2,13)      WS-HOLD-K3-NBR
   001FA6  96F0 20BD               OI    189(2),X'F0'            WS-HOLD-K3-NBR+
006886  MOVE                                                                   
   001FAA  F272 D190 20BB          PACK  400(8,13),187(3,2)      TS2=0         
   001FB0  4F40 D190               CVB   4,400(0,13)             TS2=0         
   001FB4  4C40 A042               MH    4,66(0,10)              PGMLIT AT +10 
   001FB8  1A42                    AR    4,2                                   
   001FBA  D266 4C11 3000          MVC   3089(103,4),0(3)        WS-HOLD-K3-REC(    
   001FC0                 GN=54    EQU   *                                     

Take that statement number and go to the beginning of the listing and do a find on that statement number. This will give you the COBOL statement causing the abend.


   Menu  Utilities  Compilers  Help                                            
 sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
 BROWSE    TSUXXXF.TESTPRGM.S5.ES1UN.LISTING          Line 00001383 Col 001 080
 Command ===>                                                  Scroll ===> CSR 
  006884         S48287     IF INPUT-LOOP-SEGMENT-ID(01:03) = 'K3 '            
  006885      1  S48287        ADD 1 TO WS-HOLD-K3-NBR                         
  006886      1  S48287        MOVE INPUT-837-RECORD  TO                       
  006887      1  S48287                           WS-HOLD-K3-REC(WS-HOLD-K3-NBR)
  006888         S48287     END-IF.                                            
  006889         S48287                                                         
  006890         S48287 205-EXIT.                                              
  006891         S48287     EXIT.                                              

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.