Temporary storage is the primary CICS facility for storing data that must be available to multiple transactions.
Data items in temporary storage are kept in temporary storage queues.
The items can be retrieved by the originating task, or by any other task, by using the symbolic name assigned to the
temporary storage queue.
A temporary storage queue containing multiple items can be thought of as a small data set.
Specific items (logical records) in a queue are referred to by relative position numbers.
The items can be addressed either sequentially or directly, by item number.
If a queue contains only a single item, it can be thought of as a named scratchpad area.
Temporary storage queues are identified by symbolic names of up to 16 characters.
To avoid conflicts caused by duplicate names, establish a naming convention.
For example, the operator identifier or terminal identifier could be used as a suffix to each programmer-supplied symbolic
The fact that temporary storage queues can be named as they are created provides a powerful form of direct access to
You can access scratchpad areas for resources such as terminals and data set records by including the terminal name or
record key in the queue name.
Compared with other methods to pass data from task to task, temporary storage queues can require more processor use.
You use an EXEC CICS command for every interaction with temporary storage queues, and CICS must find or insert the data
by using its internal index.
The processor use with main temporary storage is therefore greater than with the CWA or TCTUA.
With auxiliary storage, there is typically data set I/O as well.
Shared temporary storage pools require temporary storage servers, and applications must access the coupling facility to
retrieve the data.
However, temporary storage queues have a number of advantages over other methods to pass data.
You do not need to allocate temporary storage until it is required.
You keep it only as long as it is required, and the item size is not fixed until you issue the command that creates it.
Temporary storage queues are therefore a good choice for relatively high-volume data and data that varies in length or
Resource protection is also available for temporary storage queues.
Temporary storage queues remain in storage until they are deleted by the originating task, by any other task, or on an
initial or cold start.
Your application can use the DELETEQ TS command to delete temporary storage queues at the end of their useful
If your application cannot always delete temporary storage queues, consider setting up automatic deletion.
You can make CICS automatically delete non-recoverable temporary storage queues in main storage or auxiliary storage if
they have not been accessed recently.
The expiry interval in your TSMODEL resource definitions controls automatic deletion.
Selecting a location for temporary storage queues
Temporary storage for a CICS region can be in main storage, auxiliary storage, or shared temporary storage pools in a z/OS
For an overview of the different temporary storage locations and the features available for temporary storage queues in
each location, see CICS temporary storage: overview.
An application uses the WRITEQ TS command to write the first item of data to a temporary storage queue.
The command specifies the symbolic name of the temporary storage queue.
If this name matches an installed TSMODEL resource definition, CICS creates the temporary storage queue in the temporary
storage location specified by the TSMODEL resource definition.
If there is no matching TSMODEL resource definition, CICS uses the temporary storage location that the application
specifies on the WRITEQ TS command.
The default location is auxiliary temporary storage.
To choose where your temporary storage queues are located, consider these factors:
- Lifetime and frequency of use
- Main temporary storage is more appropriate for temporary storage queues that are needed for short periods of time,
or that are accessed frequently.
- Auxiliary temporary storage and shared temporary storage pools are more appropriate for temporary storage queues
that have a relatively long lifetime, or are accessed infrequently. You could use a cutoff point of a 1 second
lifetime to decide whether queues go in main storage, or auxiliary or coupling facility storage.
- Temporary storage queues in main storage cannot be defined as recoverable.
- Temporary storage queues in auxiliary storage can be defined as recoverable.
- CICS recovery is not available for temporary storage queues in shared temporary storage pools. However, the coupling
facility is not affected by a CICS restart, so temporary storage queues in shared temporary storage pools can be
- Automatic deletion
You can specify that CICS deletes eligible temporary storage queues automatically when they are no longer required,
by adding an expiry interval to the corresponding temporary storage models.
- You can set an expiry interval for
temporary storage queues in main storage.
- You can set an expiry interval for nonrecoverable queues in auxiliary temporary storage. Recoverable queues cannot
be deleted automatically.
- Temporary storage queues in shared temporary storage pools cannot be deleted automatically.
- Storage type
Main temporary storage is in the CICS region, and if the CICS region operates without transaction isolation, is in
64-bit storage. In this situation, if you do not require recoverable temporary storage, you can specify that an
application uses main temporary storage. As a result, there is less pressure on space in 31-bit storage, and reduced
I/O activity to write data to disk.
Locking and waits for temporary storage queues
The CICS® temporary storage domain can process multiple requests concurrently, but it serializes requests made for the
same temporary storage queue.
The queue is locked for the duration of each request.
Only one transaction at a time can write to or delete a recoverable temporary storage queue.
If you choose to make queues recoverable, bear in mind the probability of enqueues.
If a task tries to write to temporary storage and there is no space available, CICS normally suspends it.
The task can regain control using either a HANDLE CONDITION NOSPACE command, or the RESP or
NOHANDLE option on the WRITEQ TS command.
If suspended, the task is not resumed until some other task frees the necessary space in main storage or the VSAM data set.
This situation can produce unexplained response delays, especially if the waiting task owns exclusive-use
resources, so all other tasks needing those resources must also wait.
Concepts store data CICS provides a variety of facilities for storing data within and between transactions.
Each one differs according to how available it leaves data to other programs within a transaction and to other
transactions; in the way it is implemented; and in its overhead, recovery, and enqueuing characteristics.
Storing data within a transaction
© Copyright IBM Corp.