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

Module 2: CICS Architecture


CICS Temporary Storage

Temporary Storage (DFHTSP) gives your programs scratchpad queues. A TS queue holds numbered items that one program writes and the same or another program reads back.

What is temporary storage

  • Temporary Storage is managed by the CICS component DFHTSP.
  • A TS queue has a name - 1 to 8 characters with QUEUE, or 1 to 16 characters with QNAME - and holds numbered items starting at item 1.
  • Queues can live in main storage (MAIN: fast, but lost when CICS restarts) or auxiliary storage (AUXILIARY: kept in the DFHTEMP VSAM file across restarts).
  • Every task sees the same named queues. Build the queue name with the terminal id (EIBTRMID) so each user's data stays separate.

WRITEQ TS, READQ TS and DELETEQ TS

  • WRITEQ TS adds a record at the end of the queue. NUMITEMS tells you how many items the queue holds after the write.
  • READQ TS reads one item: use ITEM(item-number) for random access, or NEXT to read sequentially.
  • WRITEQ TS with REWRITE and ITEM updates an existing item in place without adding a new one.
  • DELETEQ TS deletes the whole queue. Clean up your queues when you are done to save storage.

Where TS queues are used

  • Pseudo-conversational programs: save the screen data in a TS queue, end the task, and read it back when the user presses ENTER again.
  • Passing large data between programs when the 32K COMMAREA limit is too small.
  • Building a report or a list one screen at a time, keeping the rows in the queue between screens.

Recoverable TS queues

  • Auxiliary TS queues can be defined as recoverable. Their updates are backed out automatically if the task abends.
  • Main-storage TS queues are never recoverable and vanish when CICS restarts.
  • Use recoverable queues when losing the queued data would corrupt the business process.

Example - WRITEQ TS in COBOL

  • Save the invoice screen in a TS queue named from the terminal id, kept in auxiliary storage.
  • * Build a unique queue name from the terminal id MOVE EIBTRMID TO WS-TS-TERM STRING 'INV' WS-TS-TERM DELIMITED BY SIZE INTO WS-TS-QNAME END-STRING * Save the screen in the queue EXEC CICS WRITEQ TS QUEUE(WS-TS-QNAME) FROM(WS-INVOICE-SCREEN) NUMITEMS(WS-ITEM-COUNT) AUXILIARY END-EXEC
  • Using EIBTRMID in the name stops two users on different terminals from overwriting each other's queue.
  • When the conversation ends, issue DELETEQ TS for the queue so it does not pile up in DFHTEMP.





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant