IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

S0C9 Error fixed-point divide exception


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
saji123

New User


Joined: 15 Jul 2009
Posts: 19
Location: Chennai

PostPosted: Mon Sep 07, 2009 1:53 pm
Reply with quote

Hi
I am getting Abend S0C9 while submitting the JCl error is shown as
The system detected a fixed-point divide exception (System Completion
Code=0C9).

But I havn't used and Division in my Code. Can anyone tell mw what other reason will be there for this error..
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Mon Sep 07, 2009 2:06 pm
Reply with quote

Hi,
while trying to edit or browse a PS dataset with LRECL 0 the File Manager abends with S0C9 check the LREC of the file
Back to top
View user's profile Send private message
saji123

New User


Joined: 15 Jul 2009
Posts: 19
Location: Chennai

PostPosted: Mon Sep 07, 2009 4:00 pm
Reply with quote

LRECL is also fine. I am moving a COMP value to non-COMP value and doing calculation on this variable. Will it cause an error. i have declared both the COMP value and the non-COMP value with the same size.
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Mon Sep 07, 2009 4:02 pm
Reply with quote

It won't give you a SOC9 for this reason.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Sep 07, 2009 6:52 pm
Reply with quote

Quote:
I am moving a COMP value to non-COMP value and doing calculation on this variable. Will it cause an error. i have declared both the COMP value and the non-COMP value with the same size.
Of course it can -- it does not matter whether the fields are COMP or not, it does not matter the PIC clause for the fields -- if you say DIVIDE A BY B and you have not verified that B is not zero, you can get an S0C9 abend. The most common reason for S0C9 is divide by zero.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Mon Sep 07, 2009 7:09 pm
Reply with quote

saji123,
It would help if you posted (copy/paste from your program) the field definitions and all relevant code and error messages involved.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Sep 07, 2009 7:18 pm
Reply with quote

Hi Saji,

It would also be nice to know what COBOL stmt caused the Abend. Have you done that?

If not, do a search of the posts here using "OFFSET" or "0C7" to find how to do it.
Back to top
View user's profile Send private message
saji123

New User


Joined: 15 Jul 2009
Posts: 19
Location: Chennai

PostPosted: Mon Sep 07, 2009 7:26 pm
Reply with quote

the piece of code where i am getting error is
MOVE W040-EQRFND-CREDITAMT (W040-EQRFND-SUB)
TO WS-EQRFND-CRAMT-TEMP


I have declared field as W040-EQRFND-CREDITAMT PIC s9(16) comp.
WS-EQRFND-CRAMT-TEMP PIC s9(16) value 0.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Mon Sep 07, 2009 7:31 pm
Reply with quote

Please post what is requested. And copy/paste what you post directly from your program instead of keying it. Your source field in the MOVE statement is subscripted/indexed but you didn't post the definition of the subscript (if subscripted) or the value of it.
Back to top
View user's profile Send private message
saji123

New User


Joined: 15 Jul 2009
Posts: 19
Location: Chennai

PostPosted: Mon Sep 07, 2009 7:42 pm
Reply with quote

Oh Sorry !!

01 WS-EQRFND-CREDITAMT PIC S9(9)V99 VALUE 0.
01 WS-EQRF-CREDITAMT PIC S9(15)V999 VALUE 0.
01 WS-EQRFND-CRAMT-TEMP1 PIC S9(9)V99 VALUE 0.
01 WS-EQRFND-CRAMT-TEMP2 PIC S9(9)V99 VALUE 0.
01 WS-EQRFND-CRAMT-TEMP PIC S9(15)V999 VALUE 0.

01 W040-EQRFND-TABLE PIC X(870000) VALUE HIGH-VALUES.
01 FILLER REDEFINES W040-EQRFND-TABLE.
03 W040-EQRFND-ENTRIES OCCURS 10000
ASCENDING KEY
W040-EQRFND-CUSNO
INDEXED BY W040-EQRFND-SUB.
05 W040-EQRFND-CREDITAMT PIC S9(9)V99 COMP.


MOVE W040-EQRFND-CREDITAMT (W040-EQRFND-SUB)
TO WS-EQRFND-CRAMT-TEMP1



Error Message: The system detected a fixed-point divide exception (System Completion
Code=0C9).
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Mon Sep 07, 2009 8:07 pm
Reply with quote

Please post what is requested. What is the value of W040-EQRFND-SUB immediately before the MOVE statement is executed (you can DISPLAY it). And please use BBCode to make your post more readable.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Sep 07, 2009 8:08 pm
Reply with quote

