Purpose
Read a record from the iSeries™ data
queue object that is identified by the specified handle. The AsyncRead will
return control to the caller immediately. This call is used in conjunction
with the CheckData API. When a record is read from a data
queue, it is removed from the data queue. If the data queue is empty for more
than the specified wait time, the read is aborted, and the CheckData API
returns a value of CWBDQ_TIMED_OUT. You may specifying a wait time from 0
to 99,999 (in seconds) or forever (-1). A wait time of zero causes the CheckData API
to return a value of CWBDQ_TIMED_OUT on its initial call if there is no data
in the data queue.
Syntax
unsigned int CWB_ENTRY cwbDQ_AsyncRead(
cwbDQ_QueueHandle queueHandle,
cwbDQ_Data data,
signed long waitTime,
cwbDQ_ReadHandle *readHandle,
cwbSV_ErrHandle errorHandle);
Parameters
- cwbDQ_QueueHandle queueHandle - input
- Handle that was returned by a previous call to the cwbDQ_Open function.
This identifies the iSeries data queue object.
- cwbDQ_Data data - input
- The data object to be read from the iSeries data queue.
- signed long waitTime - input
- Length of time in seconds to wait for data, if the data queue is empty.
A wait time of -1 indicates to wait forever.
- cwbDQ_ReadHandle * readHandle - output
- Pointer to where the cwbDQ_ReadHandle will be written.
This handle will be used in subsequent calls to the cwbDQ_CheckData API.
- cwbSV_ErrHandle errorHandle - output
- Any returned messages will be written to this object. It is created with
the cwbSV_CreateErrHandle API. The messages may be retrieved
through the cwbSV_GetErrText API. If the parameter is set
to zero, no messages will be retrieved.
Return Codes
The following list shows common return
values.
- CWB_OK
- Successful completion.
- CWBDQ_INVALID_TIME
- Invalid wait time.
- CWBDQ_INVALID_QUEUE_HANDLE
- Invalid queue handle.
- CWBDQ_INVALID_SEARCH
- Invalid search order.
Usage
This function requires that you have previously
issued the following APIs:
- cwbDQ_Open or cwbDQ_OpenEx
- cwbDQ_CreateData