The table is loading fine. But when I go to search the table it only finds the same one record . Like the index is not incrementing. Any help or hints you can give me would be appreciated.
Here is the relevant code below.
WORKING-STORAGE SECTION.
01 WORKING-VARIABLES.
05 TABLE-ROW-POINTER PIC S9(4) BINARY.
05 TABLE-MAX-COUNTER PIC 99 VALUE ZERO.
01 DISHNETW-TABLE.
05 DISHNETW-TABLE-T OCCURS 1 TO 40 TIMES
DEPENDING ON TABLE-MAX-COUNTER
DESCENDING KEY IS NETWORK-ID
INDEXED BY NETW-INDEX.
10 NETWORK-ID PIC X(8).
10 PPV PIC X.
100-INITIALIZE SECTION.
*=================================================================
OPEN INPUT DISHTRAN-FILE
DISHNETW-FILE
DISHEVNT-FILE
OUTPUT REPORT-FILE.
PERFORM 120-READ-NETW VARYING NETW-INDEX FROM 1 BY 1
UNTIL EOF-NETW = 'Y'.
CLOSE DISHNETW-FILE.
120-READ-NETW SECTION.
*=================================================================
READ DISHNETW-FILE INTO DISHNETW-TABLE-T (NETW-INDEX)
AT END MOVE 'Y' TO EOF-NETW
NOT AT END ADD 1 TO TABLE-MAX-COUNTER
DISPLAY 'DISHNETW-TABLE-T : ' DISHNETW-TABLE-T (NETW-INDEX)
IF DISHNETW-TABLE-T (NETW-INDEX) = SPACES
MOVE 'Y' TO EOF-NETW
END-IF.
120-EXIT.
EXIT.
IF NETWORK-B ALPHABETIC
MOVE 1 TO TABLE-ROW-POINTER
SEARCH ALL DISHNETW-TABLE-T
AT END MOVE 6 TO E
PERFORM 300-ERROR
SUBTRACT 1 FROM TABLE-ROW-POINTER
DISPLAY 'NETWORK-ID TRP : ' NETWORK-ID (TABLE-ROW-POINTER)
DISPLAY 'NETWORK-ID : ' NETWORK-ID (NETW-INDEX)
WHEN NETWORK-ID (NETW-INDEX) = NETWORK-IN
CONTINUE
END-SEARCH
ELSE MOVE 4 TO E
PERFORM 300-ERROR
END-IF.
Here is the relevant code below.
WORKING-STORAGE SECTION.
01 WORKING-VARIABLES.
05 TABLE-ROW-POINTER PIC S9(4) BINARY.
05 TABLE-MAX-COUNTER PIC 99 VALUE ZERO.
01 DISHNETW-TABLE.
05 DISHNETW-TABLE-T OCCURS 1 TO 40 TIMES
DEPENDING ON TABLE-MAX-COUNTER
DESCENDING KEY IS NETWORK-ID
INDEXED BY NETW-INDEX.
10 NETWORK-ID PIC X(8).
10 PPV PIC X.
100-INITIALIZE SECTION.
*=================================================================
OPEN INPUT DISHTRAN-FILE
DISHNETW-FILE
DISHEVNT-FILE
OUTPUT REPORT-FILE.
PERFORM 120-READ-NETW VARYING NETW-INDEX FROM 1 BY 1
UNTIL EOF-NETW = 'Y'.
CLOSE DISHNETW-FILE.
120-READ-NETW SECTION.
*=================================================================
READ DISHNETW-FILE INTO DISHNETW-TABLE-T (NETW-INDEX)
AT END MOVE 'Y' TO EOF-NETW
NOT AT END ADD 1 TO TABLE-MAX-COUNTER
DISPLAY 'DISHNETW-TABLE-T : ' DISHNETW-TABLE-T (NETW-INDEX)
IF DISHNETW-TABLE-T (NETW-INDEX) = SPACES
MOVE 'Y' TO EOF-NETW
END-IF.
120-EXIT.
EXIT.
IF NETWORK-B ALPHABETIC
MOVE 1 TO TABLE-ROW-POINTER
SEARCH ALL DISHNETW-TABLE-T
AT END MOVE 6 TO E
PERFORM 300-ERROR
SUBTRACT 1 FROM TABLE-ROW-POINTER
DISPLAY 'NETWORK-ID TRP : ' NETWORK-ID (TABLE-ROW-POINTER)
DISPLAY 'NETWORK-ID : ' NETWORK-ID (NETW-INDEX)
WHEN NETWORK-ID (NETW-INDEX) = NETWORK-IN
CONTINUE
END-SEARCH
ELSE MOVE 4 TO E
PERFORM 300-ERROR
END-IF.