Discovering which containers were passed to a program

When a program is invoked, it can determine the names of the channel, and any containers that were passed to it.

Typically, programs that exchange a channel are written to handle that channel. That is, both client and server programs know the name of the channel, and the names and number of the containers in the channel. However, if, for example, a server program or component is written to handle more than one channel, on invocation it must discover which of the possible channels were passed to it.

A program can discover its current channel—that is, the channel with which it was invoked—by issuing an EXEC CICS ASSIGN CHANNEL command. (If there is no current channel, the command returns blanks.)

The program can count the number of containers that are in its current channel by issuing an EXEC CICS QUERY CHANNEL command. The command can be used with any channel, so the program must discover the name of the current channel first and specify it on the command. The program can also get the names of the containers in its current channel by browsing. Typically, these operations are not necessary. A program written to handle several channels is often coded to be aware of the names and number of the containers in each possible channel.

To get the names of the containers in the current channel, use the browse commands:

  • EXEC CICS STARTBROWSE CONTAINER BROWSETOKEN( data-area ) .
  • EXEC CICS GETNEXT CONTAINER( data-area ) BROWSETOKEN( token ).
  • EXEC CICS ENDBROWSE CONTAINER BROWSETOKEN( token ).

Having retrieved the name of its current channel and, if necessary, the number or names of the containers in the channel, a server program can adjust its processing to suit the kind of data that was passed to it.



dfhp3_ch_whichcon.html | Timestamp icon Last updated: Monday, 5 June 2017