Figure 1 shows the current channel for a series of programs involved in a sample application.
Typically, programs that exchange a channel are written to handle that channel (i.e., both client and server programs know the name of the channel and names and numbers of the containers in that channel). However, if, for example, a server program or component is written to handle more than one channel, on invocation it must ascertain which of the possible channels it has been passed.
A program can discover its current channel by issuing the EXEC CICS ASSIGN CHANNEL command. If there’s no current channel, this command returns blanks. The program also can retrieve the names of containers in its current channel by browsing, but typically, this isn’t necessary. A program written to handle several channels is often coded to be aware of the names and numbers of the containers in each possible channel. To get the names of the containers in the current channel, use these BROWSE commands:
EXEC CICS STARTBROWSE CONTAINER
EXEC CICS GETNEXT CONTAINER(data-area)
EXEC CICS ENDBROWSE CONTAINER