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

S0C7 because of memory overlapping


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

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Fri Sep 11, 2009 4:03 pm
Reply with quote

Hi Experts,

Is there any way through which we can confirm that 2 variables are referencing same memory area.

There are 2 variables say X and Y

X is having some value say 000000000 PIC S9(7)V9(2)
When the program goes to fetch value of veriable Y the value of veriable
changes automatically and therefore job is abending.

There is no relation between X & Y.

I am getting a S0C7 because veraible X has alphanumeric data.THis thing is sure that there is no way I can put alphanumeric value in X as it is defined as S9(7)V9(2) then how it is having alphanumeric data.

Please help me.

Thanks in Advance
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Sep 11, 2009 4:13 pm
Reply with quote

PLEASE post your question in the correct forum.
Or explain to us why this is a JCL problem icon_evil.gif

Topic moved to COBOL forum.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Fri Sep 11, 2009 4:37 pm
Reply with quote

Quote:
I am getting a S0C7 because veraible X has alphanumeric data.THis thing is sure that there is no way I can put alphanumeric value in X as it is defined as S9(7)V9(2) then how it is having alphanumeric data.
A COBOL-definition of both the varaibles (X and Y) would serve better to get answers.
Quote:
When the program goes to fetch value of veriable Y the value of veriable changes automatically and therefore job is abending.
Being from IT, please don't say this icon_neutral.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Fri Sep 11, 2009 4:59 pm
Reply with quote

Quote:
Is there any way through which we can confirm that 2 variables are referencing same memory area.
Of course -- I can think of two ways just off the top of my head:
1) Code inspection to see the REDEFINES or RENAME or multiple 01 levels in the FD
2) Review of the compiler output to see the offsets for the variables in the cross reference listing
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Sep 11, 2009 8:28 pm
Reply with quote

Hello,

Quote:
then how it is having alphanumeric data.
The 2 most common reasons are bad data or errors in the code. . .
Quote:
When the program goes to fetch value of veriable Y the value of veriable changes automatically
No, it doesn't. . . "Reading" memory does not change it. . .

You have not provided enough information for us to help. . . Suggest you not look for some exotic problem cause - it is most likely some simple error.
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: Fri Sep 11, 2009 9:31 pm
Reply with quote

In addition to what others have said, if as you say, there is no relation between X and Y, then there is no overlapping storage. As requested, post the definitions of X, Y, and anything that redefines them, and all relevant code involving X and Y, and please use BBCode for readability (see FAQ).
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Sat Sep 12, 2009 9:54 am
Reply with quote

Hi All,

@expat
Sorry, I posted it in wrong forum.

@Anuj Dhawan
The PIc clasuse of variable X is S9(7)V9(2)
The PIC clause of Y is X(7000)

The variable Y is used to store segments until EOF is received.When the program goes to populate the variable Y the value of X changes on 5 iteration.The value of X changes from 000000000 to 00431+000 on 5th iteration.

@Robert Sample
I have checked all the redefines & renames,there weren't any redefines & renames.

About the second possibility that you are talking I have no cluse to check that.

@dick scherrer
The program is running fine for approximately million policies but is abending only for 1 policy.

I know it sounds a bit wired but this is the fact that the varible is having value 00431+000.

Thank You all.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Sep 13, 2009 4:24 am
Reply with quote

Rgupta,

One other situation that can cause data to myteriously appear in a field, is a table move using a run away subscript.

For example:

You have a 10 element table and your pgm issues "MOVE SOME-DATA TO TBL-FLD(SUB).

If SUB contains 100 or some other value GT the # of entries in your table, SOME-DATA will overlay some other part of your pgm, not the intended tbl field. if you're lucky, the pgm will abend because of "invalid data" at the receiving location. This could be happening to you.
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: Sun Sep 13, 2009 4:56 am
Reply with quote

Without a better description of the information asked for, we can only guess at where the problem is. Please provide the requested information and do not key it in manually -- copy and paste directly from your program and use BBCode to make it more readable.
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Sun Sep 13, 2009 10:57 am
Reply with quote

Hi All


@Terry Heinze
I cannot post the code because I am in a secured zone and I don't have access to the internet where I am having mainframe access.

@mmwife

I am not using a db2 table its the dataset of a VB format that I am using.

Thank You for your support.
Back to top
View user's profile Send private message
smilingashutosh

New User


