Вы находитесь на странице: 1из 11

MySampleCode

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
o
FIFO

Last in, first out. The last message (newest) placed on the data queue
will be the first message taken off of the queue.

First in, first out. The first message (oldest) placed on the data queue
will be the first message taken off of the queue.

KEYED
o

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:


CRTDTAQ
o

Creates a data queue and stores it in a specified library

DLTDTAQ
o

Deletes the specified data queue from the system

OS/400 application programming interfaces:


QSNDDTAQ
o

Send a message (record) to the specified data queue

QRCVDTAQ
o

Read a message (record) to the specified data queue

QCLRDTAQ
o

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. Its required parameter.
Library Default is users 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.

Example:
?

1 CRTDTAQ DTAQ(MYLIB/@MYDATAQ) MAXLEN(256)


You can create a DDM data queue with the following command:
?

1 CRTDTAQ DTAQ(LOCALLIB/DDMDTAQ) TYPE(*DDM)


2 RMTDTAQ(REMOTELIB/REMOTEDTAQ) RMTLOCNAME(SYSTEMB)
3 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.
Example:
?

1 DLTDTAQ DTAQ(MYLIB/@MYDATAQ)
The Send Data Queue (QSNDDTAQ) API sends data to the specified data
queue.
?

1
2
3
4
5

call
parm
parm
parm
parm

'QSNDDTAQ'
'@MYDATAQ'
dtaq_name
'*LIBL'
dtaq_lib
256
dtaq_len
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.
?

1
2
3
4
5
6

call
parm
parm
parm
parm
Parm

'QRCVDTAQ'
'@MYDATAQ'
@DQ_NAME
'*LIBL'
@DQ_Libr
@DQ_Length
@DQ_Data
-1
@Wait_Sec

Wait time less than ZERO mean infinite wait !

Tutorial Tags: AS400 , DataQueue , IBM i , iSeries , RPGLE


Did you find this article helpful? Share it!

9 comments :
1.

AnonymousMay 26, 2015 at 12:35 PM


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?

ReplyDelete
2.

Steve SmithDecember 11, 2015 at 3:17 AM


Great and Useful Article.

Online Java Training


Online Java Training from India

Online Java Training


Online Java Training From India
Java Training Institutes in Chennai
Java Training in Chennai
Java Interview Questions
Java Tutorials
ReplyDelete
3.

Addison adolfMarch 24, 2016 at 6:52 AM


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

telephone apps
ReplyDelete
4.

facebook liteMay 19, 2016 at 11:20 AM


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

ReplyDelete
5.

Candy SimJune 19, 2016 at 11:06 PM


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

ReplyDelete
6.

fgtgggtAugust 2, 2016 at 8:59 AM


grandparents day 2016 national quotes
national grandparents day 2016 quotes
grandparentsday 2016
2016nationalgrandparentsday
nationalgrandparentsday2016quotes
yom kippur prayers 2016
yom kippur wishes 2016
yom kippur quotes 2016
Dance Plus Season 2 Full episodes
Dance Plus Season 2 winner name declared
Dance Plus top 2 finalist name
homemadehalloweencostumesfortoddlers
halloween costumes for toddlers for sale
toddler halloween costumes pinterest
bestelectricrazorformen
top 10 best electric razor for men
top 5 cheap electric razor for women
wwe hellinacell results
wwe hell in a cell matches reaction
wwe hell in a cell moments public reaction
happy thanksgiving wishes for everyone
Top 50 Happy Thanksgiving wishes and quotes
wishing everyone a very happy thanksgiving
thevoiceseason11winnername
the voice season 11 wiki details information
the voice season 11 winner name announced as soon as possible
happyveteransdayquotes2016
veterans day quotes in english
happy veterans day quotes 2016 usa
newyorkmarathonresults2016
new york marathon results, winner, reviews
ReplyDelete

7.

Kelly AnniAugust 17, 2016 at 7:09 AM


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

ReplyDelete
8.

UnknownAugust 28, 2016 at 4:35 AM


Lets 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!

ReplyDelete
9.

xumeiqingOctober 6, 2016 at 2:20 AM


20161006meiqing

coach factory outlet


jordan shoes
ralph lauren outlet
coach factory outlet
ed hardy sale
canada goose
michael kors outlet clearance
uggs
ralph lauren outlet
coach outlet
ReplyDelete
Add comment
Load more...

Newer Post Older Post Home


Subscribe to: Post Comments ( Atom )

Search this Website ...


Check out the Blog Archive

Popular Posts ...

Android switch button example

Android Listview Example using CursorAdapter and SQLite database

Dynamically generate HTML table using JavaScript - document.createElement()


method

Android ListView Checkbox Example - OnItemClickListener() and


OnClickListener()

iOS HTTP request and JSON parsing example

jQuery AJAX request and response example - Java Servlets, MySQL and JSON

Android programmatically add views - Button, TextView, EditText, RadioButton,


CheckBox, ToggleButton

Android ListView dynamically Load more items when scroll to the Bottom

Java SFTP Apache commons file download, upload and delete example

Android options menu, submenu and menu group example

Recent Posts ...

iOS UISearchBar with UITableView example


UISearchBar class provides a text field for entering text, a search button, a bookmark
button, and a cancel button. With

Android JSON stream data parsing example using Gson

If the request to the Web service is a simple JSON object, then you can convert the
HTTP response

Sencha Touch auto login example


If you are creating a native application using Sencha Touch then most likely your
users may expect the app to

Java SFTP Apache commons file download, upload and delete example
Secure File Transfer Protocol or SFTP uses the SSH secure shell protocol to provides
file access, file transfer, and file

iOS programmatically create a custom UITableViewCell


In our previous tutorial we learned how to create a custom UITableViewCell using a
xib file. My personal preference is

Site Information ...

Terms and Conditions

Privacy Policy

Comments Policy

Copyright 2011-2013 mysamplecode.com, All rights reserved. Powered by Blogger.

DMPOBJ. Data queue display.

Unlike DSPDTAARA, There is no iSeries/AS400 defined command


for display data queue.
The following commands are among the few CL commands that

IBM ships with OS/400 for data queues:


* CRTDTAQ--Create Data Queue
* DLTDTAQ--Delete Data Queue
* WRKDTAQ--Work with Data Queues
But No DISPLAY CMD FOR DATAQ is defined for DATAQ. Some one
can created his/her own command to display data queue
contents using APIs. Use Google and give a try.
========================================================
Instead of that TAATOOL (A Third Party Command Utility
Provider) has created a command.
A typical command would be:
DSPDTAQD DTAQ(xxx)
Command parameters
----------------DTAQ The qualified name of the data queue. The
library value defaults to *LIBL. *CURLIB may also
specified.
OUTPUT Whether to display or print the output. * is
the default. *PRINT may be entered. These values have
the same meaning as on system commands.
Re: DATA Queue
A data queue is a first in first out data stack.
The following API will allow you to read a data queue without removing the entry.
Retrieve Data Queue Message (QMHRDQM) retrieves an entry from a data queue without
removing the entry.
Here is a link to get the V5R2 version of the API

http://publib.boulder.ibm.com/iserie...2924/index.htm

Вам также может понравиться