Can we see all the entries of DATA Queue without removing it from that DATA queue? If yes how?Which API or command can we use?
Announcement
Collapse
No announcement yet.
DATA Queue
Collapse
X
-
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.htmNever trust a dog to watch your food.
-
Re: DATA Queue
You can also use the Qshell utility 'dataq'. It will read, write, or clear a dataq.
If you want to display dataq contents (actually, it is uses the 'r' -read switch with the 'p' -peek switch) to your screen (aka STDOUT) use:
Code:QSH dataq -rlp /qsys.lib/coalib.lib/statement.dtaq
Code:PGM DCL VAR(&QSHCMD) TYPE(*CHAR) LEN(100) OVRDBF FILE(STDOUT) TOFILE(YOURLIB/YOURFILE) CHGVAR VAR(&QSHCMD) VALUE('dataq -rlp + /qsys.lib/yourlib.lib/yourdataq.dtaq') QSH CMD(&QSHCMD) ENDPGM
Comment
-
Re: DATA Queue
No sir Mr. Octane. The 'p' switch is for peek mode, which is read only.
More info is here:
Follow link to IBM
PeteLast edited by jimmyoctane; February 15, 2006, 11:21 AM.
Comment
-
Re: DATA Queue
Nice ....... R u dating anyone?
Like cowboy movies???
Code:dataq - Send or receive messages from OS/400 data queue Synopsis dataq -c queue dataq -r [-lp] [-n number] [-t seconds] queue dataq -w [-l] [-n number] queue [ data ... ] Description The dataq utility clears messages from a data queue, reads messages from a data queue, or writes messages to a data queue. In the first synopsis form, dataq clears all of the messages from the queue. In the second synopsis form, dataq reads messages from the queue and writes them to standard output. By default, it reads one message from the queue. If no messages are available from the queue, dataq waits for a message. In the third synopsis form, dataq writes messages to the queue. If data is specified, it is written as one message to the queue. Otherwise, each line read from standard input is written as a message to the queue. Options -c Clear all of the messages from the queue. -l When a relative path name is specified, use the library list to find the queue. -n number If the -r option is specified, read number messages from the queue. If the -w option is specified, write number messages to the queue. -p Peek mode. When reading messages, the messages are left on the queue. -r Read messages from the queue. -t seconds When reading messages, exit if no messages have been received after seconds seconds of waiting. -w Write messages from the queue. Operands The queue is the path name to a data queue. A data queue can only exist in the QSYS.LIB file system. Exit Status 0 when successful >0 when unsuccessful
Take care
JimmyLast edited by jimmyoctane; February 15, 2006, 11:11 AM.
Comment
-
Re: DATA Queue
I believe that is where you use the -n (number) switch.
I think the syntax would be 'dataq -rlp -n xx /qsys.lib/yourlib.lib/yourq.dtaq', where xx is how many entries you want.
I have never used it for multiple entries. I had set up a dataq on an output queue so that a spool file produced daily at 9:00 would be converted to a disk file, zipped and then FTPd to a 3rd party mailing firm. I never had more than one entry in the queue at a time.
Pete
Comment
-
Re: DATA Queue
I know I tried this
Code:PGM DCL VAR(&QSHCMD) TYPE(*CHAR) LEN(100) OVRDBF FILE(STDOUT) TOFILE(JAMIELIB/SOURCE) + MBR(JACKEM) CHGVAR VAR(&QSHCMD) VALUE('dataq -rlp -n05 + /qsys.lib/jamielib.lib/test.dtaq') QSH CMD(&QSHCMD) ENDPGM
cause i know there are five entries but i get this
Code:Test entry1-11.38.57 TEST JAMIELIB 0001-01-01-00.00.00. 000000 Test entry1-11.38.57 TEST JAMIELIB 0001-01-01-00.00.00. 000000 Test entry1-11.38.57 TEST JAMIELIB 0001-01-01-00.00.00. 000000 Test entry1-11.38.57 TEST JAMIELIB 0001-01-01-00.00.00. 000000 Test entry1-11.38.57 TEST JAMIELIB 0001-01-01-00.00.00. 000000
Code:PGM DCL VAR(&QSHCMD) TYPE(*CHAR) LEN(100) OVRDBF FILE(STDOUT) TOFILE(JAMIELIB/SOURCE) + MBR(JACKEM) CHGVAR VAR(&QSHCMD) VALUE('dataq -rl -n05 + /qsys.lib/jamielib.lib/test.dtaq') QSH CMD(&QSHCMD) ENDPGM
Code:Test entry1-11.38.57 TEST JAMIELIB 0001-01-01-00.00.00. 000000 Test entry2-11.38.57 TEST JAMIELIB 0001-01-01-00.00.00. 000000 Test entry3-11.38.57 TEST JAMIELIB 0001-01-01-00.00.00. 000000 Test entry4-11.38.57 TEST JAMIELIB 0001-01-01-00.00.00. 000000 Test entry5-11.38.57 TEST JAMIELIB 0001-01-01-00.00.00. 000000
Last edited by jimmyoctane; February 15, 2006, 03:36 PM.
Comment
-
Re: DATA Queue
also see attached program I have tried with both QRCVDTAQ remove message = 'N' and QMHRDQM I have same issues when trying it this way???
Code:** d TimeStamp s Z d IsOdate s D d Count s 4 0 d Count2 s 4 0 d CmdString s 256 d CmdLength s 15 5 d Reply s 1 d Chr26 s 26 ** * The defined fields for the QRCVDTAQ ** d DtaqName s 10A inz('TEST') d DtaqLib s 10A inz('QTEMP') d DtaqLen s 5P 0 inz(1000) d Data s 40A d WaitTime s 5P 0 inz(-1) d KeyOrder s 2A d KeyLen s 3P 0 d KeyData s 32766A d SenderLen s 3P 0 d SenderInfo s 32766A d RmvMsg s 10A inz('*YES') d RcvVarSize s 5P 0 d ErrorCode s 32766A * d Receiver s 2322 d ReceiverLen s 4B 0 inz(2322) d ReceiverFmt s 8 inz('RDQM0100') d DataQName s 20 inz('TEST QTEMP') d MessageSel s 272 d MessageSelLn s 4B 0 inz(32) d MessageFmt s 8 inz('RDQS0200') d Error s 4B 0 inz(0) * * constants * d Q c const('''') * ** ** Delete the message queue ** c eval cmdstring = 'DLTDTAQ QTEMP/TEST' c eval cmdlength = %len(%trim(cmdstring)) * c call(e) 'QCMDEXC' c parm cmdstring c parm cmdlength ** ** CRTDTAQ DTAQ(QTEMP/TEST) MAXLEN(1000) SEQ(*KEYED) ** KEYLEN(05) SENDERID(*YES) ** c eval cmdstring = 'CRTDTAQ DTAQ(QTEMP/TEST) ' + c 'MAXLEN(1000) SENDERID(*YES)' + c ' TEXT(' + Q + 'test dataq'+ Q + ')' c eval cmdlength = %len(%trim(cmdstring)) c call(e) 'QCMDEXC' c parm cmdstring c parm cmdlength ** ** Clear data queue ** c call(e) 'QCLRDTAQ' c parm DtaqName c parm DtaqLib ** c for Count = 1 to 5 ** c eval Data = 'Test entry' + %char(Count) + c '-' + %char(%time()) ** c call(e) 'QSNDDTAQ' c parm DtaqName Data queue name c parm DtaqLib Data queue library c parm DtaqLen Data queue length c parm Data Queued data c****> parm KeyLen Key length c****> parm KeyData Key value ** c endfor ** c do 1 ** c call 'QRCVDTAQ' c parm DtaqName Data queue name c parm DtaqLib Data queue library c parm DtaqLen Data queue length c parm Data Queued data c parm WaitTime Seconds to wait c****> parm KeyOrder Key selection c****> parm KeyLen Key length c****> parm KeyData Key valueh c****> parm SenderLen Senderninfo length c****> parm SenderInfo Senderninfo c****> parm RmvMsg RemovenMsg *NO or *YES c****> parm RcvVarSize Sizelofgdata receiver c****> parm ErrorCode Errorength ** c data dsply reply ** c enddo ** c for Count = 1 to 5 c call 'QMHRDQM' c parm Receiver Data queue name c parm ReceiverLen Data queue library c parm ReceiverFmt Data queue length c parm DataQName Queued data c parm MessageSel Seconds to wait c parm MessageSelLn Seconds to wait c parm MessageFmt Seconds to wait c parm Error Seconds to wait c endfor ** c eval *INLR = *on **
Attached Files
Comment
-
Re: DATA Queue
Bad news, JimmyO. The lads in Rochester tell me that -p (peek mode) will only return one value. If the -n (number) switch is used in addition to the -p switch, it will return that one value n times. If the -p switch is removed, the -n switch will work properly. This is considered to be "working as designed".
They did indicate that the documentation could be better, so maybe by V6R4 the info center will be rewritten.......
PeteLast edited by Pete; February 16, 2006, 08:41 AM.
Comment
Comment