S0C7 Abend error



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

S0C7 Abend error

Postby gowthamgyaa » Tue Nov 06, 2012 12:44 pm

When i run the below code its showing me an s0c7 error, what might be the cause ?
I checked upto my knowledge with respect to s0c7 abend but cant able to get it.


000001         IDENTIFICATION DIVISION.
 000002       * ******THIS IS THE PGM FOR DISPLAYING REC IN TAB.***
 000003       * ****************BOTH DELIVERY INST & GRN*************
 000004         PROGRAM-ID. COBOSS01.
 000005         AUTHOR. GOWTHAM.
 000006         DATE-WRITTEN. 31.10.12.
 000007         DATE-COMPILED. 15.10.12.
 000008         ENVIRONMENT DIVISION.
 000009         CONFIGURATION SECTION.
 000010         SOURCE-COMPUTER. LENOVO.
 000011         OBJECT-COMPUTER. LENOVO.
 000012         DATA DIVISION.
 000013         WORKING-STORAGE SECTION.
 000014         01 MAINHEAD1.
 000015           02 FILLER PIC X(30) VALUE SPACES.
 000016           02 FILLER PIC X(20) VALUE "ABC COMPANY LTD".
 000017           02 FILLER PIC X(30) VALUE SPACES.
 000018         01 MAINHEAD2.
 000019           02 FILLER PIC X(25) VALUE SPACES.
 000020           02 FILLER PIC X(30) VALUE "PURCHASE ORDER ENTRY SYSTEM".
 000021           02 FILLER PIC X(25) VALUE SPACES.
 000022         01 MAINHEAD3.
 000023           02 FILLER PIC X(20) VALUE SPACES.
 000024           02 FILLER PIC X(20) VALUE "DELIVERY INSTRUC".
 000025           02 FILLER PIC X(2) VALUE "&".
 000026           02 FILLER PIC X(20) VALUE "GOODS RECEIPT NOTE".
 000027           02 FILLER PIC X(13) VALUE SPACES.
 000028         01 MAINHEAD4.
 000029           02 FILLER PIC X(60) VALUE SPACES.
 000030           02 C-DATE PIC 99/99/99.
 000031           02 FILLER PIC X(10) VALUE SPACES.
 000032         01 MAINHEAD5.
 000033           02 FILLER PIC X(60) VALUE SPACES.
 000034           02 C-TIME PIC 9(10).
 000035           02 FILLER PIC X(10) VALUE SPACES.
 000036         01 SUBHEAD.
 000037           02 FILLER PIC X(80) VALUE ALL '-'.
 000038         01 SUBHEAD1.
 000039           02 FILLER PIC X(3) VALUE "INO".
 000040           02 FILLER PIC X(2) VALUE SPACES.
 000041           02 FILLER PIC X(3) VALUE "INM".
 000042           02 FILLER PIC X(7) VALUE SPACES.
 000043           02 FILLER PIC X(3) VALUE "TQR".
 000044           02 FILLER PIC X(2) VALUE SPACES.
 000045           02 FILLER PIC X(3) VALUE "RED".
 000046           02 FILLER PIC X(1) VALUE SPACES.
 000047           02 FILLER PIC X(5) VALUE "RMUSN".
 000048           02 FILLER PIC X(2) VALUE SPACES.
 000049           02 FILLER PIC X(5) VALUE "TRMAV".
 000050           02 FILLER PIC X(2) VALUE SPACES.
 000051           02 FILLER PIC X(5) VALUE "RMUD1".
 000052           02 FILLER PIC X(2) VALUE SPACES.
 000053           02 FILLER PIC X(5) VALUE "RMWD1".
 000054           02 FILLER PIC X(2) VALUE SPACES.
 000055           02 FILLER PIC X(5) VALUE "TTRM1".
 000056           02 FILLER PIC X(2) VALUE SPACES.
 000057           02 FILLER PIC X(5) VALUE "NTRMA".
 000058           02 FILLER PIC X(2) VALUE SPACES.
 000059           02 FILLER PIC X(5) VALUE "ITDPD".
 000060           02 FILLER PIC X(2) VALUE SPACES.
 000061           02 FILLER PIC X(5) VALUE "CSPKG".
 000062           02 FILLER PIC X(2) VALUE SPACES.
 000063         01 ABCCOMPLTD.
 000064           02 CRECORDS OCCURS 10 TIMES.
 000065             05 IT-ITEMNO PIC 9(2).
 000066             05 FILLER PIC X(2) VALUE SPACES.
 000067             05 IT-ITEMNAME PIC 9(5).
 000068             05 FILLER PIC X(2) VALUE SPACES.
 000069             05 TQREQ PIC 9(3).
 000070             05 FILLER PIC X(2) VALUE SPACES.
 000071             05 DAYSREMAIN PIC 9(2).
 000072             05 FILLER PIC X(2) VALUE SPACES.
 000073             05 RM-USED PIC 9(2).
 000074             05 FILLER PIC X(2) VALUE SPACES.
 000075             05 TOTRM-AVL PIC 9(3).
 000076             05 FILLER PIC X(2) VALUE SPACES.
 000077             05 RM-USDP1 PIC 9(3).
 000078             05 FILLER PIC X(2) VALUE SPACES.
 000079             05 RM-WSD1 PIC 9(3).
 000080             05 FILLER PIC X(2) VALUE SPACES.
 000081             05 TOT-RM PIC 9(5).
 000082             05 FILLER PIC X(2) VALUE SPACES.
 000083             05 NETRM-ALL PIC 9(5).
 000084             05 FILLER PIC X(2) VALUE SPACES.
 000085             05 IT-DPD PIC 9(3).
 000086             05 FILLER PIC X(2) VALUE SPACES.
 000087             05 STK-MST PIC 9(5)V9(5).
 000088             05 FILLER PIC X(2) VALUE SPACES.
 000089             05 COST-PKG PIC 9(3).
 000090             05 FILLER PIC X(2) VALUE SPACES.
 000091             05 NETCST PIC 9(5).
 000092        77 RIND PIC 9(2) VALUE 1.
 000093        PROCEDURE DIVISION.
 000094        FILLER-PARA.
 000095             DISPLAY MAINHEAD1.
 000096             DISPLAY MAINHEAD2.
 000097             DISPLAY MAINHEAD3.
 000098             ACCEPT C-DATE FROM DATE YYYYMMDD.
 000099             ACCEPT C-TIME FROM TIME.
 000100             DISPLAY "DATE:" MAINHEAD4.
 000101             DISPLAY "TIME:" MAINHEAD5.
 000102             DISPLAY SUBHEAD.
 000103             DISPLAY SUBHEAD1.
 000104             DISPLAY SUBHEAD.
 000105        MAIN-PARA.
 000106             PERFORM VARYING RIND FROM 1 BY 1 UNTIL RIND > 10
 000107             ACCEPT IT-ITEMNO(RIND)
 000108             ACCEPT IT-ITEMNAME(RIND)
 000109             ACCEPT TQREQ(RIND)
 000110             ACCEPT DAYSREMAIN(RIND)
 000111             ACCEPT RM-USED(RIND)
 000112             ACCEPT TOTRM-AVL(RIND)
 000113             ACCEPT RM-USDP1(RIND)
 000114             ACCEPT RM-WSD1(RIND)
 000115             PERFORM TOTRM-PARA
 000116             PERFORM NETRM-PARA
 000117             PERFORM RMDECISION-PARA
 000118             ACCEPT IT-DPD(RIND)
 000119             PERFORM STKMSR-PARA
 000120             PERFORM STKMSRDECISION-PARA
 000121             ACCEPT COST-PKG(RIND)
 000122             PERFORM NETCST-PARA
 000123             DISPLAY CRECORDS(RIND)
 000124            END-PERFORM.
 000125             DISPLAY SUBHEAD.
 000126            STOP RUN.
 000127        TOTRM-PARA.
 000128             COMPUTE TOT-RM(RIND) = RM-USDP1(RIND) + RM-WSD1(RIND).
 000129        NETRM-PARA.
 000130             COMPUTE NETRM-ALL(RIND) = TQREQ(RIND) * TOT-RM(RIND).
 000131        RMDECISION-PARA.
 000132             IF (NETRM-ALL(RIND) > TOTRM-AVL(RIND))
 000133                DISPLAY "STOCK IN DEMAND STOP PROCESS TEMP"
 000134             ELSE
 000135                IF (NETRM-ALL(RIND) = TOTRM-AVL(RIND))
 000136                 DISPLAY "STOCK IS ONLY SUFFICIENT"
 000137                ELSE
 000138                 DISPLAY "STOCK IS EXCESS"
 000139                END-IF
 000140             END-IF.
 000141        STKMSR-PARA.
 000142             COMPUTE STK-MST(RIND) = TQREQ(RIND) / IT-DPD(RIND).
 000143             DISPLAY STK-MST(RIND).
 000144        STKMSRDECISION-PARA.
 000145             IF (STK-MST(RIND) <= DAYSREMAIN(RIND))
 000146                 DISPLAY "OPEN ORDERS FOR DAY2"
 000147             ELSE
 000148                 DISPLAY "CLOSE ORDERS FOR DAY2"
 000149             END-IF.
 000150        NETCST-PARA.
 000151             COMPUTE NETCST(RIND) = COST-PKG(RIND) * NETRM-ALL(RIND).
 000152             DISPLAY NETCST(RIND).
 



