Retrieve Data from DTAQ using SQL - IBM i

Retrieve data from Data Queue: Data Queues (DTAQ) has been very useful for communication between different Jobs on IBM i. There are multiple APIs to work with Data Queues. Send Data Queue (QSNDDTAQ) - Write data to Data Queue Receive Data Queue (QRCVDTAQ) - Read data from Data Queue, This would clear the message from the Data Queue. Retrieve Data Queue Message (QMHRDQM) - Retrieve data from Data Queue, Multiple entries can be retrieved at once. This does not clear the retrieved messages from Data Queue. In this post, we will see how to retrieve data from Data Queue in SQL using ' DATA_QUEUE_ENTRIES ' Table function in QSYS2 with some examples. This would return the data similar to API 'QMHRDQM'. E.g.: Let's consider a Standard Data Queue created using below command with sequence ' FIFO '. CRTDTAQ DTAQ(REDDYP1/TESTDTAQ) MAXLEN(20) SEQ(*FIFO) TEXT('Test Data Queue - FIFO') This would return the Data in DTAQ along with the position. Line 1 -...