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

Module 7: CICS Temporary Storage and Transient Data


TS Queues

A TS queue is the basic unit of temporary storage. Everything you store is stored in a named queue, and every queue is made of numbered items.

The queue name

  • Every TS queue is identified by a unique queue name, also called the data-id.
  • With the QUEUE option the name can be 1 to 8 characters; with QNAME it can be up to 16 characters.
  • Names must be unique across the CICS region, so programs commonly build the name with the terminal id from EIBTRMID, for example 'TRM1MNT3'.
  • A queue name is like the label on a folder: it tells CICS exactly which set of records you mean.

Items and item numbers

  • Each record written to a TS queue is called an item, and CICS assigns it the next sequential item number, starting at 1.
  • The item number is not stored inside the record; it is only the address you use to find the record again.
  • You can read items randomly by giving the item number, or sequentially with the NEXT option.
  • If you write 4 records, they become items 1, 2, 3 and 4, in the order they were written.

Creating a queue

  • You do not define a TS queue before using it. The first WRITEQ TS with a new name creates the queue automatically.
  • Queues live in main storage or in the DFHTEMP file on disk, decided by the MAIN or AUXILIARY option on WRITEQ TS.
  • A queue stays in storage until you delete it with DELETEQ TS, so always clean up queues you no longer need.

Sharing queues between tasks

  • Any task in the CICS region can read or write any TS queue by name, which makes queues handy for passing data between programs.
  • Sequential position is shared: any task can move the NEXT pointer, so two tasks reading the same queue sequentially can interfere.
  • If two tasks must not touch the same queue at the same time, use the EXEC CICS ENQ command to reserve it exclusively.

Example:-

WORKING-STORAGE SECTION. 01 TS-QUEUE-NAME. 05 TS-TERMINAL-ID PIC X(4). 05 FILLER PIC X(4) VALUE 'MNT3'. 01 TS-QUEUE-RECORD PIC X(120). PROCEDURE DIVISION. MOVE EIBTRMID TO TS-TERMINAL-ID. EXEC CICS WRITEQ TS QUEUE(TS-QUEUE-NAME) FROM(TS-QUEUE-RECORD) END-EXEC.






© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant