It is good practice to periodically (such as once a day) delete and re-create a
data queue at a safe point. Performance can be affected if too many entries
exist without being removed. Re-creating the data queue periodically will return
the data queue to its optimal size.
Similarities to Message Queues:
Data queues are similar to message queues, in
that programs can send data to a queue and that data can be received later by
another program. However, more than one program can have a receive operation
pending on a data queue at the same time, while only one program can have a
receive operation pending on a message queue at the same time. (Only one
program receives an entry from a data queue, even if more than one program is
waiting.) Entries on a data queue are handled in either first-in first-out,
last-in-first-out, or keyed-queue order. When an entry is received, it is removed
from the queue.
User Queue APIs
The user queue APIs let you create and delete user queues. User queues are
permanent objects with an object type of *USRQ. They provide a way for one or
more processes to communicate asynchronously.
You can use user queues to:
Communicate between two processes asynchronously
Store data in arrival sequence for later use
Contain keyed messages
Create a batch machine
Permit better performance than the data queue interface
You can save and restore user queues. However, you can only save or restore its
definition. You cannot save or restore the messages in it. You cannot restore a
user queue if a user queue with the same name already exists in the library. You
must provide programs to use this object type to enqueue and dequeue messages.
User Index APIs
The user index APIs allow you to:
Create and delete user indexes
Add, retrieve, and remove user index entries
Retrieve the attributes of a user index
A user index is an object that allows search functions for data in the index and
automatically sorts data based on the value of the data. User indexes are perma-
nent objects in the user domain or in the system domain. They have an object type
of *USRIDX and a maximum size of 4 gigabytes (4 294 967 296 bytes). They
help streamline table searching, cross-referencing, and ordering of data. In
general, if your table is longer than 1000 entries, an index performs faster than a
user-sorted table.
You can use user indexes to:
Provide search functions
Do faster insert operations than in a database file
Do faster retrieve operations than in a database file
Create an index by name, such as a telephone directory
Use order entry programs
Look up abbreviations in an index
Chapter 8. Use of OS/400 APIs 8-13