Data queues are a type of system object that you can create, to which one HLL procedure or program can send data, and from which another HLL procedure or program can receive data. The receiving program can be already waiting for the data, or can receive the data later.
The advantages of using data queues are:
In addition to these advantages, you can journal your data queues. This allows you to recover the object to a consistent state, even if the object was in the middle of some change action when the abnormal initial program load (IPL) or crash occurred. Journaling also provides for replication of the data queue journal to a remote system (using remote journal for instance). This lets the system reproduce the actions in a similar environment to replicate the application work. For more information about journaling support on the iSeries server, see the Journal management article in the Information Center.
The following is an example showing how data queues work. Several
jobs place entries on a data queue. The entries are handled by a server
job. This might be used to have jobs send processed orders to a single
job that would do the printing. Any number of jobs can send to the same
queue.
Another example using data queues follows. A primary job gets the work requests and sends the entries to a data queue (by calling the QSNDDTAQ program). The server jobs receive the entries from the data queue (by calling the QRCVDTAQ program) and process the data. The server jobs can report status back to the primary job using another data queue.
Data queues allow the primary job to route the work to the server
jobs. This frees the primary job to receive the next work
request. Any number of server jobs can receive from the same data
queue.
When no entries are on a data queue, server jobs have the following options:
Data queues can also be used when a program needs to wait for input from display files, ICF files, and data queues at the same time. When you specify the DTAQ parameter for the following commands:
you can indicate a data queue that will have entries placed on it when any of the following happens:
Support is available to optionally associate a data queue to an output
queue by using the Create Output Queue (CRTOUTQ) or Change Output Queue
(CHGOUTQ) command. The system logs entries in the data queue when
spooled files are in ready (RDY) status on the output queue. A user
program can determine when a spooled file is available on an output queue by
using the Receive Data Queue (QRCVDTAQ) API to receive information from a data
queue. See the CL section of the Programming
category of the iSeries Information Center for details about the Create Output Queue (CRTOUTQ)
command. For more information about data queues on output queues
see the Printer Device Programming
book.
Jobs running on the system can also place entries on the same data queue as the one specified in the DTAQ parameter by using the QSNDDTAQ program.
An application calls the QRCVDTAQ program to receive each entry placed on the data queue and then processes the entry based on whether it was placed there by a display file, an ICF file, or the QSNDDTAQ program. For more information, see Example 2: Waiting for Input from a Display File and an ICF File and Example 3: Waiting for Input from a Display File and a Data Queue.
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.