Blog Archive

AS400 RPGLE data queue tutorial - Create, Delete, Send and Receive data

Data queues are a type of server object that you can create, to which one procedure or program can send data, and from which another procedure or program can receive data. The receiving program can be already waiting for the data, or can receive the data later. Using data queues frees a job from performing a piece of work. If the job is interactive, this can provide better response time and decrease the size of the interactive program and its process access group.

Data queues provide many benefits to PC developers and iSeries applications developers, including:
  • They are a fast and efficient means of communication on the iSeries server.
  • They have low system overhead and require very little setup.
  • They are efficient because a single data queue can be used by a batch job to service several interactive jobs.
  • The contents of a data queue message are free-format (fields are not required), providing flexibility that is not provided by other system objects.
  • Access data queues through an iSeries API and through CL commands, which provides a straight-forward means of developing client/server applications.

There are three ways to designate the order of messages on a data queue:

  • LIFO
    • Last in, first out. The last message (newest) placed on the data queue will be the first message taken off of the queue.
  • FIFO
    • First in, first out. The first message (oldest) placed on the data queue will be the first message taken off of the queue.
    • Each message on the data queue has a key associated with it. A message can be taken off of the queue only by requesting the key with which it is associated.
Commands for Creating and destroying a data queue:
    • Creates a data queue and stores it in a specified library
    • Deletes the specified data queue from the system

OS/400 application programming interfaces:

    • Send a message (record) to the specified data queue
    • Read a message (record) to the specified data queue
    • Clear all messages from the specified data queue

CRTDTAQ Command allows you to create a data queue object. A data queue is identified on AS400 system by its type *DTAQ. This command allows you to create both local as well DDM data queue. Some of the command parameters are ...

  • Name – This is the name of the data queue. It’s required parameter.
  • Library – Default is user’s current library.
  • Type – Default is standard (*STD). Created on local system. A DDM data queue is the same as a DDM file. It is a logical view of a data queue on another machine. A DDM data queue points to the *STD data queue on the other machine.
  • Max Length –This is the maximum length of each entry. We generally keep it sufficient enough to accommodate any future changes.
  • Auxiliary Storage –Default is *NO. This means any changes to data queue are not immediately written to the backup storage. *YES means changes are immediately written to the backup storage.
  • Access Sequence – This is what we discussed earlier. Default is the most commonly used access sequence i.e *FIFO. Other valid values are *LIFO and *KEYED. If you select *KEYED, you are then prompted for the key length. Just as with a database file, the key length is the length of the data you are going to use as the key to the data queue.
  • Size – This value restricts the maximum storage which can be allocated to a data queue. This can be a number like 100, *MAX16MB or *MAX2GB. With *max options, the system calculates how many max entries should be allowed.


You can create a DDM data queue with the following command:
TEXT('DDM data queue to access data queue on SYSTEMB')

DLTDTAQ command allows you to delete a data queue from a specific a specific library. 


The Send Data Queue (QSNDDTAQ) API sends data to the specified data queue.
call      'QSNDDTAQ'              
parm      '@MYDATAQ'    dtaq_name 
parm      '*LIBL'       dtaq_lib  
parm      256           dtaq_len  
parm                    dtaq_data 

The Receive Data Queue (QRCVDTAQ) API receives data from the specified data queue.
When more than one program has a receive pending on a data queue at one time, a data entry sent to the data queue is received by only one of the programs. The program with the highest run priority receives the entry. The next entry sent to the queue is given to the job with the next highest priority.
call      'QRCVDTAQ'              
parm      '@MYDATAQ'    @DQ_NAME  
parm      '*LIBL'       @DQ_Libr  
parm                    @DQ_Length
parm                    @DQ_Data  
Parm      -1            @Wait_Sec 

Wait time less than ZERO mean infinite wait !


  1. There any place where can i find an example of how to read and work with a record from data queue? for example, from JAVA, I wrote data in the dtaq (four columns, idNumber, first name,last name, securityId), now i need to work with it on a RPG program, but i don't now how to access it, i need to validate idNumber, then validate First Name, etc. Can you Help me?

  2. We are offering website service for your business website....

    telephone apps

  3. Very interesting blog. Alot of blogs I see these days don't really provide anything that I'm interested in, but I'm most definately interested in this one. Just thought that I would post and let you know.
    facebook lite |resignation letter|qr code generator

  4. The blog or and best that is extremely useful to keep I can share the ideas
    of the future as this is really what I was looking for, I am very comfortable and pleased to come here. Thank you very much.
    earn to die 3| earn to die 6
    earn to die 5| happy wheels
    strike force heroes| slitherio
    earn to die 5| good game empire |tank trouble 2 | game tank trouble new

  5. Great info. I would like more information about this, because it is very nice. Thanks for sharing : contact form | snapchat emoji

  6. Let’s keep are safe place to play the very best free games for kids! Please click:
    slither io | wingsio | happy wheels | abcya | happy wheels the game free | tetris | pokemon go to play for free games for kids!