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.
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.