Module 7: CICS Temporary Storage and Transient Data
Transient Data (TD)
Transient Data, or TD, is CICS's queuing facility for data in motion. Programs write data to a named queue, and other programs - or even batch jobs and printers - read it later, in order.
What transient data is
- TD is a generalized queuing facility. Data is queued for later internal or external processing.
- Typical uses: message switching between terminals, collecting data for batch input, routing output to printers, and logging.
- Unlike TS, TD queues must be defined to CICS before the program uses them, through a TDQUEUE resource definition.
- Programs reach a queue by its symbolic destination name, for example 'PRT1' for a printer.
Intra-partition and extra-partition queues
- Intrapartition queues live inside the CICS region in a CICS-managed VSAM data set. They pass data between tasks, and can trigger a transaction automatically.
- Extrapartition queues live outside the region: sequential data sets on disk or tape, or devices like printers. They hand data to batch programs or hardware.
- Indirect queues let the system programmer reroute a symbolic name to a different queue without changing the program.
The TD commands
- WRITEQ TD - writes a record to a transient data queue.
- READQ TD - reads the next record from a queue. Reads are sequential and destructive: once read, a record cannot be read again.
- DELETEQ TD - deletes an intrapartition queue. Extrapartition queues are data sets, so they are not deleted this way.
- If you omit the TD keyword, CICS assumes temporary storage, so code TD explicitly on every TD command.
Automatic transaction initiation
- An intrapartition queue can have a trigger level. When the number of queued records reaches the level, CICS automatically starts a transaction to process the queue.
- The triggered program reads with READQ TD in a loop until it gets the QZERO condition, which means the queue is empty.
- This is how print queues work: each WRITEQ TD adds a line, and at the trigger level CICS starts the print task.
Example:-
WORKING-STORAGE SECTION.
01 OUTAREA PIC X(132).
01 OUTLNG PIC S9(4) COMP VALUE +132.
PROCEDURE DIVISION.
MOVE 'MONTH-END REPORT - PAGE 1' TO OUTAREA.
EXEC CICS
WRITEQ TD QUEUE('PRT1')
FROM(OUTAREA)
LENGTH(OUTLNG)
END-EXEC.
