Using channels and containers in .NET programs

You can use channels and containers for connections to CICS® over the IPIC protocol. You must construct a channel before it can be used in an ECI request.

To construct a channel to hold containers add the following code to your application program:

C#:

Channel myChannel = new Channel("CHANNELNAME");

VB.NET:

Dim myChannel As New Channel("CHANNELNAME")

You can add containers with a data type of BIT or CHAR to your channel. Here is a sample BIT container:

C#:

byte [] custNumber = new byte []{1, 2, 3, 4, 5};
myChannel.CreateContainer("CUSTNO", custNumber);

VB.NET:

Dim custNumber() As Byte = {1, 2, 3, 4, 5}
myChannel.CreateContainer("CUSTNO", custNumber)

Here is a sample CHAR container:

C#:

String company = "IBM";
myChannel.CreateContainer("COMPANY", company);

VB.NET:

Dim company As String = "IBM"
myChannel.CreateContainer("COMPANY", company)

The channel and containers can now be used in an EciRequest, as the example shows:

C#:

EciRequest eciReq = new EciRequest();
eciReq.ServerName = "CICSA";
eciReq.Program = "CHANPROG";
eciReq.ExtendMode = EciExtendMode.EciNoExtend;
eciReq.Channel = myChannel;

gwyConnection.Flow(eciReq);


VB.NET:

Dim eciReq As New EciRequest()
eciReq.ServerName = "CICSA"
eciReq.Program = "CHANPROG"
eciReq.ExtendMode = EciExtendMode.EciNoExtend
eciReq.Channel = myChannel

gwyConnection.Flow(eciReq)

When the request is complete, you can retrieve the contents of the containers in the channel by interpreting the type, as this example shows:

C#:

Channel myChannel = eciReq.Channel;

foreach (Container aContainer in myChannel.GetContainers()) {
	Console.WriteLine(aContainer.Name);
	if (aContainer.Type == ContainerType.BIT) {
		byte[] data = aContainer.GetBitData();
	} else if (aContainer.Type == ContainerType.CHAR){
		String data = aContainer.GetCharData();
	}
}
VB.NET:

Dim myChannel As Channel = eciReq.Channel

For Each aContainer In myChannel.GetContainers()
	Console.WriteLine(aContainer.Name)
	If (aContainer.Type = ContainerType.BIT) Then
		Dim data() As Byte = aContainer.GetBitData()
	ElseIf (aContainer.Type = ContainerType.CHAR) Then
		Dim data As String = aContainer.GetCharData()
	End If
Next aContainer 

Concept Concept

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/prognet_chancon.html