Best Practice Channel and Container Conversion

Looking for technical guidance on Channels and Containers in COBOL on TS v5.5

Reviewing the Using IBM CICS TS Channels and Containers, it seems we have done exactly what IBM says NOT to do - we have created a gigantic COMMAREA that includes input, output and error fields. Additionally, data OCCURS 50 TIMES and is always present even when empty.

It looks like we should have split the COMMAREA record to input and output records. Within that it is possible to have mutliple records like header, and line which are written as individual containers within the channel. When the receiving program starts it needs to browse the channel to receive each container and then process the header container, then browse again to import the line container, then process. The output should be in a new container, again with header, line, but also error. The data passed should not include both request and response, just either request or response depending on incoming or outgoing process. Looking for confirmation that this is correct.

Also have the following questions related an example. We have an API that provides SKU inventory and price related to customer… Currently the copybook contains all the data required to request, reply and report errors. Within the record is a SKU list that occurs 50 times. Rather than doing this, it should be broken to 2 records incoming containing HEADER, SKULIST and 3 output HEADER, SKURESP, ERROR. My question is whether the list of 50 SKUs can be variable so that if only 10 are needed, for example, we don’t occupy the space of 50 every time. Would this be done by repeating each SKU in a container individually and then browsing for SKULIST container until there aren’t any more? Container needs individual name or can it be repeated in the container?

The examples and explanations in the Channels and Containers Redbook and other examples and discussions I find online don’t cover this clearly. The examples I’ve seen deal with a single record.