Using Data Queue APIs
The advantages of using data queues are:
- Using data queues frees a job from performing some work. If the job is an
interactive job, the data queue APIs can provide better response time and
decrease the size of the interactive program and its process activation group
(PAG). This, in turn, can help overall system performance. For example, if
several work station users enter a transaction that involves updating and
adding to several files, the system can perform better if the interactive jobs
submit the request for the transaction to a single batch processing job.
- Data queues are a fast means of asynchronous communication between two
jobs. Using a data queue to send and receive data requires less system resource
than using database files, message queues, or data areas to send and receive
data.
- You can send to, receive from, and retrieve a description of a data queue
in any HLL program. This is done by calling the Send to a Data Queue
(QSNDDTAQ), Receive from Data Queue (QRCVDTAQ), Retrieve Data Queue Message
(QMHRDQM), Clear Data Queue (QCLRDTAQ), and Retrieve Data Queue Description
(QMHQRDQD) APIs.
- When receiving data from a data queue, you can set a time-out such that the
job waits until an entry arrives on the data queue. This is different from
using the EOFDLY parameter on the Override Database File (OVRDBF) command,
which causes the job to be activated whenever the delay time ends.
- More than one job can receive data from the same data queue. This is an
advantage in certain applications where the number of entries to be processed
is greater than one job can handle within the desired performance restraints.
For example, if several printers are available to print orders, several
interactive jobs could send requests to a single data queue. A separate job for
each printer could receive data from the data queue in first-in-first-out
(FIFO), last-in-first-out (LIFO), or keyed-queue order.
- Data queues have the ability to attach a sender ID to each message being
placed on the queue. The sender ID, an attribute of the data queue which is
established when the queue is created, contains the qualified job name and
current user profile.