How can we read data in a DATA QUEUE without removing it from DTAQ

45 pts.
AS/400 Data Queue
Data access
iseries v5r4
Is there any way to see the data present in a DATA QUEUE without removing/disturbing the data sequence in it.

Software/Hardware used:
AS400, V5R4

Answer Wiki

Thanks. We'll let you know when a new response is added.


Yes, just look to optional group 2 of
Receive Data Queue (QRCVDTAQ) API


Required Parameter Group:

1 Data queue name Input Char(10)
2 Library name Input Char(10)
3 Length of data Output Packed(5,0)
4 Data Output Char(*)
5 Wait time Input Packed(5,0)

Optional Parameter Group 1:

6 Key order Input Char(2)
7 Length of key data Input Packed(3,0)
8 Key data I/O Char(*)
9 Length of sender information Input Packed(3,0)
10 Sender information Output Char(*)

Optional Parameter Group 2:

<b>11 Remove message Input Char(10)</b>
12 Size of data receiver Input Packed(5,0)
13 Error code I/O Char(*)

Default Public Authority: *USE

Threadsafe: Conditional; see Usage Notes.


And there is

Retrieve Data Queue Message (QMHRDQM) API

Required Parameter Group:

1 Receiver variable Output Char(*)
2 Length of receiver variable Input Binary(4)
3 Format name Input Char(8)
4 Qualified data queue name Input Char(20)
5 Message selection information Input Char(*)
6 Length of message selection information Input Binary(4)
7 Message selection information format name Input Char(8)
8 Error code I/O Char(*)

Default Public Authority: *USE

Threadsafe: Yes


Discuss This Question: 3  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • TomLiotta
    There should be only rare situations when you need to "read but not remove" a *DTAQ message. Various debug functions would be times when it can be useful. However, the DMPOBJ command provides one simple and useful way to examine everything about a *DTAQ including the entries. The point is that if you are looking for ways to use this capability in the normal and standard methods of an application, it can be an indication that you shouldn't be using a *DTAQ in the first place. There are other object types that are better suited for "read but not remove" actions. Tom
    125,585 pointsBadges:
  • Rbeethe
    I've done this for many reasons. We recently did a role swap between to iSeries and I used the utility JCRDQE. See Rick
    10 pointsBadges:
  • TomLiotta
    Craig Rutledge's work is excellent and JCRDQE is as good as such utilities get. As long as it works for what you need, there's no problem. But it can't be generalized to make it work for everyone in all circumstances. Smaller systems are fairly easy, but larger ones can bring problems. Data queues that I work with can have a few thousand entries per second sent to them. A short interruption in pulling from the queue will build up a huge backlog quickly. The APIs themselves simply can't handle all data queues if all entries are needed. For example, a data queue at V5R4 can be up to 2GB in size. I suppose that teraspace enablement could allow for for grabbing that much, but I haven't seen it done yet. JCRDQE doesn't do it. Also, entries can be up to almost 64K in length, but JCRDQE is limited to 1000 bytes. I haven't needed entries larger than 32K, so I've never hit the maximum. But I regularly go beyond 1000 bytes. Also, it's not unusual to have duplicate keys. If a set of duplicates goes beyond the maximum size that the APIs can return, (say only the first 1000 of 1050 duplicates are returned,) there is no way to tell the APIs to start at key #1001 of the duplicates on the next call. You must go with the next higher key value and miss the remaining 50 of the duplicates. The APIs do not return any kind of "continuation handle" at least up through V7R1. In short, as long as they work for you, the APIs that can retrieve entries without removing them are fine. It's likely that they will work for this question but not guaranteed. If role-swap is important, I wouldn't use the data queue APIs. I'd use the journaling support for data queues and guarantee complete recovery. Tom
    125,585 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: