Overview

The IBM CICS Transaction Gateway (IBM CTG) connector provides integration with back-end CICS applications using the CICS Transaction Gateway. For Java platforms, CTG implements the JCA resource adapter to connect Java applications to the CICS system. The connector serves as a handrail between Mule applications and the CTG.

Read through this user guide to understand how to set up and configure a basic flow using the connector. Track feature additions, compatibility, limitations, and API version updates with each release of the connector using the Connector Release Notes. Review the connector operations and functionality using the Technical Reference along side the demo applications.

MuleSoft maintains this connector under the Premium support policy.

Important Concepts

This document assumes that you are familiar with Mule, Anypoint Connectors, and Anypoint Studio. To increase your familiarity with Studio, consider completing a Anypoint Studio Tutorial. This page requires basic knowledge of Mule Concepts, Elements in a Mule Flow, and Global Elements.

IBM CICS Reference

  • CICS (Customer Information Control System): set of enterprise application servers with support for high-transaction workloads in a secure, scalable, cost efficient environment. CICS applications are written in a variety of languages, from Java to COBOL.

  • CICS TG (CICS Transaction Gateway): set of client and server software components that allow a remote client application to invoke services in a CICS region. The client application can be either a Java application or a non-Java application. The CICS TG is available through the following two products: CICS TG on z/OS and CICS TG for Multiplatforms

  • CICS Region: named collection of resources that are controlled by CICS as a unit. A CICS resource is any facility or component of a CICS system that is required to perform a task.

  • JCA: standard architecture for connecting the J2EE platform to heterogeneous Enterprise Information Systems (EIS), such as CICS. The JCA enables an EIS vendor to provide a standard resource adapter for its EIS. A resource adapter is the middle tier between a Java application and an EIS and connects the Java application to the EIS.

  • ECI (External Call Interface): simple remote procedural call style interface, used for linking to CICS applications. The COMMAREA or channel is the data interface used for the exchange of data between the client application and the CICS.

  • COMMAREA: block of contiguous memory used to pass data between programs. It is the binary equivalent of a COBOL structure and it is character-based.

Hardware and Software Requirements

For hardware and software requirements, visit the Connector Release Notes.

How to Install

You can install the connector in Anypoint Studio using the instructions in Installing a Connector from Anypoint Exchange.

Upgrading from an Older Version

If you’re currently using an older version of the connector, a small popup appears in the bottom right corner of Anypoint Studio with an "Updates Available" message.

  1. Click the popup and check for available updates. 

  2. Click the Connector version checkbox, click Next, and follow the instructions provided by the user interface. 

  3. Restart Studio when prompted. 

  4. After restarting, when creating a flow and using the connector, if you have several versions of the connector installed, you may be asked which version you would like to use. Choose the version you would like to use.

Additionally, we recommend that you keep Studio up to date with its latest version.

Connector Namespace and Schema

When designing your application in Anypoint Studio, when you drag the connector from the palette onto the Anypoint Studio canvas, Studio automatically populates the XML code with the connector namespace and schema location.

Namespace: http://www.mulesoft.org/schema/mule/ibm-ctg
Schema Location: http://www.mulesoft.org/schema/mule/connector/current/mule-ibm-ctg.xsd

If you are manually coding the Mule application in Studio’s XML editor or another text editor, define the namespace and schema location in the header of your Configuration XML, inside the <mule> tag.
1
2
3
4
5
6
7
8
9
10
11
12
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:ibm-ctg="http://www.mulesoft.org/schema/mule/ibm-ctg"
      xsi:schemaLocation="
               http://www.mulesoft.org/schema/mule/core
               http://www.mulesoft.org/schema/mule/core/current/mule.xsd
               http://www.mulesoft.org/schema/mule/ibm-ctg
               http://www.mulesoft.org/schema/mule/ibm-ctg/current/mule-ibm-ctg.xsd">

      <!-- put your global configuration elements and flows here -->

</mule>

Note: Use current in the schema path. Studio interprets this to the current Mule version.

Maven Dependency Information

