       IDENTIFICATION DIVISION.
       PROGRAM-ID. SearchVarying.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 TBL.
           05 ITEM PIC X(2) OCCURS 5 TIMES INDEXED BY IX.
       01 IDX PIC 9(9) VALUE 1.
       PROCEDURE DIVISION.
           MOVE "AA" TO ITEM(1)
           MOVE "BB" TO ITEM(2)
           MOVE "CC" TO ITEM(3)
           SEARCH TBL VARYING IDX
               AT END DISPLAY "NOT FOUND"
               WHEN ITEM(IDX) = "BB" DISPLAY "FOUND AT " IDX
           END-SEARCH
           STOP RUN.
