You are currently on IBM Systems Media’s archival website. Click here to view our new website.

MAINFRAME > Administrator > CICS

IBM CICS Asynchronous API Allows for More Natural Program Creation

CICS Asynchronous API

One of the new features of CICS* Transaction Server (TS) V5.4 is the asynchronous API, making it easy to orchestrate concurrent logic in your CICS programs. This article explores some of the design choices made while developing the API, as well as demonstrates how to take advantage of it and its benefits.

Concurrent Processing

An important property of most CICS programs is the time it takes to execute. For example, an ATM may require a response within five seconds and any back-end system it calls must respond in that time. Typically the service-level agreement (SLA) outlines these expectations. With a program consisting of a set of sequential instructions, the obvious thing to do is to minimize the time these instructions take to execute. But doing this can only take you so far.

The next obvious step to reducing execution time is to run parts of a program concurrently. This has been the subject of much research in the field of computer science, with several different implementations in wide use. Threads and locks, and the management they require, are common technologies. However, lock management quickly becomes complicated, largely because the concurrency model often isn’t natural for the programmer and the problem he or she is trying to solve.

Communicating Sequential Processes, a language developed by C.A.R. Hoare in the 1970s, allows for a more natural style of encoding concurrency into programs. The basic concept is to construct a program out of entities that communicate by message passing alone and share no state. A related development is the actor model; descendent implementations of these technologies can be found in the Erlang and Golang languages.

These schemes fit our own human model of concurrency well. For example, consider email. You—an actor in this system—could be emailed and asked to provide some information to someone. To reply, you first email two people, asking them to perform different tasks. When they reply to say they’ve completed their tasks, returning any information you asked for, you in turn can respond to the original request.

Create Concurrent Programs

This brings us to CICS. Existing ways of performing asynchronous processing in CICS include TS Queues and polling, and/or EXEC CICS START invocations. Introduced in CICS TS V5.4 is a set of API commands, providing a more natural way of creating concurrent programs.

In the actor-style model of concurrency, entities (actors) start child entities (other actors); the entities here are defined to be CICS tasks. The message passing semantics for communication between entities (CICS tasks) is achieved with channels and containers, an existing technology in CICS.

First, we introduce a command to start child tasks in the CICS region:



While similar to the EXEC CICS START command, crucially with this command the CICS program returns a unique identifier of the child task. This command, much like sending an email to someone asking to perform some work, is non-blocking. Once sent, you can carry on with your own work. The same is true of this parent task in CICS: it’s free now to continue its own processing while this child task carries out its work.

When the parent task needs the results from the child, it can wait (and block its processing) until the child has returned with information, much like checking your email and waiting for an email to turn up in your inbox. To achieve this, use the first FETCH command:




Chris Poole is an IBM Master Inventor working on the CICS Development team.



2019 Solutions Edition

A Comprehensive Online Buyer's Guide to Solutions, Services and Education.

A Checkup for CICS Transaction Server V3.2

Upgrade offers improved performance and enhanced features

CICS Advances on All Fronts

Attain your SOA deployment goals more easily with CICS Transaction Server for z/OS V3.2.

IBM Systems Magazine Subscribe Box Read Now Link Subscribe Now Link iPad App Google Play Store
Mainframe News Sign Up Today! Past News Letters