ABEND: Table too Small



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Re: ABEND: Table too Small

Postby gokulNmf » Fri Apr 13, 2012 4:00 pm

Oh ok BillyBoyo, i dint know that. One more question. What will be Displayed if index variable is Displayed directly?
Usaully if we want to display a index variable we wil set display-varibale to index-varibale and then we will display the display varibale.
Cheers,
Gokul
User avatar
gokulNmf
 
Posts: 114
Joined: Sat Mar 28, 2009 6:41 pm
Location: India
Has thanked: 0 time
Been thanked: 0 time

Re: Re: ABEND: Table too Small

 

Re: ABEND: Table too Small

Postby Robert Sample » Fri Apr 13, 2012 4:55 pm

My understanding is, the TABLE-MAX is the number of items u have defined i.e., the table can hold 300000 ELEMENTS.
If my understandins is correct
Your understanding is wrong. There is nothing in COBOL to enforce a limit on the number of elements of a table (although compile option SSRANGE will do so). TABLE-MAX is a COBOL variable -- nothing more, nothing less -- and how that variable is used depends upon the program. And note that the original post had OCCURS 200000 even though TABLE-MAX is defined as 300000 -- so obviously there is no relationship between the number of elements in the table and the variable TABLE-MAX.
What will be Displayed if index variable is Displayed directly?
A compiler error message will show up, so nothing will be displayed.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

Re: ABEND: Table too Small

Postby BillyBoyo » Fri Apr 13, 2012 6:04 pm

Gokul, the thing to do is to try it out. Then check in the manual. Or check in the manual first, and see if you want to try it out.

The manual will tell you exactly how indexes are treated in all situations. The same of USAGE INDEX items.

If I'm doing a looping construct with an index, I like to do this sort of thing.

01  table-maximum-but-with-a-meaningful-name comp pic s9(8) or s9(4) depending on size of table
01  table-max-good-name-as-index USAGE INDEX


Assume also that the table itself has a-nicely-named-index.

At the "top" or the program or "first time",
SET a-nicely-named-index TO table-maximum-but-with-a-meaningful-name
SET table-max-good-name-as-index TO a-nicely-named-index


The I use table-max-good-name-as-index for the maximum test. Save the compiler some conversions. Maybe doesn't matter these days, but it's what I like to do.

I also like to check that the table-maximum-but-with-a-meaningful-name has the correct value.

01  nicely-named-table-max comp pic s9(4) value +100.
01  nicely-named-table.
    05  table-entry occurs 100 times.
        10  table-entry-value pic xx.
        10  table-entry-flag pic x.


How would you put in code, to check at run time, that the value of nicely-named-table-max is the same as the number of occurs. The idea is, if someone comes along and changes one without the other, how do you trap it automatically?

Hint: Look at the special-register LENGTH OF or the FUNCTION LENGTH,
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: ABEND: Table too Small

Postby gokulNmf » Fri Apr 13, 2012 10:50 pm

Hi Robert,
I think a cobol table cant hold more than what its declared in the occurs times of values. Correct me if i am wrong.
Let me correct my post as :
My understanding is, the TABLE-MAX is the number of items you supposed want the table to hold but as per definition it cant hold more than 200000 element values.

As i read the post my doubt was " How can the index which is supposed to store the disposition can be compared with the counter variable." But it was later clarified by Billyboyo that the compiler will automatically convert the index disposition to the count(like the value similar to the subscript).

For more clarification i posted asking the display thing for which you have replied it ll through a compiler error.

