READQ TD


Read data from the transient data queue. READQ TD reads data from a transient data queue. After current read, the record which is read no longer available.

If automatic transaction initiation (ATI) used, application should test for the QZERO condition to ensure that termination of an automatically initiated task occurs only when the queue is empty.

If the READQ TD command attempts to access a record in a logically recoverable intra-partition queue (that is being written to or deleted by another task and there are no more committed records) the command waits until the queue is no longer being used for output.

Syntax -


READQ TD Syntax

Options -


INTO(data-area) -

Specifies the data area to where the data to be written. The data area can be any variable, array or structure.

LENGTH(record-length) -

record-length is a halfword binary value. Specifies the length of the record to be read. If INTO option specified, LENGTH need not be specified. If LENGTH need to be specified with INTO, specify as the maximum length of data that the program accepts.

If the length of the data exceeds the value that is specified, the data is truncated to that value and the LENGERR condition occurs. If SET option coded, the LENGTH must be specified.

QUEUE (name) -

Specifies the symbolic name (1 - 4 characters) of the queue to be read from. The queue must have been defined to CICS.

SET(ptr-ref) -

Specifies the pointer reference that is set to the address of the retrieved data. The pointer reference is valid until the next READQ TD command or the end of task if not changed by other commands or statements.

SYSID (system-name) -

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

NOSUSPEND -

Specifies if the application program attempts to read from a queue that is already being used for output, the task is not suspended until the queue becomes available. This option only applies to intra-partition queues.

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
16 INVREQ 16 INVREQ
This condition only occurs for extra-partition queue.Occurs if the queue specified has been opened for output.
Solution -The READQ operation should not be performed on the queue opened for output. If READQ operation required to perform on the same queue, open the queue in the input mode.
Task abnormally terminated
17 IOERR
Occurs when an input/output error and the data record in error is skipped.
Solution -This condition occurs if writing the queue when the queue cannot be written and a QZERO condition occurs in this situation. Check the Queue opened mode before issuing a write command.
This condition can also occur if the FREE=CLOSE operand has been used in the data set definition for an extra-partition queue and the queue has been closed and reopened. Reopen the file to resolve the issue.
Task abnormally terminated
22 LENGERR
Occurs if READQ INTO area is shorter than the data read from queue or an invalid length has been supplied.
Solution -This should be resolved in the program.
If the length value specified is shorter than the retrieved data area length, modify the length value according to the data area length. If you are not aware of the data area length before retrieval, provide the maximum allowed length value.
If the invalid length value specified, modify it according to the data area length to resolve the issue.
Task abnormally terminated
70 NOTAUTH
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
44 QIDERR
Occurs when the queue specified cannot be found.
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
53 SYSIDERR
Occurs when the SYSID option specifies a name that is neither the local system nor a remote system.
Solution -The specified SYSID name is not related to any system. Correct it.
Task abnormally terminated
84 DISABLED
Occurs when the queue disabled.
Solution -Enable the queue in the CICS region. If you have no access, contact system administrator to enable the queue.
Task abnormally terminated
19 NOTOPEN
Occurs if the destination is closed. This condition applies to extra-partition queues only.
Solution -This might happen due to the queue is closed. Open the queue to resolve the issue.
Task abnormally terminated
25 QBUSY
Occurs if a READQ TD command attempts to access a record in a logically recoverable queue (that is being written to or is being deleted by another task and there are no more committed records). This condition applies only to intra-partition queues.
Solution -Reading the queue might not possible at this situation.If the queue existed and opened in output mode, the queue might be using for writing. Find out which task using the queue and wait until completion. Open the queue in input mode after completing the task to resolve the issue. If the queue doesn’t exist, wait until the queue is created.
Ignore the condition
23 QZERO
Occurs when the destination (queue) is empty or the end of the queue has been reached.
Solution -Modify the program to handle the error for smoother flow when the queue is empty or end of queue reached.
Task abnormally terminated