How and why to use data queues

Data queues are great when you need to communicate and share data with other programs and/or disparate systems regardless of the operating system and programming language.

The operating system contains few commands for use with objects of type *DTAQ.

CrtDtaQ - create a new data queue, prompt screen displayed below

The functionality on the IBM i for dealing with data queues is limited to calling API's. You might find something in QUSRTOOLS for starters.

SndDtaQ - send data data to the data queue API QSNDDTAQ
RcvDtaQ - receive data from the data queue API QRCVDTAQ
ClrDtaQ - remove data from the data queue API QCLRDTAQ


None of these commands contain any UI elements so the processes tend to be almost invisible. IBM i specialist are accustomed to having much more control and visibility than what is initially given with data queue processing.

Some shops will use the API's to create a simple clear/receive screen to view what is currently in the dataq and to optionally remove that data. If you are lucky enough to own the TAATOOL library there are several ready-made utilities for handling data queue processing.

The data queue is commonly used to aid in interfacing and passing data between systems. For example assume you have a file that needs to be uploaded to the IBM i on a daily basis. Of course the timing of this upload is critical. The receiving machine must be in a status where it is ready to receive this data. The originating system can repeatedly check an empty data queue until something appears. This data queue entry is a signal that the receiving system is ready to process more data from the interface.

There are many other scenarios whereas data queues are useful.