Since writing to a data queue and reading from it are supposed to be complimentary things, I could not wait to complete this article.
In the previous example, we wrote (sent) some values to the data queue. To verify that those values were indeed written to the data queue, we are using another API QRCVDTAQ we discussed in the earlier blog.
Please note that the purpose of this API is not to have look at the data, but to actually read it. Our peeping tom is other API, QMHRDQM. This API allows reading a data queue entry without actually removing it from the queue. QRCVDTAQ reads and deletes the entry from the data queue.
Okay, here is an example which shows how does a typical call to QRCVDTAQ looks like.
*
D @DataQ S 10A Inz('TEST')
D @Library S 10A Inz('*LIBL')
D @Data DS
D @Website 1 20
D @Age 21 22 0
D @DataLength S 5 0 Inz(20)
D @WaitTime S 5 0 Inz(1)
C Eval @Website = ' '
C Eval @Age = *Zeros
C Call 'QRCVDTAQ'
C Parm @DataQ
C Parm @Library
C Parm @DataLength
C Parm @Data
C Parm @WaitTime
C @Data Dsply
C Return
Here wait time is seconds before an attempt to read the data queue is made. Rest of the parms are self explantory. If you have questions, do write me @ admin@tutorialindia.com.