
Data Queue
Theory on Data Queue
-
A Data Queue is an object to which one program can send data and from which another program can receive data.
-
A data queue is the fastest means of communications between two jobs.
Advantages of using data queues are:
-
Using data queues frees a job from performing some work. If the job is an interactive job, this can provide better response time and decrease the size of the interactive program and its process access group(PAG).
-
Data queues are the fastest means of asynchronous communication between two jobs. Using a data queue to send and receive data requires less overhead than using database file, message queues, or data areas to send and receive data.
-
You can send to, receive from a data queue in any HLL program by calling QSNDDTAQ, QRCVDTAQ
-
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.
-
More than one job can receive data from the same data queue.
-
Several jobs can place entries on a data queue.
-
A primary job gets the work requests and sends the entries to the data queue (QSNDDTAQ)
-
The server job receives the data and processes the data (QRCVDTAQ)
Practical example
Data queue is fastest way to of asynchronous communication between programs.
We will see how two programs will communicate using data queue.
- Create Data queue
CRTDTAQ command is to create data queue.
In this example i am calling RPG program EMPRPGDTAQ2 from EMPRPGDTAQ1.
Calling program


