Channel and container examples

Containers are named blocks of data designed for passing information between programs. Containers are grouped in sets called channels, which act as the interface between programs. Channels and containers offer the advantage that more than 32KB of data can be passed, and both character and binary data can be specified. Character data (or strings in Java terms) is automatically converted at the API level, whereas binary data (or a byte array in Java terms) is flowed unconverted. By contrast, COMMAREAs are confined to a 32KB limit and are unstructured byte arrays. Multiple containers can be passed between programs within a channel, providing a high degree of flexibility about how to structure data.

For introductory information about channels and containers, and guidance about using channels in non-Java™ applications, see Transferring data between programs using channels. For information about tools that allow Java programs to access existing CICS® application data, see Interacting with structured data from Java.

Table 1 lists the classes and methods that implement JCICS support for channels and containers.

Table 1. JCICS support for channels and containers
Methods JCICS class EXEC CICS Commands
containerIterator() Channel STARTBROWSE CONTAINER
createContainer() Channel  
delete() Channel DELETE CHANNEL
deleteContainer() Channel DELETE CONTAINER CHANNEL
getContainer() Channel  
getContainerCount() Channel QUERY CHANNEL
getName() Channel  
delete() Container DELETE CONTAINER CHANNEL
get() Container GET CONTAINER CHANNEL
getLength() Container GET CONTAINER CHANNEL NODATA
getDatatype() Container  
getName() Container  
put() Container PUT CONTAINER CHANNEL
getOwner() ContainerIterator  
hasNext() ContainerIterator  
next() ContainerIterator GETNEXT CONTAINER BROWSETOKEN
remove() ContainerIterator  
link() Program LINK
setNextChannel() TerminalPrincipalFacility RETURN CHANNEL
issue() StartRequest START CHANNEL
createChannel() Task  
getCurrentChannel() Task ASSIGN CHANNEL
containerIterator() Task STARTBROWSE CONTAINER

The CICS condition CHANNELERR results in a ChannelErrorException being thrown; the CONTAINERERR CICS condition results in a ContainerErrorException ; the CCSIDERR CICS condition results in a CCSIDErrorException.