Where's your SET statement for W040-EQRFND-SUB? You want us to figure out an index error without telling us how you set the index?
Back to top
View user's profile Send private message
saji123

New User


Joined: 15 Jul 2009
Posts: 19
Location: Chennai

PostPosted: Mon Sep 07, 2009 8:12 pm
Reply with quote

SET W040-EQRFND-SUB TO 1

MOVE W040-EQRFND-ADVNO (W040-EQRFND-SUB)
TO WS-PREV-ADVNO
MOVE W040-EQRFND-CREDITAMT (W040-EQRFND-SUB)
TO WS-EQRFND-CRAMT-TEMP1
SET W040-EQRFND-SUB UP BY 1
MOVE W040-EQRFND-ADVNO (W040-EQRFND-SUB)
TO WS-CURRENT-ADVNO
PERFORM UNTIL WS-CURRENT-ADVNO NOT = WS-PREV-ADVNO
MOVE W040-EQRFND-CREDITAMT (W040-EQRFND-SUB)
TO WS-EQRFND-CRAMT-TEMP2
ADD WS-EQRFND-CRAMT-TEMP2 TO WS-EQRFND-CRAMT-TEMP1
MOVE W040-EQRFND-ADVNO (W040-EQRFND-SUB)
TO WS-PREV-ADVNO
SET W040-EQRFND-SUB UP BY 1
MOVE W040-EQRFND-ADVNO (W040-EQRFND-SUB)
TO WS-CURRENT-ADVNO
END-PERFORM



Now am getting error in the ADD statement. icon_sad.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Sep 07, 2009 8:34 pm
Reply with quote

Did you notice what Robert has pointed to in his first post? Dividing by zero is the most common cause of this ABEND. Correct the program logic error that caused the divide exception and resubmit the job.

This ABEND is caused by a fixed-point divide exception. A quotient has exceeded the register size in a DIVIDE instruction, or the result of a CONVERT TO BINARY instruction is more than 31 bits long. Don't you have any divide-by instruction in your code at all?
Back to top
View user's profile Send private message
saji123

New User


Joined: 15 Jul 2009
Posts: 19
Location: Chennai

PostPosted: Mon Sep 07, 2009 8:37 pm
Reply with quote

No i dont have any Divide by instruction in my code
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Sep 07, 2009 8:46 pm
Reply with quote

Recompile your code with NOOFF,LIST to get the pseudo-assembler listing. Once this is done, rerun the program and the offset for the abend should point to one of the pseudo-assembler instructions. Post the exact error message and pseudo-assembler code (5 instructions before and after the line with the error should be enough). And use the BBcode for your listing to make it easier to review.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Mon Sep 07, 2009 9:13 pm
Reply with quote

Quote:
Now am getting error in the ADD statement
This statement tells us next to nothing. What exactly is the error? Did you not see my request to include all relevant error messages and to use BBCode. Are you pasting your posts directly from your program or keying it in manually?
Back to top
View user's profile Send private message
saji123

New User


Joined: 15 Jul 2009
Posts: 19
Location: Chennai

PostPosted: Mon Sep 07, 2009 9:32 pm
Reply with quote

I am pasting the code directly from the program. I got error in the ADD statement since i declared the variable as COMP. I have changed my Code a little.

My exact code is like
Code:
01 WS-CASINFC-REV-FIXCHG        PIC S9(15)V999 COMP VALUE 0.
01 WS-EQRFND-CREDITAMT          PIC S9(9)V99   COMP VALUE 0.
01 WS-EQRF-CREDITAMT            PIC S9(15)V999 COMP VALUE 0.
01 WS-EQRFND-CRAMT-TEMP1        PIC S9(9)V99   COMP VALUE 0.
01 WS-EQRFND-CRAMT-TEMP2        PIC S9(9)V99   COMP VALUE 0.
01 WS-EQRFND-CRAMT-TEMP         PIC S9(15)V999 COMP VALUE 0.
01 WS-VATAMT                    PIC S9(9)V99   COMP VALUE 0.


