Start of change

Creating channels and containers for ECI calls

You can use channels and containers when you use connect to CICS using the IPIC protocol. You must construct a channel and add containers to the channel before it can be used in an ECIRequest.

  1. Add the following code to your application program, to construct a channel to hold the containers:
    Channel myChannel = new Channel("CHANNELNAME")
  2. You can add containers with a data type of BIT or CHAR to your channel. Here is a sample BIT container:
    byte[] custNumber = new byte[]{0,1,2,3,4,5};
    myChannel.createContainer("CUSTNO", custNumber);
    and a sample CHAR container:
    String company = "IBM";
    myChannel.createContainer("COMPANY", company);
  3. The channel and containers can now be used in an ECIRequest, as the example shows:
    ECIRequest eciReq = new ECIRequest("CICSA", "USERNAME", "PASSWORD",  
            "CHANPROG",channel, ECIRequest.ECI_NO_EXTEND, 0); eciReq.flow();
  4. When the request is complete, you can retrieve the current state of the containers in the channel, as the example shows:
    Channel myChannel = eciReq.getChannel();
    		 		 		 
    for(Container container: myChannel.getContainers()){
       System.out.println(container.getName());
    		 		 		 		 
       if (container.getType() == ContainerType.BIT){
          byte[] data = container.getBITData();
       }
       if (container.getType() == ContainerType.CHAR){
          String data = container.getCHARData();
       }
    }
    If you are using this channel in an extended request, you must use the same channel object in subsequent flows.
End of change