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

Module 7: CICS Temporary Storage and Transient Data


DELETEQ TS

The DELETEQ TS command removes a temporary storage queue. It is the clean-up command of temporary storage: without it, your queues stay in storage forever.

Syntax

  • The command is short: DELETEQ TS QUEUE(queue-name), with QNAME as the longer-name form.
  • QUEUE takes 1 to 8 characters; QNAME takes up to 16 characters on CICS TS 1.3 and later.
  • No other options are needed. There is no FROM or INTO because nothing is transferred.

What it deletes

  • DELETEQ TS deletes the whole queue, all of its items at once.
  • You cannot delete a single record from a queue. If you need that, rewrite the item with spaces or rebuild the queue without it.
  • After the delete, the queue name is free again, and the next WRITEQ with that name starts a fresh queue at item 1.
  • If the queue you name does not exist, CICS raises the QIDERR condition.

Why deleting matters

  • A queue that is never deleted stays in main storage or in the DFHTEMP file indefinitely, wasting space.
  • Delete the queue when the business function is done, for example when the user presses PF3 to exit or PF12 to cancel.
  • A common pattern: delete the old queue first, then write fresh data, so each run of the transaction starts clean.

Example:-

*--- Delete the queue when the user exits ---* EXEC CICS DELETEQ TS QUEUE(TS-QUEUE-NAME) RESP(RESPONSE-CODE) END-EXEC. IF RESPONSE-CODE NOT = DFHRESP(NORMAL) AND RESPONSE-CODE NOT = DFHRESP(QIDERR) PERFORM 9999-TERMINATE-PROGRAM END-IF.






© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant