MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

S0C7 error resulution

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Fri Aug 24, 2007 6:38 am    Post subject: S0C7 error resulution Reply with quote

Members,

I am getting a S0C7 in one of my program execution and unable to determine the cause and the values of A and B are getting populated in the flow of execution of the program.
Code:

       01 GROUPA.
          05 A                     PIC S9(9)V99 COMP-3.                   
       01 GROUPB.
          05 B                     PIC -$$$,$$$,$$9.99.                   


           DISPLAY 'A       :' A.                                       
           DISPLAY 'B       :' B.                                       
           MOVE A TO B.         
           DISPLAY 'AFTER MOVE'.                                   

I am getting the output:
Code:

A       :0000000000
B       :          $0.00
CEE3207S The system detected a data exception (System Completion Code=0C7). 

AFTER MOVE is not getting displayed.How to fix the problem ?
Back to top
View user's profile Send private message
CraigG
Intermediate


Joined: 02 May 2007
Posts: 202
Topics: 0
Location: Viginia, USA

PostPosted: Fri Aug 24, 2007 6:55 am    Post subject: Re: S0C7 error resulution Reply with quote

yadav2005 wrote:
Members,

I am getting a S0C7 in one of my program execution and unable to determine the cause and the values of A and B are getting populated in the flow of execution of the program.
Code:

       01 GROUPA.
          05 A                     PIC S9(9)V99 COMP-3.                   
       01 GROUPB.
          05 B                     PIC -$$$,$$$,$$9.99.                   


           DISPLAY 'A       :' A.                                       
           DISPLAY 'B       :' B.                                       
           MOVE A TO B.         
           DISPLAY 'AFTER MOVE'.                                   

I am getting the output:
Code:

A       :0000000000
B       :          $0.00
CEE3207S The system detected a data exception (System Completion Code=0C7). 

AFTER MOVE is not getting displayed.How to fix the problem ?


Initialize A before you display it or move it.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Fri Aug 24, 2007 6:59 am    Post subject: Reply with quote

yadav2005,

The S0c7 abend is caused by the MOVE statement.so any statements following the Move statement would not get exceuted. Now let us see as to the reason why the MOVE statement caused the error.

S0C7 is basically a data exception error. This usually occurs when dealing with fields defined as decimal or packed decimal.Now in your program you have defined var A as comp-3 and you neither had a value clause or initialize the field or move a valid value to the variable A.

VarA is defined as PIC S9(9)V99 COMP-3 which is stored in 6 bytes. Since it is signed decimal, the sign is stored in last nibble.

For ex: a value of +1 is stored as

Code:

X'00000000001C


Look at the last nibble. It has 'C' which means it is a positive number.if it is a negative number then it will be 'D'.

Now cobol validates the data item before and checks for the sign. Since you haven't initilized the field or moved a valid value, the last nibble does NOT contain a valid sign. So the end result is an abend.

Try coding any of the following and see if you still get an error

Code:

PIC S9(9)V99 COMP-3 VALUE 0.

OR

Code:

INITIALIZE A

OR

Code:

Move 0 to A


Also look up the compiler option NUMPROC which explains more about the sign processing

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG10/2.4.34?DT=20020923143836

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Fri Aug 24, 2007 7:17 am    Post subject: Reply with quote

Kolusu & CraigG,

Thanks for your wonderful answers and i am very clear with the concepts.If i simply initialize A or MOVE 0 TO A S0C7 does not come.Now let me tell the situation in my program that A value and B values are populated during the execution of the program and in my post i have shown the values which i am printing just before move and it can be seen that both A & B have 0.Now why the move should give S0C7 .

I agree your answers but in my case the values are populated in the execution of the program.Is there something i am missing to mention in my post / i am not clear in my question.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Fri Aug 24, 2007 7:24 am    Post subject: Reply with quote

Quote:

A value and B values are populated during the execution of the program and in my post i have shown the values which i am printing just before move and it can be seen that both A & B have 0.Now why the move should give S0C7 .

I agree your answers but in my case the values are populated in the execution of the program.Is there something i am missing to mention in my post / i am not clear in my question

yadav2005,

