Understanding SQL Processing

The main activities involved in processing CICS transactions with SQL calls are:

These main activities are performed for each transaction.


Creating an SQL Session

An SQL session is created when the application executes the first SQL statement. The following activities occur, when creating an SQL session:

  1. The CICS system ID is used to retrieve the server definition (CXGMSRV TYPE=CXX) to locate the CXGSERV connection.

  2. The CICS System ID is used to retrieve the server definition (CXGMSRV TYPE=CXX) to locate the JDBC Server connection.

  3. The transaction ID is used to determine the following transaction attributes (CSGMTRAN):

    • User identity schema;

    • JDBC DSN;

    • CONNECT options.

  4. Security tokens are used to retrieve security definitions from the CXGCIACF module.

  5. A CXGSERV session is created.

  6. An SQL session is created by generating and executing a CONNECT statement.

Processing an SQL Statement

The following activities occur when processing an SQL statement:

  1. The SQL statement is forwarded to the CXGSERV session.

  2. CXGSERV passes the statement to the JDBC server, where the SQL statement is processed.

  3. The results of the SQL statement are returned to the CXGSERV session.

  4. CXGSERV forwards the results to CXGCICS, where they are posted in the application.

Performing COMMIT and ROLLBACK Processing

A COMMIT or ROLLBACK process is executed when a syncpoint is requested by CICS. The following activities occur when processing a COMMIT or ROLLBACK request:

  1. CICS passes a syncpoint request to CXGCICS.

  2. CXGCICS passes either a COMMIT or a ROLLBACK statement, depending upon the request type, to CXGSERV.

  3. CXGSERV passes the statement to the JDBC server.

  4. The JDBC Server executes the statement and returns a completion code .

  5. CXGSERV forwards the completion code to CXGCICS, where it is evaluated.

  6. CXGCICS returns control to CICS.

Terminating the SQL Session

The SQL session is terminated when the task terminates; the CICS termination managers indicate an end-of-task. The following activities occur when terminating an SQL session:

  1. A DISCONNECT statement is executed to terminate the JDBC server connection.

  2. A DELETE SESSION command is issued to terminate the CXGSERV thread.