Deleting channels and containers and freeing their storage

Containers can be large objects, so it is important to manage the storage of these objects correctly to avoid causing your CICS® regions to become short of storage. CICS automatically deletes containers and channels when they can no longer be used by the applications that had access to them. Applications can also issue commands to delete individual containers or complete channels.

When an application creates a channel by naming it for the first time on a command, and adds containers to it, CICS uses 64-bit storage (above 2 GB) for the data that is held in the containers. The use of 64-bit storage for channels and containers influences the value that you choose for the z/OS® MEMLIMIT parameter that applies to the CICS region. You must also allow for other CICS facilities that use 64-bit storage. For more information, see Estimating, checking, and setting MEMLIMIT.

When an application program issues a GET CONTAINER command with the SET option, CICS creates a copy of the container in task storage, either in 24-bit storage (below 16 MB) or 31-bit storage (above 16 MB but below 2 GB), according to the DATALOCATION setting in the resource definition for the program. The application program can work with the contents of the container, and then use the PUT CONTAINER command to copy it back to 64-bit storage (above 2 GB). Non-Language Environment (LE) AMODE(64) assembly language application programs can work directly with channels and containers in 64-bit storage, by using PUT64 CONTAINER and GET64 CONTAINER commands.

Take care not to create so many large containers that you limit the amount of storage available to other applications. When you need to pass a large amount of data, split it between multiple containers, rather than put it all into one container. When you create a container, CICS checks if the action would cause the total 64-bit storage allocated for the transaction to exceed 5% of the MEMLIMIT value. In that situation, CICS issues warning message DFHPG0400 and does not create the container.

Deleting containers and freeing their storage

CICS automatically frees the 64-bit storage (above 2 GB) for all the containers that are on a channel when the channel goes out of scope in all programs in the link stack. The scope of a channel is the code from which it can be accessed, including the program that created the channel, and the programs to which the channel was passed. The exception is the transaction channel DFHTRANSACTION, which is available to all the programs in a transaction, and does not go out of scope when the link level changes. For more information about channel scope, see The scope of a channel.

If you want a container to be deleted before the channel goes out of scope, you can issue the DELETE CONTAINER command in an application program to delete a named container explicitly. When the command is issued, any data that is contained in the channel is discarded, and the 64-bit storage that was used for the container is freed. The application program that owns a channel can also delete all the containers that are in a channel by issuing the DELETE CHANNEL command.

When a program issues the GET CONTAINER command and CICS creates a copy of the container for the program to use, CICS maintains the copy of the container in 24-bit storage or 31-bit storage until any of the following occurs:
  • A subsequent GET CONTAINER or GET64 CONTAINER command with the SET option, for the same container in the same channel, is issued by any program that can access this storage.
  • The container is deleted by a DELETE CONTAINER command.
  • The container is moved by a MOVE CONTAINER command.
  • The channel goes out of program scope.
  • The channel, and the containers that are in it, are deleted by a DELETE CHANNEL command.
When any of these events takes place, the copy of the container in 24-bit storage or 31-bit storage is deleted.

Deleting channels and freeing their storage

CICS automatically frees the 64-bit storage (above 2 GB) for a channel and for all the containers that are on it when the channel goes out of scope. Any copies of containers in the channel that still exist in 24-bit storage or 31-bit storage are also deleted at that time.

If you want to delete a whole channel before it goes out of scope, you can issue the DELETE CHANNEL command in an application program. The command deletes any containers that remain on the channel in a single operation. All the 64-bit storage used for the channel and its remaining containers is freed, and any copies of containers in the channel that still exist in 24-bit storage or 31-bit storage are also deleted.

The application program that issues the DELETE CHANNEL command must be the program that owns the channel. The program that owns the channel is the program that created the channel by naming it on one of the following commands:
  • LINK PROGRAM CHANNEL
  • MOVE CONTAINER CHANNEL TOCHANNEL
  • PUT CONTAINER CHANNEL
  • PUT64 CONTAINER
  • RETURN TRANSID CHANNEL
  • START TRANSID CHANNEL
  • XCTL PROGRAM CHANNEL
  • WEB RECEIVE TOCHANNEL
  • WEB CONVERSE TOCHANNEL
An application program cannot delete the following channels:
  • The current channel for the application program, that is, the channel with which the program was invoked.
  • Any channel that the application program did not create.
  • Any channel that is read-only.
  • The transaction channel DFHTRANSACTION.