Module 7: CICS Temporary Storage and Transient Data
Intra-Partition TS
An intra-partition TS queue lives inside the CICS region, in main storage. It is the fastest kind of temporary storage, and it works like a scratch pad that only this region can see.
What intra-partition means for TS
- "Intra-partition" means inside the CICS region. The data never leaves CICS memory; no outside program or batch job can see it.
- For TS, you get this with the MAIN option on WRITEQ TS. The queue is kept in main storage.
- Because the data stays in memory, reads and writes are very fast - no disk I/O at all.
- The trade-off: it uses region memory, and the data is gone when CICS ends.
When to use it
- Short-lived scratch data, like a customer record held while the user edits it on a screen.
- Terminal paging: format several screen images, store them in a MAIN queue, and let the operator page forward and backward.
- Passing data between two programs in the same transaction flow, where speed matters more than survival.
- Small queues only. Large queues in main storage can starve the region of memory.
How to code it
- Code WRITEQ TS ... MAIN to create the queue in main storage. READQ TS and DELETEQ TS work the same as always.
- If you omit both MAIN and AUXILIARY, the queue goes where your installation default says, so code MAIN explicitly when you mean memory.
- Build the queue name with EIBTRMID so each terminal gets its own private scratch area.
Example:-
*--- Keep the customer record in main storage while editing ---*
EXEC CICS
WRITEQ TS QUEUE(TS-QUEUE-NAME)
FROM(TS-CUSTOMER-RECORD)
MAIN
RESP(RESPONSE-CODE)
END-EXEC.
*--- Later, read it back for the change screen ---*
EXEC CICS
READQ TS QUEUE(TS-QUEUE-NAME)
INTO(TS-CUSTOMER-RECORD)
ITEM(1)
RESP(RESPONSE-CODE)
END-EXEC.
