Using channels and containers in ECI V2 applications

You can use channels and containers when you connect to CICS® using the IPIC protocol. You must create a channel before it can be used in an ECI request.

  1. Add the following code to your application program, to create a channel:
    ECI_ChannelToken_t chanToken;
    createChannel(&chanToken); 
  2. You can add containers with a data type of BIT or CHAR to your channel. Here is a sample BIT container:
    int custNumber = 12345; 
    rc = ECI_createContainer(chanToken, "CUSTNO", ECI_BIT, 0, &custNumber, sizeof(custNumber)); 
    char custNumber[] = {0,1,2,3,4,5}; 	
    rc = ECI_createContainer(chanToken, "CUSTNO", ECI_BIT, 0, custNumber, 
    sizeof(custNumber));
    Here is a sample CHAR container that uses the CCSID of the channel:
    char * company = "IBM"; 	
    rc = ECI_createContainer(chanToken, "COMPANY", ECI_CHAR, 0, company, strlen(company)); 
    char * company = "IBM"; 	
    rc = ECI_createContainer(chanToken, "COMPANY", ECI_CHAR, 0, company, 
    strlen(company)); 
  3. The channel can now be used in an ECI request, as the example shows:
    CTG_ECI_PARMS eciParms = {0};
    
    eciParms.eci_version = ECI_VERSION_2A;
    eciParms.eci_call_type = ECI_SYNC;
    strncpy(eciParms.eci_system_name, "CICSA", ECI_SYSTEM_NAME_LENGTH);
    eciParms.eci_userid_ptr = "USERNAME";
    eciParms.eci_password_ptr = "PASSWORD";
    strncpy(eciParms.eci_program_name, "CHANPROG", ECI_PROGRAM_NAME_LENGTH);
    eciParms.eci_extend_mode = ECI_NO_EXTEND;
    eciParms.channel = chanToken; 
  4. When the request is complete, you can retrieve the current state of the containers in the channel, as the example shows:
    ECI_CONTAINER_INFO contInfo;
    
    rc = ECI_getFirstContainer(chanToken, &contInfo);
    
    while (rc == ECI_NO_ERROR) { 
        printf("Container %s\n", contInfo.name);  
    
        if (contInfo.type == ECI_BIT) { 
             printf("Type BIT\n"); 
        } else { 
             printf("Type CHAR\n"); 
        }  
    
        /* Read block of data into buffer */ 
        ECI_getContainerData(channelToken, contInfo.name, dataBuff, 
           sizeof(dataBuff), offset, &bytesRead);  
    
        rc = ECI_getNextContainer(chanToken, &contInfo); 
    }