Using the CCI Connector for CICS TS

CICS® Java™ components that use the CCI Connector for CICS TS can be programmed in two ways. You can:
  1. Program directly to the connector's implementation of the Common Client Interface. This approach produces the best performance.
  2. Use a rapid application development (RAD) tool that provides visual interfaces and high-level constructs for programming the connector's Common Client Interface.

Whichever method you choose, you need to understand how to use the CCI Connector for CICS TS from a Java component running in CICS TS.

The logic a CICS enterprise bean should use to link to a back-end CICS program is shown in Figure 1. That is:
  1. Use the CICS-supplied sample program, CICSConnectionFactoryPublish, to publish a ConnectionFactory object suitable for use with the CCI Connector for CICS TS to the JNDI namespace used by the local CICS region. (See Using the sample utility programs to manage and acquire a connection factory.)
  2. Declare a ConnectionFactory object, and set it to the CICS connection factory by means of a JNDI lookup.
  3. Create an ECIConnectionSpec object. Set its properties as necessary.
    Note: This step is included for completeness. However, any userid or password specified in the ECIConnectionSpec object is ignored by CICS.
  4. Use the ConnectionFactory to create a Connection object. This object represents a single connection to CICS.
  5. Create an Interaction object from the Connection object.
  6. Create an ECIInteractionSpec object. Set its properties, including the name of the target program and the mode—synchronous or asynchronous—of the interaction. (For CICS TS, only synchronous mode is supported.)
  7. Create two Record objects, to represent the input and output communications areas of the target program.
  8. Run the execute method of the Interaction object, passing the ECIInteractionSpec, and the input and output Record objects, as arguments.
  9. Retrieve the data returned by the target program from the output Record object.
  10. Execute the close method of the Interaction object.
  11. Execute the close method of the Connection object.
Note: To specify the CICS server region which owns the program to be linked to, use the local PROGRAM definition of the server program. The PROGRAM definition should specify the location of the server program (local or remote) and, if it's remote, whether or not dynamic routing should occur.
Important: We recommend that you get the Javadoc for the CCI Connector architecture API from the Sun Web site. This will help you code your CCI applications. It also provides information such as the exceptions used by CCI implementations. Javadoc for the CICS-specific ECIConnectionSpec and ECIInteractionSpec classes is in the CCI Connector for CICS TS: Class Reference, in the CICS Information Center.