ABEND: Table too Small



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

ABEND: Table too Small

Postby anbullavan » Thu Apr 12, 2012 11:59 am

The program was running fine till the previous day to yesterday, but abending by displaying “TABLE TOO SMALL” since yesterday.

SET X UP BY 1

IF X > TABLE-MAX
DISPLAY 'PRGNAME ABEND: TABLE TOO SMALL '

where X is the Index and TABLE-MAX is the limit variable. when we checked teh Table had only 40,000 records but still the program is abending. Any help here please.. I will provide if any other details needed.

01  TABLE-MAX                            PIC 9(9) COMP
                                              VALUE 300000.
01  MAX-ROWS                             PIC 9(9) COMP
                                              VALUE 0.     
01  TABLE-WARNING                        PIC 9(9) COMP
                                              VALUE 225000.
01  SUB-PRD-TYPE                         PIC X(3)     
                                              VALUE 'RSU'.
01  WS-DIST-TRIG-DONE-SW                      PIC X.       
01  WS-PAY-DATE                          PIC X(08).   
01  TABLE.                                           
    03 ELEMENTS   OCCURS 200000 TIMES                 
                       ASCENDING KEY TBL-KEY         
                       INDEXED BY X.                 

1800-PROCESS-TABLE.                               
                                                 
        PERFORM 8000-OPEN-CURSOR                   
       THRU 8000-EXIT                           
                                                 
    MOVE HIGH-VALUES         TO TABLE       
    SET  X              TO 1               
                                                 
    PERFORM 1900-MOVE
       THRU 1900-EXIT                           
      UNTIL WS-END-CURSOR                       
                                                 
    PERFORM 8200-CLOSE-CURSOR                   
       THRU 8200-EXIT                           
                                                 
    SET X               DOWN BY 1           
    SET WS-WORK-COUNTER      TO X           
    SET MAX-ROWS        TO X

MOVE WS-WORK-COUNTER     TO WS-DISPLAY-RECORDS
DISPLAY 'TABLE:        '
                         WS-DISPLAY-RECORDS   
SET X               TO 1               
   
1800-EXIT.
    EXIT.

1900-MOVE.                                             
                                                             
    PERFORM 8100-FETCH-CURSOR                               
       THRU 8100-EXIT                                       
                                                             
    IF  WS-END-CURSOR                                       
        GO TO 1900-EXIT                                     
    END-IF                                                   
                                                             
    MOVE ELEMENTS TO  TABLE FIELDS (X)
IF TRACE-ON                                       
   DISPLAY ELEMENTS (X )               
END-IF                                             
                                                   
SET X             UP BY 1                     
                                                   
IF  X            >   TABLE-MAX           
    DISPLAY 'PRGNAME ABEND:  TABLE TOO SMALL '

        GO TO 9999-ABEND-RTN
    END-IF                   
    .                       
1900-EXIT.                   
    EXIT.       
anbullavan
 
Posts: 8
Joined: Thu Mar 29, 2012 1:37 pm
Has thanked: 0 time
Been thanked: 0 time

Re: ABEND: Table too Small

 

Re: ABEND: Table too Small

Postby BillyBoyo » Thu Apr 12, 2012 12:09 pm

As soon as I start to look at this, I see a "warning" values of 225,000, did that ever appear?

Next I see that the table can only hold 200,000 entries, so TABLE-MAX and TABLE-WARNING are not going to be much use :-)

Now I see use of ELEMENTS with and without a subscript.

Did you "paste" the code from your emulator or re-type it?

Re-typing is useless, as we end up chasing your typos.

If you did paste this, there are numerous problems with the code, though I'm not looking any further until you either confirm that it is pasted, or paste the actual code. The definition under the OCCURS and how the table is used as well, please. Are you using SEARCH ALL?
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 anbullavan » Thu Apr 12, 2012 12:16 pm

No the Warning never appeared. As we checked table had only 40,000 records
anbullavan
 
Posts: 8
Joined: Thu Mar 29, 2012 1:37 pm
Has thanked: 0 time
Been thanked: 0 time

Re: ABEND: Table too Small

Postby BillyBoyo » Thu Apr 12, 2012 12:18 pm

And my other question? Paste or re-type?
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 anbullavan » Thu Apr 12, 2012 12:30 pm

It is directly copied from the Emulator. I didnt retype..
anbullavan
 
Posts: 8
Joined: Thu Mar 29, 2012 1:37 pm
Has thanked: 0 time
Been thanked: 0 time

Re: ABEND: Table too Small

Postby BillyBoyo » Thu Apr 12, 2012 1:47 pm

    MOVE ELEMENTS TO  TABLE FIELDS (X)


What is this about? ELEMENTS should be subscripted. TABLE is a reserved word. FIELDS is I don't know what. You are using the index belonging to ELEMENTS for FIELDS. I don't know how you'd get a clean compile with that. Have you checked your compile messages?
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 » Thu Apr 12, 2012 2:38 pm

Table had only 40,000 records but still the program is abending.
Who cares what YOU think the table has? The program is telling you that X has exceeded TABLE-MAX, no matter how many "records" you think the table has (if this is a DB2 table, it has ZERO records since DB2 uses rows, not records). You need to exercise normal diagnostic steps: use your debugger if your site has one, or recompile the program with DISPLAY statements to track key values at different points in the program, and so forth.
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 gokulNmf » Thu Apr 12, 2012 2:42 pm

Hi Anbullavan,
Considering "The program was running fine till the previous day to yesterday, but abending by displaying “TABLE TOO SMALL” since yesterday" is true, i am stating my point.

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 then the issue might be:
the thing to note is the X is the index so its the displacement and its not same as the number of items to be present in the table.
So X will be > than the TABLE-MAX.
please refer to the Enterprise Cobol Programming Guide V4 R2 to know abt indexing calcualtions.

Also Whatever BillyBoyo has mentioned, i am also not able to understand them.
The table has been declared with any pic clause :? ?
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 » Thu Apr 12, 2012 3:16 pm

gokulNmf wrote:[...]

My understanding is, the TABLE-MAX is the number of items you have defined i.e., the table can hold 300000 ELEMENTS.
If my understanding is correct then the issue might be:
the thing to note is the X is the index so its the displacement and its not same as the number of items to be present in the table.
So X will be > than the TABLE-MAX.
please refer to the Enterprise Cobol Programming Guide V4 R2 to know about indexing calculations.

[...]


gokulNmf,

The table is defined with only 200,000 elements :-)

I don't think that that is the issue, because the index should be converted, by the compiler, to an occurence number for the comparison.

The code shown has so many problems that I'm not sure where to start with the specific question :-)

Normally, I'd say "don't change a program except with code you are sure will fix the problem" - ie, don't fix an error if it isn't the error you are looking for and expect it to fix your error "by magic!". In this sort of case, I'd say fix everything else first, because it is just pointless thinking about patching-up that part with everything else that is wrong...
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 Monitor » Fri Apr 13, 2012 3:59 pm

If you compile the program with the option SSRANGE, Cobol runtime will take care of the situation when the index or subscript is larger than elements in the table as specified in Occurs.
This doesnt solve your programming problem, but handles the problem you try to handle yourself.
With SSRANGE, your program will abend with a User 4038 and a perfect description of the underlaying problem.
Monitor
 
Posts: 98
Joined: Wed Jan 18, 2012 8:59 pm
Has thanked: 0 time
Been thanked: 7 times

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post