本示例显示了称为 Payroll 的 Java 类的摘录,它能调用名为 PAYR 的 COBOL 服务器程序。Payroll 类使用 JCICS com.ibm.cics.server.Channel 和 com.ibm.cics.server.Container 类来处理通道和其容器
import com.ibm.cics.server.*;
public class Payroll {
...
Task t=Task.getTask();
// create the payroll_2004 channel
Channel payroll_2004 = t.createChannel("payroll-2004");
// create the employee container
Container employee = payroll_2004.createContainer("employee");
// put the employee name into the container
employee.put("John Doe");
// create the wage container
Container wage = payroll_2004.createContainer("wage");
// put the wage into the container
wage.put("2000");
// Link to the PAYROLL program, passing the payroll_2004 channel
Program p = new Program();
p.setName("PAYR");
p.link(payroll_2004);
// Get the status container which has been returned
Container status = payroll_2004.getContainer("status");
// Get the status information
byte[] payrollStatus = status.get();
...
}