Sunday, December 13, 2020

Retrieve Data Queue Info from SQL - IBM i

Retrieve Data Queue Info

Data Queues (DTAQ) has been very useful for communication between different Jobs on IBM i. 

Sometimes it becomes essentials to see what are the parameters Data Queue is created with. Retrieve Data Queue Description (QMHQRDQD) API has been very much useful to retrieve this information. 

We can now retrieve this information directly from SQL with a Query from file 'DATA_QUEUE_INFO' (System Name: DTAQ_INFO). This function is to retrieve the Data Queue attribute and not the data in Data Queue. Have a look at Retrieve data from Data Queue from SQL if you are interested in retrieving data from Data Queue.

This makes it easier to retrieve the data queue attributes and this is like running SELECT query on a table. 

This would help us with most of the common questions around Data Queue attributes like,
  • How many messages are there in the Data Queue? use column CURRENT_MESSAGES.
  • Is the Data Queue is Keyed or What is the Sequence? use column SEQUENCE.
  • What is the length of Key data? use column KEY_LENGTH.
These are the few queries I had to check usually and have a look at the fields present in DTAQ_INFO for the full list of fields present.. 

Let's have a look at the sample query.


This would list all the data queues in library 'REDDYP1' with the list of columns selected.


Couple of points to note here.
  • One row would be returned for each Data Queue.
  • User should have sufficient authority for the Data Queue. 

If you have any Suggestions or Feedback, Please leave a comment below or use Contact Form.

No comments:

Post a Comment

Different Ways of Sorting Data in a List - Python

Sorting Data in a List List is a collection of data (of different data types), much like an array. Like any data structure or data set, dat...