Named counters

The named counter facility is used for generating unique sequence numbers for use by application programs in a Parallel Sysplex® environment.

The named counter is controlled by a named counter server, which maintains each sequence of numbers as a named counter. Each time a sequence number is assigned, the corresponding named counter is incremented automatically. There are various uses for this facility, such as obtaining a unique number for documents (for example, customer orders, invoices, and despatch notes), or for obtaining a block of numbers for allocating customer record numbers in a customer file.

In a single CICS® region, you can use various methods to control the allocation of a unique number. For example, you might use the CICS common work area (CWA) to store a number that is updated by each application program that uses the number. However, the CWA is unique to the CICS address space, and cannot be shared by other regions that are running the same application. A CICS shared data table might be used to provide such a service, but the CICS regions must all run in the same z/OS® image. The named counter facility overcomes all the sharing difficulties that are presented by other methods by maintaining its named counters in the coupling facility, and providing access through a named counter server that is running in each z/OS image in the sysplex. This ensures that all CICS regions throughout the Parallel Sysplex have access to the same named counters.

When you use a named counter server, each normal request (to assign the next counter value) requires only a single coupling facility access. This provides a significant improvement in performance compared to the use of files for this purpose. The named counter server also performs better than coupling facility data tables in this respect because at least two coupling facility accesses are required to update a coupling facility data table.
Note: The named counter facility extends beyond CICS programs. The program that provides the interface to the named counter facility has a callable interface that can also be used by batch programs. This means that you can run batch jobs anywhere in the sysplex and have a high-performance mechanism for generating unique values, without having to create a mechanism of your own to provide this functionality.

For information about setting up and managing the named counter facility, see Setting up and running a named counter server.