You may be able to tell that we don't necessarily understand what you are trying to do.
Your first step is definitely to get your data structures sorted out. We have no idea how the OCCURS 87 and the 5000 relate to each other.
Separately from sorting out the data definition, get to know how to hand "tables" and "subscripting" by starting out with something very easy and becoming very familiar with it.
This you may have to read through several times, but don't worry. It does have some element of confusion, as you'll see from the explanation, but get some grip on it first, then try the really simple example, and through that become familiar with how to use single-dimension Cobol "subscripting". You'll use it a lot. There are a few more dimensions available, but leave those aside for now.
To reference data within a table (a data structure with OCCURS) you use "subscripting".
There are three ways to specify a subscript: a literal; a subscript (numeric data-name not directly related to table); an index (compiler-defined and managed storage, connected to table by name you give it).
DISPLAY TABLE-ENTRY ( 1 )
DISPLAY TABLE-ENTRY ( W-DESRIPTIVE-NAME-SUB )
DISPLAY TABLE-ENTRY ( I-DESCRIPTIVE-NAME-INDEX )
These uses are all called "subscripting" although using an index is also sometimes called "indexing".
A "subscript" is just a numeric item that you define. It is best if it is BINARY or COMP or COMP-4 or COMP-5. It's value when reference a table should be between 1 (one) and the maximum number of table entries. As it is a "normal" data definition, you can use all the normal verbs to manipulate it.
An "index" is defined by INDEXED BY on the OCCURS clause of the table. The Compiler defines the storage for it. You can only change the value of an index by SET, PERFORM ... VARYING ... and SEARCH/SEARCH ALL. An index can be used in conditions and of course for subscripting.
To add a little complexity, there is also USAGE INDEX. This is a field that you define in the DATA DIVISION but which has no PICture clause (meaning the Compiler defines the size and type of the storage). This, using the SET statement, can be used to store the value of an index (an INDEXED BY item), for instance the maxiumum number of entries in a table, expressed as an INDEX.
What does "expressed as an INDEX mean"? This relates to the difference between a subscript and an index. A subscript is just an integer. An index is the "offset" or "displacement" from the start of the table of the particular entry in the table whose value it is SET to.
If you SET an index to 1, the actual content of the index is zero, indicating the entry which is displacement zero from the start of the table, ie the first entry. If you SET an index to 2, the actual content of the index is the length of the entry, ie a displacement from the start of the table which arrives at the 2nd entry. SET an index to 3, and it has the value 2 times entry-length. Etc.
When you SET a USAGE INDEX item to the value of an index name, the "displacement" that the index contains is preserved in the USAGE INDEX item. When you SET an index to a USAGE INDEX item, the compiler knows that it already contains a displacement.
With a SET to a non-USAGE INDEX value, the compiler knows it is an "entry", and calculates the displacement of that entry, and sets the value of the index to that.
This sounds more complicated than it is, partly because of the mixed-nomenclature (subscript, subscripting, index, indexing, USAGE INDEX) and partly because you just haven't done it yet.
Another confusion is "reference modification" which looks a bit like subscripting, but isn't. The longer you can avoid reference-modification, the better (there are examples already in this topic).
The thing to do is to read the manual, the book, try out something really simple, see what happens, and go back to the manual/book to see if you now understand, if not, try again.
01 THE-DIGITS PIC X(10) VALUE "0123456789".
01 FILLER REDEFINES THE-DIGITS.
05 FILLER OCCURS 10 TIMES
INDEXED BY I-DIGIT-IND.
10 A-DIGIT PIC X.
01 W-DIGIT-SUBSCRIPT BINARY PIC 9(4).
You should try to come up with a number of ways to produce this output:
using DISPLAY A-DIGIT ( something )
As a start, here's the easiest
DISPLAY A-DIGIT ( 1 )
DISPLAY A-DIGIT ( 2 )
DISPLAY A-DIGIT ( 3 )
DISPLAY A-DIGIT ( 4 )
DISPLAY A-DIGIT ( 5 )
DISPLAY A-DIGIT ( 6 )
DISPLAY A-DIGIT ( 7 )
DISPLAY A-DIGIT ( 8 )
DISPLAY A-DIGIT ( 9 )
DISPLAY A-DIGIT ( 10 )
Don't worry if you don't get it first time, just be systematic. Read. Experiment. Read. Continue until understood. If you have problems, or are unclear about something, just post here.