Joined: 08 Jun 2006
Posts: 22

PostPosted: Sun Sep 13, 2009 1:37 pm
Reply with quote

Quote:
I am not using a db2 table its the dataset of a VB format that I am using.


It is Cobol Table/Array data he is talking about.
I think if you can provide the whole working storage structure of X and Y including its group variable, people will be able to help you out more on this.
If possible also provide the loop logic where the value is getting changed.
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: Sun Sep 13, 2009 7:45 pm
Reply with quote

rgupta71 wrote:
I cannot post the code because I am in a secured zone and I don't have access to the internet where I am having mainframe access.
Copy/paste the requested information to a Notepad file using a font like Courier New to preserve spacing, attach the Notepad file to an e-mail addressed to yourself, then paste that Notepad attachment here in a post.
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Mon Sep 14, 2009 3:17 pm
Reply with quote

Hi,

@mmwife

You were right. The variable was having occur clause 4 & it was fetching 6 value which was causing abend.

Thank You all
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 14, 2009 3:35 pm
Reply with quote

Gerat finally you got it working, yup that could be a reason. Thanks for letting us know the final solution used. icon_smile.gif
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Thu Jun 10, 2010 4:50 pm
Reply with quote

Hi Experts,

Again I am having similar kind of issue icon_cry.gif .A S0C7 is coming in a compute statement when one is added to a variable which contains X'000000'.Its PIC clause is S9(5) COMP-3.

Can anybody tell me that what are the other possible reason for this.

Thanks.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Thu Jun 10, 2010 4:59 pm
Reply with quote

A S0C7 abend has one cause and only one cause: you are attempting to do arithmetic with a numeric variable that does not have numeric digits in it. You look at the dump information to find the offset into the program where the S0C7 occurred, find the source listing for that program (or generate one if necessary), and determine which statement is located at that offset. Either fix the data or add code to the program to validate the variables are numeric before doing arithmetic.
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Thu Jun 10, 2010 5:04 pm
Reply with quote

Thanks Robert for your quick response.

Quote:
Either fix the data or add code to the program to validate the variables are numeric before doing arithmetic.


I know a code fix will be needed but for that I need to know which varaible values are getting overlapped in the problem varaible.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Thu Jun 10, 2010 5:12 pm
Reply with quote

That's why you analyze the dump -- it'll tell you what you need to know.
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Thu Jun 10, 2010 5:22 pm
Reply with quote

Is there anyway to find out which other variable is accessing that memory area.

Thanks.
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Thu Jun 10, 2010 5:29 pm
Reply with quote

Generally adding 1 would not give SOC-7 if the destination field does not have garbage.

Are you sure there are no more index problems? One way to be sure is to have CBL SSRANGE compiler option and running with PARM='/CHECK(ON)'
This would make the program abend as soon as the index overflow occurs and does not corrupt other data values.

We had similiar problem an year back. The program was using 35 arrays and 4 were overflowing.
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Thu Jun 10, 2010 5:37 pm
Reply with quote

Thanks Bharath.

One more question.
Where I can see the name of the array's that are having overflow in it.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Jun 10, 2010 5:40 pm
Reply with quote

Bharath Bhat wrote:
Generally adding 1 would not give SOC-7 if the destination field does not have garbage.

rgupta71 wrote:
...when one is added to a variable which contains X'000000'. Its PIC clause is S9(5) COMP-3.
Looks like garbage to me.....
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Thu Jun 10, 2010 5:41 pm
Reply with quote

CICS Guy ,You are right .I also found this statement to be incorrect.

Thanks.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Thu Jun 10, 2010 5:58 pm
Reply with quote

Using a variable with a value of X'000000' that is defined as PIC S9(05) COMP-3 for arithmetic will automatically generate a S0C7 abend. X'000000' is not a valid numeric value for COMP-3 data.
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Thu Jun 10, 2010 6:05 pm
Reply with quote

Yes,this what the problem is.Due to some memory overlapping it is having some junk data.

Thanks
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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts S0C7 - Field getting overlayed COBOL Programming 2
No new posts Access an specific memory address exp... COBOL Programming 1
No new posts FIELDS OVERLAPPING WITH MODE = IN OR ... CICS 3
No new posts Foreign character look different in m... COBOL Programming 3
No new posts S0C7 abend while running a Cobol Program COBOL Programming 2
Search our Forums:

Back to Top