As Billiboyo suggested i wish to try n check it, but unfortunately i am right now not in any project and i dont have MF access :( .
Cheers,
Gokul
User avatar
gokulNmf
 
Posts: 114
Joined: Sat Mar 28, 2009 6:41 pm
Location: India
Has thanked: 0 time
Been thanked: 0 time

Re: ABEND: Table too Small

Postby BillyBoyo » Fri Apr 13, 2012 11:30 pm

Even with no access, you do still have the manuals. There are some free Cobol compilers out there. They aren't Enterprise Cobol, but you can try some things out with them and then check later when you do have access.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: ABEND: Table too Small

Postby Robert Sample » Fri Apr 13, 2012 11:49 pm

I think a cobol table cant hold more than what its declared in the occurs times of values. Correct me if i am wrong.
If you place more elements in a table than it is allocated via the OCCURS clause, you start writing over memory outside the table limits. While this is not illegal in COBOL, write over enough memory, and you are GUARANTEED to get an abend -- a S0C4 if you start writing over memory that doesn't belong to your program, or any of a number of other system abends if your overwritten memory happens to include the load module instructions. It is an extremely bad -- and dangerous -- practice to ever let such a memory overlay occur. Using SSRANGE compile option enforces the table size limit for table references -- but it takes additional processing time when the program is executing.

Other COBOL compilers may differ, but with Enterprise COBOL for mainframes, the OCCURS sets the boundary. You may declare other variables as you see fit, but the only thing that sets the table size is the OCCURS clause. And I am not aware of any COBOL that allows you to set the run-time size of a table; COBOL is a compiled language and the limits of a table are set at compile time, not at run time (although there are some cases when OCCURS DEPENDING ON can allow for a run-time change).

Enterprise COBOL allows indexes and subscripts to be used almost interchangeably and will convert the table offset value of an index into a subscript number and vice versa as required. However, if you attempt to use DISPLAY TABLE-NDX where TABLE-NDX is defined by an INDEXED BY clause, the compiler will generate an E-level error and not generate a load module as a result.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

Re: ABEND: Table too Small

Postby Monitor » Sat Apr 14, 2012 12:47 pm

Dynamic tables, tables that can expand or shrink at run-time, is defined in the COBOL 2002 standard, but is not yet implemented in z/OS. A nice feature to look forward to and will eliminate the problem discussed in this thread.
The Occurs maxvar Depending On numvar clause is a way to tell COBOL the maximum number of elements and how many elements of the table you really are using: when you load the table you vill have to increment the value of numvar for every element you create. Assuming this value is smaller than the value maxvar, COBOL can exlude unused elements when you use the SEARCH-verb, either sequential search or binary search, to find what you are looking for.
Monitor
 
Posts: 98
Joined: Wed Jan 18, 2012 8:59 pm
Has thanked: 0 time
Been thanked: 7 times

Re: ABEND: Table too Small

Postby BillyBoyo » Sat Apr 14, 2012 2:59 pm

We don't know yet what the problem is, so I'm not sure we know how to "eliminate" it. TS/OP says only 40,000 entries in table, so doesn't know how it says 300,000 is bust. So many errors, I can't being to guess.

I haven't looked, but would the table get bigger as you add entries to it, or can you just give it a fixed size at run time, or is it fixed-but-can-be-specifically-changed-if-necessary. Depending on what it is, might not even deal directly with the "normal" overflow-of-table problems.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: ABEND: Table too Small

Postby dick scherrer » Sun Apr 15, 2012 5:16 am

Hello,

Dynamic tables, tables that can expand or shrink at run-time, is defined in the COBOL 2002 standard, but is not yet implemented in z/OS. A nice feature to look forward to and will eliminate the problem discussed in this thread.
Please post the info from (or the direct link to) the IBM documentation where this was found.

My guess is that the problem in this topic is problem code or a misunderstanding of what is/should be happening.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: ABEND: Table too Small

Postby Monitor » Sun Apr 15, 2012 12:09 pm

Dick,
I checked the finalized document for the 2002 standard and just found that the proposal was dropped, meaning its not part of the 2002 standard (sorry!).
I found that it was/is a proposal to the 2008 standard, which I havent seen any trace of so far. I´m checking further on this.
The initial refrence to Dynamic Tables was found in the book Advanced COBOL for structured and Object-Oriented Programming (third edition) by Gary DeWard Brown.
Monitor
 
Posts: 98
Joined: Wed Jan 18, 2012 8:59 pm
Has thanked: 0 time
Been thanked: 7 times

PreviousNext

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post