You define a table in the CALLing program which is expected to be able to hold the maximum amount of data that would be possible.
Your program monitors use of this, so that if the limit is approached, something can be done about it (change a program).
There are other possibilities, but perhaps as a beginner you'd need help from some of your colleagues with them. You could, for instance, "obtain storage" from Language Environment in the CALLed program. Then pass a POINTER to this back to the CALLing program, which assigns the address contained in the POINTER to an item defined in the CALLing program's LINKAGE SECTION.
This can be more flexible, as the "limit" to your OCCURS then depends on available memory, not on something at compile time. However, you'd need to spend more time designing, coding, experimenting, testing, documenting, etc. If you have no clue where to start with that, then you'd only be able to consider it with support from someone more senior at your site.