Creating Java channels and containers for ECI calls

You can use channels and containers when you connect to CICS® using the IPIC protocol. You must construct a 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);
    jgateway.flow(eciReq);
  4. When the request has completed, you can retrieve the contents of the containers in the channel by interpreting the type, for example:
    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();
       }
    }

Information Information

Feedback


Timestamp icon Last updated: Tuesday, 19 November 2013


https://ut-ilnx-r4.hursley.ibm.com/tgzos_latest/help/topic/com.ibm.cics.tg.zos.doc//progdezos/ecichannelcontainer.html