Creating the JCICS examples

Create the JCICS example projects to understand how to develop Java™ applications that can run in CICS®.

About this task

JCICS examples are provided by two options CICS Bundle JDBC Example and CICS Bundle OSGi Example. After you follow the procedure to create the CICS Bundle JDBC Example, repeat step 3 through step 6 to create the CICS Bundle OSGi Example.

Important: If you are using IBM® CICS Explorer® or an Eclipse-based IDE running version 2022-03 or later, your default compiler compliance level must match the Java version of the target runtime to which the application or sample is deployed to avoid issues. You can change this setting in IBM CICS Explorer by selecting Preferences, then Java, and then Compiler.

Procedure

  1. In the Eclipse IDE, open the Java perspective.
  2. Set the target platform to the latest release of CICS to work with the JCICS examples.
    Otherwise, compilation errors can occur when you create the examples in your workspace.
    1. Click Window > Preferences from the workbench menu bar.
    2. Expand Plug-in Development and click Target Platform.
    3. Click Add to create a target definition.
    4. Click Template and select CICS TS 5.6 from the list.
    5. Click Next in the wizard and then click Finish.
    6. Select the target definition and click Apply.
  3. To create an example plug-in project, use one of the following methods to open the New Example wizard:
    • In the Eclipse menu bar, click File > New > Example.
    • Click the down arrow on the New icon and click Example.
    • In the Project Explorer or Package Explorer view, right-click and click New > Example.
  4. In the CICS Examples > Java folder, select one of the following examples, then click Next:
    • CICS Bundle JDBC Example. This example demonstrates how to connect to Db2® using the JDBC DriverManager interface.
    • CICS Bundle OSGi Example. This example demonstrates how to create a CICS bundle to deploy to CICS.
  5. Click Finish.
    Eclipse creates the plug-in project that contains the example.
    Tip: If the project does not build and the following error occurs, ensure that you completed step 2 successfully:
    Bundle 'com.ibm.cics.server' cannot be resolved
  6. Expand the project in the Package Explorer view.
    • The Plug-in Dependencies folder contains the dependencies for the OSGi bundle. This information is also captured in the manifest of the project.
    • The src folder contains the Java source for the examples. You can browse the source files to see the JCICS classes that are used and use the context help to look up a specific class. You can also open the Javadoc view to see the API details for the selected content, for example a method or class.
    • The META-INF folder contains the manifest for the project. The manifest contains the OSGi headers to describe the OSGi bundle.
  7. Create plug-in projects for other examples by using the New Example wizard.
    You can view the Java source to understand how the JCICS classes are used for working with programs.

Results

You have created plug-in projects in Eclipse for the JCICS examples. These projects contain OSGi bundle packaging information, including plug-in dependencies and target Java environments.