getNextElement()

The getNextElement() function reads data from a specified iSeries® data queue then deletes the data from the queue. Compare this function with the browseNextElement() function, which reads data in the same way, but does not delete the data from the queue.

If the destination for the data consists of an array of HEX(2) elements, the function reads the data as raw bytes; otherwise it reads the data as a STRING.

The function reads the first element in the queue unless you specify a key. If you specify a key, the function reads the element(s) that match the key and the search type (such as greater than the key value, not equal to the key value, and so on).

Syntax

  iplatformLib.getNextElement(
    dataQueueDef DataQueueDefinition inOut,
    elementData ANY inOut,
    wait INT in,
    [, keyData ANY in,
    searchType CHAR[2] inOut] )
  returns (result BOOLEAN)
platform
The string "Cobol" or "Java™", depending on the platform for which you are generating the program.
dataQueueDef
A variable based on the DataQueueDefinition Record (see iSeries Record definitions).
elementData
The destination for the data. If the data type is HEX(2)[] the data is read as bytes; otherwise it is read as STRING type.
wait
The number of seconds the function should wait if it is unable to complete the read operation. There are two special cases:
0
Return immediately.
-1
Wait forever.
keyData
Optional key specification for keyed data queues.
searchType
The relationship to keyData that matching data must meet. The search type consists of one of the following relationships:
GT
The function reads only elements with a key value greater than that in keyData.
GE
The function reads only elements with a key value greater than or equal to that in keyData.
EQ
The function reads only elements with a key value equal to that in keyData.
NE
The function reads only elements with a key value not equal to that in keyData.
LE
The function reads only elements with a key value less than or equal to that in keyData.
LT
The function reads only elements with a key value less than that in keyData.
result
The function returns TRUE if it was able to read successfully.

Feedback