Write the data to a temporary storage queue. WRITEQ TS writes data records in a temporary storage queue that stores in main or auxiliary storage.If a queue is defined as recoverable, the application program should not issue a WRITEQ TS command following a DELETEQ TS command until a sync point occurs.

If there is insufficient space available in the temporary storage data set or main storage to satisfy the WRITEQ TS request, the task is in suspended status until space become available.

User can decide whether to stop the transaction with an abend or wait if space is not available, the NOSUSPEND option specified and the NOSPACE condition is raised.

Syntax -


Options -


Specifies the TSQ is on a direct access storage device in auxiliary storage. This is the default value for the first write.

FROM(data-area) -

Specifies the data area to be written to temporary storage.

ITEM(number) -

Specifies the item number of the logical record to be replaced in the queue if REWRITE option specified. Number is a half word binary value. It is optional if REWRITE option not specified.

LENGTH(data-value) -

data-value is a halfword binary value. Specifies the length of the data to be written. This option is mandatory if SYSID is specified. The maximum length is 32763 (32K).


Specifies the TSQ should store in main storage. If the MAIN option and the TSQ used in remote system is accessed by the CICS multiregion operation (MRO) facility or IPIC connectivity, the data is stored in auxiliary storage. If the system is MRO and MAIN is specified, the queue is not recoverable and SYNCPOINT ROLLBACK doesn't work.


Specifies the application program is not suspended if there is insufficient space in the temporary storage data set or in main storage to satisfy the WRITEQ TS request.

NUMITEMS (number) -

Number is a half word binary value. Specifies a number that indicates items are currently in the queue after the WRITEQ TS command is executed. NUMITEMS is not valid if REWRITE is specified.

QNAME (name) -

Specifies an alternative to QUEUE, QNAME. Specifies the symbolic name (1 - 16 characters) of the queue to be written to. The name should have 16-characters and padded with spaces if the length field has less than 16-characters.

Temporary Storage Queue can be created with dynamic names to avoid duplicate queues creation.Temporary Storage Queue name would be a combination of symbolic name (Program name most of the cases) and the timestamp (current time portion).

Ex - TEMPPROG11060309

If the queue defined as remote in CICS, the request will be transferred to remote system.If no SYSID is present, then based on the TST definition the Queue will be decided whether it is a local or remote.If SYSID presents, then system won’t check for TST entries and directly assumes that the queue is Remote one.

QUEUE (name) -

Specifies the symbolic name (1 - 8 characters) of the queue to be written to. The name should have 8-characters and padded with spaces if the length field has less than 8-characters. If the queue defined as remote in CICS, the request will be transferred to remote system.


Specifies the existing record in the queue is to be overwritten with the data area provided. If the REWRITE option is specified, the ITEM option must be specified.

If the specified queue does not exist, the QIDERR condition occurs. If the correct item within an existing queue cannot be found, the ITEMERR condition occurs and the data is not stored.

SYSID (system-name) -

Option is for remote and shared queues only. Specifies the system name (1 - 4 characters).

Error Conditions -

Below are the list of error conditions may occur in combination. If more than one occurs, only the first is passed to the application program.

Error ConditionRESP2, Description & SolutionSystem Action
Queue name specifies consisting of binary zeroes or queue locked and waiting for ISC session recovery or queue created by CICS internal code.
Solution -If queue name consists binary zeroes, modify the queue name and try again.If the queue is recoverable TSQ and waiting for ISC recovery, wait until the TSQ is recovered. If the queue is created by CICS internal code, use some other name for TSQ and try again.
Task abnormally terminated
5 - There is an irrecoverable input/output error for a shared queue.
Solution -This might be due to the memory access problem. Try after some time and the issue still exists, contact the storage support group to resolve the issue.
Task abnormally terminated
The ITEM number provided is out of range or exceeds 32767.
Solution -TSQ supports only 32767 items can written to the queue. If the item number exceeded, create another queue and write it.
Task abnormally terminated
The length of the stored data area is zero or negative or greater than 32763.
Solution -Add the data area length check before writing it to the TSQ.If the stored data length is zero, do not attempt to write it to the TSQ. If the length is negative, change the length according to the data area length and try again.If the length is greater than 32763, split up the record and write them.
Task abnormally terminated
Occurs when NOSUSPEND option specified, no space in the following conditions –
  • Main storage
  • The auxiliary temporary storage data set
  • The temporary storage pool list structure

Solution -Remove NOSUSPEND option from the WRITEQ command.
Ignore the condition
A resource security check has failed on QUEUE (name).
Solution -Contact system administrator team to check whether the appropriate access added for the user or group. It will resolve the problem.
Task abnormally terminated
Occurs when the queue specified with the REWRITE option cannot be found in Main storage, Auxiliary storage and Temporary storage pool.
Solution -This happens due to the Queue already might get deleted or queue name provided might wrong. Debug the application program flow and correct the logic.
Task abnormally terminated
4 - Occurs in any of the following situations:
  • The specified SYSID name is not the local system or a remote system.
    Solution -The specified SYSID name is not related to any system. Correct it.
  • The link to the remote system is closed.
    Solution -This might be due to the remote system is not up and running. Contact remote system support team.
  • The CICS region specified fails to connect to the TS server supports the referenced temporary storage queue.
    Solution -This issue due to the connectivity issue. Restart the CICS region might solve the issue. Otherwise, contact the system administrator to resolve the issue.
Task abnormally terminated