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

When index goes over occurs


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

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Fri Aug 29, 2008 1:50 am
Reply with quote

Hi

I have got an table with occurs clause as 100.It is indexed by WHX-100.
Can any body tell me what would happen if the index WHX-100 becomes more than 100 ?

Will it overwrite the first row of the table ? How will it behave ?

Thanks
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: Fri Aug 29, 2008 2:41 am
Reply with quote

Assuming that indexes behave similar to subscripts, and you do not have the option that checks, the area after the 100th entry will get overwritten.
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 Aug 29, 2008 3:26 am
Reply with quote

Hello,

Quote:
Will it overwrite the first row of the table ? How will it behave ?
If you mean a db2 table, no the database will not be "overwritten" by this. It could cause a logic error that causes some undesirable update.

When the code does not control the index/subscrpt, the results are unpredictable. Almost any bad thing can happen. . . .
Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 218
Location: India

PostPosted: Fri Aug 29, 2008 10:24 am
Reply with quote

ap_mainframes wrote:
Hi

I have got an table with occurs clause as 100.It is indexed by WHX-100.
Can any body tell me what would happen if the index WHX-100 becomes more than 100 ?

Will it overwrite the first row of the table ? How will it behave ?

Thanks


Accessing the Array Out of Range elements also depends on Compiler Option SSRANGE/NOSSRANGE

publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?topic=/com.ibm.aix.cbl.doc/up6060.htm

If NOSSRANGE is the compiler option then the results are unpredictable as Dick said.

Dick Pls Correct me if i am wrong.
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 Aug 29, 2008 11:05 am
Reply with quote

Hello Sri,

As you mentioned:
Quote:
Accessing the Array Out of Range elements also depends on Compiler Option SSRANGE/NOSSRANGE


My preference is to make sure the code is under control so neither problem will occur.
Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 218
Location: India

PostPosted: Mon Sep 01, 2008 11:16 am
Reply with quote

dick scherrer wrote:
Hello Sri,

As you mentioned:
Quote:
Accessing the Array Out of Range elements also depends on Compiler Option SSRANGE/NOSSRANGE


My preference is to make sure the code is under control so neither problem will occur.


I too agree with you Dick.
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 Cobol file using index COBOL Programming 2
No new posts Updating a 1 byte thats in occurs mul... DFSORT/ICETOOL 6
No new posts DL/I status code AK for GU call using... IMS DB/DC 1
No new posts Add column to existing records using ... JCL & VSAM 2
No new posts choice of clustering index DB2 3
Search our Forums:

Back to Top