Temporary Storage Queue (TSQ)


Temporary Storage Queues (TSQs) are used for sharing data across transactions within a CICS region by simply using their names. TSQs contain items, which are like logical records, that are stored in temporary storage. TSQs are mostly used in implementing page-up and page-down logic and passing large amounts of data between different phases of a transaction, etc. Each TSQ can hold multiple items, which can be accessed by their assigned item numbers (e.g., 1st item, 2nd item, 3rd item, etc.).

Points to note -

  • Naming - TSQ names can be up to 16 characters long and consist of a combination of alphanumeric characters. Typically, the TSQ name is created by combining the program name (the first half) with the timestamp (the second half) of execution. For example: CICSPROG11060309.
  • Definition - There is no need to predefine TSQ anywhere. If you want a TSQ to be recoverable, it should be declared as such in Temporary Storage Tables (TST).
  • Storage - By default, TSQ is stored on main memory and cannot be defined as recoverable, while a TSQ in auxiliary memory can be.
  • Read - TSQ can read either sequentially or directly by their item number (ITEM option). Read is not destructive.
  • Write - Application programs create the TSQ by issuing a WRITE TSQNAME command. Item in a TSQ can be modified with the REWRITE option.
  • Delete - We are unable to delete individual items from the TSQ; we must delete the entire queue. Deleting the queue removes all its records. The deletion of a recoverable TSQ should occur after a SYNCPOINT before the next WRITEQ.
  • Memory Usage - Main memory is preferable for short-term TSQs, while auxiliary memory is better suited for long-term or recoverable TSQs.

Advantages -

  • One advantage of TSQs is that they do not create data until it is needed, allowing for deletion whenever the data is no longer required.
  • They are particularly suitable for handling high-volume data as well as data that varies in length or duration.
  • TSQs remain in storage until they are deleted by the task that created them, by another task, or until the region is restarted.

Disadvantages -

  • TSQs require more CPU power compared to other methods of transferring data between programs.

TSQ Commands -

Below operations can be performed on TSQs –

Command Description
WRITEQ TS Write data into TSQ
READQ TS Read data from the TSQ
DELETEQ TS Deletes the entire TSQ