For Maven dependency management, include this XML snippet in your pom.xml file.

1
2
3
4
5
<dependency>
  <groupId>org.mule.modules</groupId>
  <artifactId>mule-ibmctg-connector</artifactId>
  <version>1.0.0</version>
</dependency>

Inside the <version> tags, put the desired version number.

How to Configure

Place the connector in your flow as applicable for your use case.

To use the IBM CTG connector in your Mule application, you must configure a global IBM CTG Configuration element that can be used by the connector (read more about Global Elements). The IBM CTG connector provides the following global configuration:

General

Field Description

Host

Enter the host name of the CICS TG.

Port

Enter the port on which the CICS TG is running. Default value is 2006.

Server Name

Enter the name of the target CICS server as defined in the CICS TG configuration file. Optional.

Username

Enter the CICS user ID. Optional, if security is NOT enabled in the CICS region.

Password

Enter the password for the CICS user ID. Optional, if security is NOT enabled in the CICS region.

Connection Timeout

Enter the socket timeout for the connection to CTG. Default value is 0 (no timeout).

Keystore Location

Enter the location of the keystore containing the certificates required for an SSL connection. Optional.

Keystore Password

Enter the password required to access the keystore for an SSL connection. Optional.

CTG Trace

If checked, all debug levels of CTG tracing are turned on. Default value is false.

Required Dependencies

  • ccf2.jar (CICS Common Connector Framework)

  • cicsjee.jar (CICS JEE)

  • ctgclient.jar (CTG Client Library)

  • ctgserver.jar (CTG Server Library)

  • geronimo-j2ee-connector_1.6_spec-1.0.jar

    It is advisable to use the JAR files that come bundled within the installation of the CTG server instead of downloading the SDK ZIP from IBM’s website to ensure the compatibility between the connector and the CTG system.

ctg-config

Operations

The IBM CTG connector supports the following two outbound operations:

Name Description

Execute

Invokes a CICS program with data encapsulated as channels and containers.

Execute using COMMAREA

Invokes a CICS program with data encapsulated as a COMMAREA. Requests are limited to a maximum of 32 KB.

Common Use Cases

For a successful run of use cases 1 to 3, the CICS programs invoked must to be available on the target CICS system.

Invoke a COMMAREA Program

This application calls EC01, a COMMAREA-based program that outputs the current datetime in a formatted EBCDIC string.

use-case-1

  1. Create a new Mule Project in Anypoint Studio and fill in the IBM CTG credentials in src/main/resources/mule-app.properties.

    1
    2
    3
    4
    5
    
    ctg.host=<HOST>
    ctg.port=<PORT>
    ctg.serverName=<SERVER_NAME>
    ctg.username=<USERNAME>
    ctg.password=<PASSWORD>
  2. Drag an HTTP connector onto the canvas and leave the default values for Host and Port and set the path to /test/ec01.

  3. Drag an IBM CTG component onto the canvas and add a new Global Element to configure a standard (non-SSL) connection.

    Parameter Value

    Host

    ${ctg.host}

    Port

    ${ctg.port}

    Server Name

    ${ctg.serverName}

    Username

    ${ctg.username}

    Password

    ${ctg.password}

    Click the Test Connection option to confirm that Mule can connect with the IBM CTG instance. If the connection is successful, click OK to save the configuration. Otherwise, review or correct any invalid parameters and test again.
  4. Double-click the IBM CTG component, select the operation Execute and configure the following parameters:

    Parameter Value

    Content Reference

    #[payload]

    Request Reference

    #[flowVars.commareaRequest]

  5. Add a Transform Message between the HTTP and the IBM CTG components. The connector does not provide dynamic/static metadata but allows users to define custom types using the Metadata Type tool.

    1. Define the input metadata according to section Add Custom Metadata using the schema file ec01-type.ffd:

      1
      2
      3
      4
      5
      6
      7
      
      form: COPYBOOK
      id: 'DFHCOMMAREA'
      values:
      - { name: 'LK-DATE-OUT', type: String, length: 8 }
      - { name: 'LK-SPACE-OUT', type: String, length: 1 }
      - { name: 'LK-TIME-OUT', type: String, length: 8 }
      - { name: 'LK-LOWVAL-OUT', type: String, length: 1 }
    2. Map the fields in the DataWeave transformer.

      1
      2
      3
      4
      5
      6
      7
      8
      9
      
      %dw 1.0
      %output text/plain schemaPath = "ec01-type.ffd", segmentIdent = "DFHCOMMAREA", encoding="cp037"
      ---
      [{
          LK-DATE-OUT: "",
          LK-SPACE-OUT: "",
          LK-TIME-OUT: "",
          LK-LOWVAL-OUT: ""
      }]
    3. Create a flowVar named commareaRequest and configure the following fields (see section Load Java Metadata):

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      
      %dw 1.0
      %output application/java
      ---
      {
              commareaLength: 18,
              encoding: "IBM037",
              programName: "EC01",
              replyLength: 18,
              tpnName: "CSMI"
      } as :object {
              class : "org.mule.modules.ibmctg.internal.model.CommareaRequest"
      }

      See section Load Java Metadata to obtain metadata for the CommareaRequest.

  6. Add a Transform Message after the IBM CTG to extract the results in a JSON format.

    1
    2
    3
    4
    5
    6
    7
    
    %dw 1.0
    %output application/json
    ---
    {
            date: payload[0].LK-DATE-OUT,
            time: payload[0].LK-TIME-OUT
    }
  7. Add a Logger at the end of the flow.

  8. Save the changes and deploy the Mule Application. Open a browser and make a request to http://localhost:8081/ec01. The result should be similar to:

    {
        date: "06/09/17",
        time: "13:41:17"
    }

Invoke a Channel Program

This application calls EC03, a channel-based program that takes an input data container and returns three containers:

  • A data/time container.

  • The length of the input data and returns uses channels and containers in a CICS program.

  • An output container that contains a copy of the input data, or an error message.

use-case-3

  1. Perform steps 1 to 3 from the previous example and set the HTTP path to /ec03.

  2. Double-clic the IBM CTG component, select the operation Execute and configure the following parameters:

    Parameter Value

    Content Reference

    #[payload]

    Request Reference

    #[flowVars.request]

  3. Add a Transform Message between the HTTP and the IBM CTG components.

    1. Define the input metadata according to section Add Custom Metadata using the schema file ec03-type.ffd:

      1
      2
      3
      4
      
      form: COPYBOOK
      id: 'DFHCOMMAREA'
      values:
      - { name: 'CICS-DATE-TM', type: String, length: 8 }
    2. Map the fields in the DataWeave transformer.

      1
      2
      3
      4
      5
      6
      
      %dw 1.0
      %output text/plain schemaPath = "ec03-type.ffd", segmentIdent = "DFHCOMMAREA", encoding="cp037"
      ---
      [{
              CICS-DATE-TM: ""
      }]
    3. Create a flowVar named request and configure the following fields (see section Load Java Metadata):

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      
      %dw 1.0
      %output application/java
      ---
      {
              channel: "EC03",
              encoding: "US-ASCII",
              errorContainer: "OUTPUTMESSAGE",
              programName: "EC03",
              requestContainer: "INPUTDATA",
              responseContainer: "CICSDATETIME",
              tpnName: "CSMI"
      } as :object {
              class : "org.mule.modules.ibmctg.internal.model.ChannelRequest"
      }
  4. Add a Transform Messager after the IBM CTG to convert the result into readable format.

  5. Add a Logger at the end of the flow.

  6. Save the changes and deploy the Mule Application. Open a browser and make a request to http://localhost:8081/ec03. The result should be similar to:

    {
       cics-date-time: "06/09/2017 13:57:25"
    }

Invoke a COMMAREA or Channel Program inside a Transactional Scope

This application calls EC02, a COMMAREA-based program that returns a simple run counter.

use-case-2

  1. Perform steps 1 to 3 from the previous example and set the HTTP path to /test/ec02.

  2. In the Global Elements tab, add a new Bitronix Transaction Manager without further configurations.

  3. Drag a Transactional element next to the HTTP and configure according to the table below:

    Parameter Value

    Type

    XA Transaction

    Action

    BEGIN_OR_JOIN

  4. Double-clic the IBM CTG component, select the operation Execute using COMMAREA and configure the following parameters:

    Parameter Value

    Content Reference

    #[payload]

    Request Reference

    #[flowVars.request]

  5. Add a Transform Message between the HTTP and the IBM CTG components. The connector does not provide dynamic/static metadata but allows users to define custom types using the Metadata Type tool.

    1. Define the input metadata according to section Add Custom Metadata using the schema file ec02-type.ffd:

      1
      2
      3
      4
      
      form: COPYBOOK
      id: 'DFHCOMMAREA'
      values:
      - { name: 'LK-COUNT', type: String, length: 40 }
    2. Map the fields in the DataWeave transformer.

      1
      2
      3
      4
      5
      6
      
      %dw 1.0
      %output text/plain schemaPath = "ec02-type.ffd" , segmentIdent = "DFHCOMMAREA", encoding="cp037"
      ---
      [{
              LK-COUNT: "000001234TH RUN OF EC02"
      }]
    3. Create a flowVar named request and configure the following fields (see section Load Java Metadata):

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      
      %dw 1.0
      %output application/java
      ---
      {
              commareaLength: 18,
              encoding: "IBM037",
              programName: "EC01",
              replyLength: 18,
              tpnName: "CSMI"
      } as :object {
              class : "org.mule.modules.ibmctg.internal.model.CommareaRequest"
      }
  6. Add a Transform Message after the IBM CTG to extract the results in a JSON format.

    1
    2
    3
    4
    5
    6
    7
    
    %dw 1.0
    %output application/json
    ---
    {
            count: trim payload[0].LK-COUNT,
            lowVal: payload[0].LK-LOWVAL
    }
  7. Add a Logger at the end of the flow.

  8. Save the changes, deploy the Mule Application. Open a browser and make a request to http://localhost:8081/ec02. The result should be similar to:

    {
        count: "000001235TH RUN OF EC02",
        lowVal: null
    }

Add Custom Metadata

The IBM CTG connector does not provide dynamic or static metadata out-of-the-box, but allows users to define custom types using the Metadata Type tool. Follow the below guide to define input and output metadata:

  1. Place a schema file under src/main/resources directory, normally in .ffd format.

    These schema files must be supplied by the user. They can be obtained from COBOL copybooks, which are included in the CICS installation.
  2. Go to the Metadata tab of the connector operation and click the Add metadata button.

    • Select Input:Payload and click the Edit icon to open de Metadata Editor.

      custom-metadata

  3. Click Add to create a new type and provide and ID for it (i.e. ec01-in-type for the program EC01 input data).

  4. Select type Copybook, then Schema and provide the location of the schema file.

  5. This will populate a drop-down with a list of available data segments. Choose the one you need and click the Select button to save the configuration.

    custom-metadata-2

  6. Drag a DataWeave transformer before the IBM CTG component. Metadata fields will become available to build the mapping.

    custom-metadata-3

Metadata definition is not a required step to use the IBM CTG connector but it is essential to improve the usability of the connector. Refer to Defining Metadata for additional information.

Load Java Metadata

Inside DataWeave, click the "Define Metadata" link to open the Metadata window.

  1. Click Add and provide the an ID, such as "CommareaRequest".

  2. Select type Java, then Java object in the Data Structure table.

  3. Search the class CommareaRequest (or the fully qualified name org.mule.modules.ibmctg.internal.model.CommareaRequest) and click OK. custom-metadata-4

  4. Click the Select button to save the configuration.

  5. Perform the same steps to load metadata for the ChannelRequest type.

Connector Performance

To define the pooling profile for the connector manually, access the Pooling Profile tab in the applicable global element for the connector.

For background information on pooling, see Tuning Performance.

Resources