What i analysed is error is in line 142 in the division. I might be wrong pls provide me a solution for this.


Run time values

 000001 //CMAP057R JOB ,,CLASS=M,MSGCLASS=T,NOTIFY=&SYSUID
 000002 //JOBLIB DD DSN=CMAP057.LINKS.PGM,DISP=SHR
 000003 //STEPB EXEC PGM=DIGRNTAB
 000004 //SYSPRINT DD SYSOUT=*
 000005 //SYSIN DD *
 000006 10
 000007 IPCON
 000008 10
 000009 07
 000010 MG
 000011 50
 000012 10
 000013 05
 000014 02
 000015 05
 000016 /*
 000017 //


In line 87 if i dint use decimal points its showing me s0c4 error.


Kind regards
gyaa
gowthamgyaa
 
Posts: 101
Joined: Wed Sep 05, 2012 11:18 pm
Has thanked: 67 times
Been thanked: 0 time

Re: S0C7 Abend error

 

Re: S0c7 abend error

Postby BillyBoyo » Tue Nov 06, 2012 1:17 pm

IT-DPD is three bytes, but you only give it two via the ACCEPT. There are mismatches of data-types between your input and your definitions, but they will not cause you an abend, sometimes will cause results you don't understand.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: S0c7 abend error

Postby gowthamgyaa » Tue Nov 06, 2012 1:22 pm

Hi Billy
Thank you very much for your reply.
can you pls guide me what might be wrong in causing Sc07 abend ?

Kind regards
gyaa
gowthamgyaa
 
Posts: 101
Joined: Wed Sep 05, 2012 11:18 pm
Has thanked: 67 times
Been thanked: 0 time

Re: S0c7 abend error

Postby BillyBoyo » Tue Nov 06, 2012 3:04 pm

BillyBoyo wrote:IT-DPD is three bytes, but you only give it two via the ACCEPT.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: S0c7 abend error

Postby Robert Sample » Tue Nov 06, 2012 5:24 pm

Observations and notes:
1. ACCEPT is, beyond any shadow of a doubt, the absolutely WORST way to get data into your COBOL program. ACCEPT does no checking of input so anything is allowed.
2. You do not have enough input data. Your PERFORM VARYING is going to execute 10 times, so you need to provide data 10 complete sets of data to be accepted. I see 1 complete set.
3. After that first set of data is read, the calculations done on table elements will not be valid since you will not have valid data in the table elements.

Root cause of your S0C7 abend: you do not have valid data in table elements when doing numeric computations.

If you ask again about what is causing the S0C7 abend, this topic will be locked.
Robert Sample
Global moderator
 
Posts: 3378
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 225 times

Re: S0c7 abend error

Postby gowthamgyaa » Tue Nov 06, 2012 5:53 pm

Hello Robert,
Thanks for your reply.
Pls dont lock the topic I have further doubts.
As i used only one complete set of data, that one set must be displayed and all other 9 sets of data would be zero. But for me this one set of data itself is not executing.
Also you told about Numeric calculations , for this one set of data which i provided numeric calculations should be done but its not done in my code.
For additional details I'm posting sysout here,
. . . . . . . . . . . . . . . . . . . . . . . . . . .
                              ABC COMPANY LTD
                         PURCHASE ORDER ENTRY SYSTEM
                    DELIVERY INSTRUC    & GOODS RECEIPT NOTE
DATE:                                                            12/11/06
TIME:                                                            0012113418
--------------------------------------------------------------------------------
INO  INM       TQR  RED RMUSN  TRMAV  RMUD1  RMWD1  TTRM1  NTRMA  ITDPD  CSPKG
--------------------------------------------------------------------------------
STOCK IN DEMAND STOP PROCESS TEMP
CEE3207S The system detected a data exception (System Completion Code=0C7).
         From compile unit COBOSS01 at entry point COBOSS01 at compile unit offs
          at address 0DB00FF8.
******************************** BOTTOM OF DATA ********************************
 
 
 
 


Pls provide me a reply not a lock.


Kind regards
gyaa
gowthamgyaa
 
Posts: 101
Joined: Wed Sep 05, 2012 11:18 pm
Has thanked: 67 times
Been thanked: 0 time

Re: S0c7 abend error

Postby BillyBoyo » Tue Nov 06, 2012 6:19 pm

After ACCEPTing your data, that which is numeric should be validated with a NUMERIC test. If you include those, I suspect you'll see a few problems with your data vs descriptions.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: S0c7 abend error

Postby gowthamgyaa » Tue Nov 06, 2012 6:38 pm

Actually I checked by using Class condition but am getting similar soc7 abend.
The step is been executed with the condition.
Pls help me in solving this.


Kind regards
gyaa
gowthamgyaa
 
Posts: 101
Joined: Wed Sep 05, 2012 11:18 pm
Has thanked: 67 times
Been thanked: 0 time

Re: S0c7 abend error

Postby Robert Sample » Tue Nov 06, 2012 6:42 pm

all other 9 sets of data would be zero
And where do you do this? Remember, the computer does what you tell it to do, not what you want it to do. If you do not have a loop to change each of the other 9 sets of table element values to zero, the computer will not magically make them zero for you.

Furthermore, when you compile your program make sure you use options NOOFFSET,LIST -- using a
CBL NOOFFSET,LIST
statement at the beginning of your program will do this. Once you have done this, you can take the listing and use the abend error message "at compile unit offset " to determine exactly which statement of your program is generating the ABEND.

An S0C7 ABEND occurs when your program attempts to do arithmetic with a data value that is not numeric. Preventive programming would change your program something like this:
 000127        TOTRM-PARA.
              IF  RM-USDP1 (RIND) NUMERIC
              AND RM-WSD1 (RIND) NUMERIC
 000128             COMPUTE TOT-RM(RIND) = RM-USDP1(RIND) + RM-WSD1(RIND)
           ELSE
               MOVE ZERO TO TOT-RM (RIND)
           END-IF.
 000129        NETRM-PARA.
              IF  TQREQ (RIND) NUMERIC
              AND TOT-RM (RIND) NUMERIC
 000130             COMPUTE NETRM-ALL(RIND) = TQREQ(RIND) * TOT-RM(RIND)
           ELSE
               MOVE ZERO TO NETRM-ALL (RIND)
           END-IF.

These users thanked the author Robert Sample for the post:
gowthamgyaa (Tue Nov 06, 2012 6:46 pm)
Robert Sample
Global moderator
 
Posts: 3378
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 225 times

Re: S0c7 abend error

Postby Robert Sample » Tue Nov 06, 2012 6:55 pm

Actually I checked by using Class condition but am getting similar soc7 abend.
The step is been executed with the condition.
Pls help me in solving this.
We are trying but you are not reading and meditating on what you are being told. Your attitude needs an adjustment. The computer is telling you that you have a problem in your code. Unless and until you accept that your code is wrong, you cannot fix the problem. This is, by the way, probably the biggest obstacle to debugging seen here (and everywhere). Programmers have trouble believing their code is not right, even when the computer is telling them so.

You need to learn debugging techniques so you will stop asking so often on this forum. To debug a program:
1. Understand what the computer is telling you the problem. This means knowing what the error message(s) mean. If you don't know, FIND THE MESSAGE IN THE MANUAL AND READ THE DESCRIPTION UNTIL YOU DO UNDERSTAND (this may take 2, 5, 79 reads of the message -- but keep at it).
2. Find which line of code is generating the problem. The error message(s) usually give the offset into the program where the problem occurred; using the compile listing allows you to identify the exact line of code.
3. You may have to add DISPLAY statements to show particular values just before the abending statement is executed.
4. Identify the root cause of the problem, then change your program to eliminate that cause.
5. There are some errors such as storage violations that can be difficult to debug because they may occur many statements away from where they are revealed. Fortunately, your error is not one of these.

One of your problems is going to be the ACCEPT -- ACCEPT does no validation of data, so you can put ANYTHING into a numeric variable through ACCEPT. As you have found, putting certain values into a numeric variable and then using that variable for arithmetic will cause an abend.

These users thanked the author Robert Sample for the post:
gowthamgyaa (Wed Nov 07, 2012 5:27 am)
Robert Sample
Global moderator
 
Posts: 3378
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 225 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post