You can use the setCommareaOutboundLength method to ensure that only the data required by the server program is transmitted.
You can use the setCommareaInboundLength method to restrict the length of the data that the Java™ Client application receives back from CICS. If you use setCommareaInboundLength, the CICS Transaction Gateway does not remove trailing nulls from the inbound data.
The CICS server adds trailing nulls to the data received to extend it to the length specified in Commarea_Length so that the server program always receives a full COMMAREA.
The server program only returns the data required by the Java Client application. The Client daemon adds trailing nulls to the data received so that the CICS Transaction Gateway receives a full COMMAREA.
The CICS Transaction Gateway strips the trailing nulls from the COMMAREA before transmitting the data to the Java Client application.
The Java Client application must add nulls to the data to bring it up to the full size of the COMMAREA.
If the Java Client application is running locally on z/OS®, a similar procedure takes place, but the improvement in performance is not as great.