bonk Just because your display statement showed zeroes that does NOT mean that var-A contained a valid sign nibble for the packed decimal field. Your program did not move a valid value or it got overlaid by some other variable because of an overflow

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Fri Aug 24, 2007 7:33 am    Post subject: Reply with quote

Kolusu,

I am getting more clearer from your answers , but i tried to move A to a editing variable declared as
Code:

01 A      PIC S9(9)V99 COMP-3.
01 A-EDIT PIC -ZZZ,ZZZ,ZZ9.99

MOVE A TO A-EDIT.
DISPLAY 'A-EDIT:' A-EDIT

I got the output:
A-EDIT: 0.00

Now as per you if i MOVE 0 to A which has gone through the program execution the value in it will be lost and i will end up in moving 0 to A and in turn to B.Please help me where i am going wrong.Thanks a lot for your support till now.
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Aug 24, 2007 7:42 am    Post subject: Reply with quote

I think that if you look at the display command (object code from compiler listing) for
  • non-packed fields (PIC X and PIC 9 DISPLAY) straight move to output stream
  • packed-decimal (COMP-3) - executes and unpack to an intermediate area which is moved to the output stream. The unpack command does not check for sign - thus no SOC7.
  • Binary and HEX are just converted (can't have a SOC7 on binary data)
In this case, it appears that the program was loaded to an area in memory that contained binary zeros. Though IBM does not guarantee binary zeros for un-initialized fields, it occurs more times than not.

You can't get a SOC7 on a DISPLAY. SOC4 yes.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Aug 24, 2007 7:46 am    Post subject: Reply with quote

If you had populated A with bad data prior to moving it to B, you would have received a SOC7 on the MOVE ? TO A. guarranteed!!!
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Fri Aug 24, 2007 7:49 am    Post subject: Reply with quote

Kolusu,

Quote:

Your program did not move a valid value or it got overlaid by some other variable because of an overflow

Can you be more clear in what you mean by it got overlaid by some other variable because of an overflow, how to fix the problem ?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Fri Aug 24, 2007 7:56 am    Post subject: Reply with quote

yadav2005 wrote:
Kolusu,

Quote:

Your program did not move a valid value or it got overlaid by some other variable because of an overflow

Can you be more clear in what you mean by it got overlaid by some other variable because of an overflow, how to fix the problem ?


yadav2005,

Please put some effort to search before posting. Here is a link to a topic which you started which ironically discusses about the same issue Soc7.

http://www.mvsforums.com/helpboards/viewtopic.php?t=3489

The table over flow is discussed in the same topic

http://www.mvsforums.com/helpboards/viewtopic.php?p=16845#16845

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Fri Aug 24, 2007 8:17 am    Post subject: Reply with quote

Kolusu,

If i want to display the value of A in Hexadecimal format , how can i do that in my program ?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Fri Aug 24, 2007 8:30 am    Post subject: Reply with quote

yadav2005 wrote:
Kolusu,

If i want to display the value of A in Hexadecimal format , how can i do that in my program ?


bonk bonk Please search before posting.

http://www.mvsforums.com/helpboards/viewtopic.php?t=2592&highlight=whexstring

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Aug 24, 2007 8:38 am    Post subject: Reply with quote

yadav2005,

you are overlaying A with something during the execution of another instruction that has nothing to do with A; only the Working-Storage near A. potential culprits, table manipulation, Reference Modification.

Spend your time finding your programming error. Guaranteed you are pounding sand if you are going to try to prove Kolusu wrong.

I'll give you a W-S Table and some code that will allow you to display any data area in HEX this weekend. There are two copybooks that you just include in any program.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
bruce2359
Beginner


Joined: 22 Sep 2006
Posts: 2
Topics: 0
Location: West Coast, almost.

PostPosted: Fri Aug 24, 2007 1:45 pm    Post subject: Reply with quote

"S0C7 is basically a data exception error."

More specifically, S0c7 is a decimal arithmetic exception. Either the from- or to-fields does not contain a packed decimal number.

Defining a field S9(9)V99 COMP-3 does not populate (initialize) the field with a packed decimal value. Unless you initialize it with VALUE or move a packed decimal value to the field (or other technique), decimal arithmetic instructions will result in a s0c7
_________________
"Time is what keeps things from happening all at once" - anonymous fortune cookie
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group