Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 7: CICS Temporary Storage and Transient Data


TD vs TS

Temporary Storage and Transient Data both move data through queues, but they solve different problems. Picking the wrong one is a classic CICS beginner mistake.

How they differ

  • Access: TS reads randomly by item number or sequentially; TD reads sequentially only, with no item numbers.
  • Reads: TS reads leave the record in place and it can be read again; TD reads are destructive and the record is gone.
  • Updates: TS supports REWRITE of an existing item; TD has no update at all.
  • Creation: TS queues are created automatically on the first WRITEQ; TD queues must be predefined with a TDQUEUE definition.
  • Triggers: TD intrapartition queues can automatically start a transaction at a trigger level; TS has no triggers.
  • Reach: TD extrapartition queues hand data to batch jobs, tapes and printers outside CICS; TS never leaves the region.
  • Delete: TS deletes whole queues with DELETEQ TS; TD deletes intrapartition queues with DELETEQ TD.

When to use TD

  • Data flows one way in order: logging, audit trails, report printing.
  • You want CICS to start work automatically when enough data arrives - the ATI trigger pattern.
  • The consumer is outside CICS: a batch program, a tape, or a printer.
  • Each record is processed exactly once and then discarded.

When to use TS

  • You need to find records again by number, or read them more than once.
  • Short-lived scratch data: holding a record while the user edits it, paging through screens.
  • You need REWRITE to update a stored record in place.
  • Programs in the same region share data quickly without predefined definitions.

Example:-

*--- TS: keep the record, update it, read it again ---* EXEC CICS WRITEQ TS QUEUE('SCRATCH') FROM(WS-REC) END-EXEC. EXEC CICS WRITEQ TS QUEUE('SCRATCH') FROM(WS-REC) ITEM(1) REWRITE END-EXEC. EXEC CICS READQ TS QUEUE('SCRATCH') INTO(WS-REC) ITEM(1) END-EXEC. *--- TD: send it once, in order, to the printer ---* EXEC CICS WRITEQ TD QUEUE('PRT1') FROM(OUTAREA) LENGTH(OUTLNG) END-EXEC. *--- the print task reads it once; the record is then gone ---* EXEC CICS READQ TD QUEUE('PRT1') INTO(INAREA) LENGTH(INLNG) RESP(RESPCODE) END-EXEC.






© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant