Support This Project Get i5/OS Programmer's Toolkit at SourceForge.net. Fast, secure and Free Open Source software downloads

Queue Object APIs

Queue objects is the native and basic IPC method in IBM i. They are not only used to synchronize and exchange data between MI processes but also used to coordinate the communication between an MI process and the SLIC; for exmaple, the QMIRQ (MI responce queue). While the most used and well-known types of queue object are DTAQ (Data Queue) and USRQ (User Queue). DTAQ and USRQ share the commons features of a queue object. Their MI object-type code is hex 0A; their MI object-subtype code is hex 01 and hex 02 for DTAQ and USRQ respectively. As to difference between them, you can simply regard USRQ as a more lightweight and powerful while less robust DTAQ.

As an MI object, a queue object has the following "methods" (operations):

Our queue object APIs are to provide support for operations on USRQs and DTAQs corresponding to the MI instructions ENQ, DEQ, MATQAT, and MATQMSG. (Until V7R1, IBM didn't provide corresponding APIs for USRQ objects.) These queue object APIs can be:

Content

Usage Notes

Here lists a few usage notes:

The Enqueue (ENQ) API

The Enqueue (ENQ) API enqueues an entry (or referred to as a message) into a queue object. The prototype of the ENQ API in ILE RPG.
     /*************************************************************/
     /* The Enqueue (ENQ) API                                     */
     /* Enquque a entry (message) to a queue object.              */
     /*                                                           */
     /* @example test/t168.rpgle                                  */
     /*************************************************************/
     d enq             pr                  extpgm('I5TOOLKIT/ENQ')
     /* qualified queue name. char(10) q-name + char(10) lib-name */
     d     q_name                    20a
     /* MI object subtype code. hex 01 for DTAQ, hex 02 for USRQ. */
     d     subtype                    1a
     d     key_len                   10i 0
     d     key                        1a   options(*varsize)
     d     msg_len                   10i 0
     d     msg                        1a   options(*varsize)
     /* optional API error code */
     d     ec                              likeds(qusec_t)
     d                                     options(*nopass)

Examples of in ILE RPG and ILE COBOL

Here're exapmles of using the ENQ API to Work with Queue Object in host HLLs, such as ILE RPG and ILE COBOL.

Support This Project
Generated on Mon Aug 1 22:50:21 2011 for i5/OS Programmer's Toolkit: Queue Tools by  doxygen 1.5.9