/ internal tables.
Code:
 01 W040-EQRFND-TABLE            PIC X(870000) VALUE HIGH-VALUES.
 01 FILLER REDEFINES W040-EQRFND-TABLE.
    03  W040-EQRFND-ENTRIES   OCCURS 10000
                              ASCENDING KEY
                               W040-EQRFND-CUSNO
                            INDEXED BY W040-EQRFND-SUB.
        05 W040-EQRFND-CUSNO            PIC X(7).
        05 W040-EQRFND-CREDIT-REF       PIC X(8).
        05 W040-EQRFND-TRANSDTE         PIC S9(9)    COMP.
        05 W040-EQRFND-TOTAMT           PIC S9(9)V99 COMP.
        05 W040-EQRFND-EQUCDE           PIC X(4).
        05 W040-EQRFND-EQUDESC          PIC X(25).
        05 W040-EQRFND-VATCDE           PIC X.
        05 W040-EQRFND-INVOICE-BILDTE   PIC S9(9)    COMP.
        05 W040-EQRFND-INVOICE-ID       PIC X(8).
        05 W040-EQRFND-CREDITAMT        PIC S9(9)V99 COMP.


SET W040-EQRFND-SUB TO 1
MOVE W040-EQRFND-CREDITAMT (W040-EQRFND-SUB)
                 TO WS-EQRFND-CRAMT-TEMP1
SET W040-EQRFND-SUB UP BY 1
PERFORM UNTIL WS-CURRENT-ADVNO NOT = WS-PREV-ADVNO
  MOVE W040-EQRFND-CREDITAMT (W040-EQRFND-SUB)
            TO WS-EQRFND-CRAMT-TEMP2
  COMPUTE WS-EQRFND-CRAMT-TEMP1 =
      WS-EQRFND-CRAMT-TEMP1 + WS-EQRFND-CRAMT-TEMP2
   MOVE W040-EQRFND-ADVNO  (W040-EQRFND-SUB)
             TO WS-PREV-ADVNO
   SET W040-EQRFND-SUB UP BY 1
   MOVE W040-EQRFND-ADVNO  (W040-EQRFND-SUB)
            TO WS-CURRENT-ADVNO
 END-PERFORM
 MOVE WS-EQRFND-CRAMT-TEMP1 TO WS-EQRFND-CRAMT-TEMP
IF WS-EQRFND-CRAMT-TEMP = W040-CASINFC-REV-FIXCHG
                       (W040-CASINFC-SUB)
PERFORM X0615-GET-LINE-ITEM



The error i am getting is
The system detected a fixed-point divide exception (System Completion
Code=0C9).

From compile unit YLG94A at entry point YLG94A at compile unit offset
+00001B3E at entry offset +00001B3E at address 21602376.

When i checked for 1B3E it is like


Code:
000745  COMPUTE
   001B2A  9823 82F8          LM    2,3,760(8)    WS-EQRFND-CRAMT-TEMP1
   001B2E  5A20 8300          A     2,768(0,8)    WS-EQRFND-CRAMT-TEMP2
   001B32  5E30 8304          AL    3,772(0,8)    WS-EQRFND-CRAMT-                                                                                              TEMP2+4
   001B36  47C0 B80E          BC    12,2062(0,11) GN=156(001B3E)
   001B3A  5A20 C00C          A     2,12(0,12)    SYSLIT AT +12
   001B3E            GN=156   EQU   *
   001B3E  5D20 C008          D     2,8(0,12)     SYSLIT AT +8
   001B42  4E30 D288          CVD   3,648(0,13)   TS2=16
   001B46  F154 D278 D28B     MVO   632(6,13),651(5,13)  TS2=0
   001B4C  4E20 D288          CVD   2,648(0,13)   TS2=16
   001B50  9110 D27D          TM    637(13),X'10' TS2=5

Edited for BBcode
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Sep 07, 2009 9:47 pm
Reply with quote

And what do we see at 1B3E? A Divide pseudo-assembler instruction. If you got a dump from the abend, look in the TGT to find the SYSLIT address and figure out what is at offset 8. Somehow that value is becoming zero -- possibly due to table overflow.

If you haven't compiled with SSRANGE, do so and run with the run time option to turn on subscript range checking.
Back to top
View user's profile Send private message
saji123

New User


Joined: 15 Jul 2009
Posts: 19
Location: Chennai

PostPosted: Wed Sep 09, 2009 3:55 pm
Reply with quote

Hi ,
Thank you for all your support i got the solved the error.
I was problem with the input file
Thanks
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Sep 09, 2009 4:10 pm
Reply with quote

Discussion expanded to two pages and solution is
Quote:
It was problem with the input file
you ball all of us out... icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts Pulling a fixed number of records fro... DB2 2
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
Search our Forums:

Back to Top