× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: ILE-Cobol Subscript range (bug or feature)
  • From: "Branston DiBrell, Jr." <bdibrell@xxxxxxxxxxxxxxx>
  • Date: Thu, 16 Jul 1998 16:14:53 -0600

Vanya,

I remember running into that same problem (subscript out-of-range producing no 
error, just writing over other parts of memory) on a VAX.  I think that the 
fact that you got a run time error with the integer variable is a COBOL/400 
'feature'.

In the past, I've always tried to avoid that problem by using a Search...At End 
using a variable length table (then adding 1 to the table size when I want to 
add a table row), or some such trick.

-Branston

----------
From:  Vanya Jovic [SMTP:jovic@calcna.ab.ca]
Sent:  Tuesday, July 14, 1998 2:11 PM
To:  midrange-l@midrange.com
Subject:  ILE-Cobol Subscript range (bug or feature)


        Devil's advocate again :))

        Hi, ppl.

According to ILE COBOL/400 Reference & Programmer's Guide, range of
array's or table's subscript should be between 1 and number in OCCURS
clause. And subscript can be any integer variable or index declared in
INDEXED BY clause. Nice. If you use integer variable and make it
bigger than number in OCCURS clause, run time error occurs in the moment
when you try to move something to table element subscribed by that
variable. But if you set index to number greater then a number in OCCURS
clause, and then move something to table element subscribed by
that index, nothing happens. No warrning. Even worse, memory out of
table's boundaries is beeing changed (and, you guess, data in another
table is corrupted). I've just spent whole morning debbugging service
program (24 modules, thanks for asking), trying to find out which phantom
was populating decimal fields in one table with garbage. It turned out
that it was done by completely irrelevant table, in completely irrelevant
module where programmer typed smaller number in OCCURS clause than he
shold have.

        I red that part of manual a few times, but it doesn't say anything
about this kind of difference in behaviour between integer variable and
index. I checked it in ILE environment, but I'm pretty sure that same
would happened in OPM. 

        Any comments, thoughts ????

Vanya

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.