[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


want to know the data queue created or not, before receive the data queue in RPGLE

Posted on 2010-01-03
Medium Priority
Last Modified: 2013-12-06
In my RPGLE, First step i need to send data to debit server program this will be running in batch as a background process, in this data queue will be created and the necessary data will be sent to the data queue using QSNDDTAQ.
Second step i will be displaying the popup till i get response from the batch process(through data queue), so i need to know whether the dtaq created in the batch process or not, to receive the dtaq, so i want to check the whether the data queue object created or not.


Call Debit server program
Call Display popup

Debit server program:(Batch process)
Sending request to another application
expecting response
Got the response
create the dtaq
qsnddtaq the response to the display popup pgm.

Display popup pgm:
Display the popup with invite keyword
it has to receive the response through the data queue, so i need to know whether the data queue created in the batch process, before start doing QRCVDTAQ.

Question by:karthikgayathri
  • 3
  • 2
LVL 36

Accepted Solution

Gary Patterson earned 2000 total points
ID: 26167833
One easy method is to use the CHKOBJ command to verify that the data queue exists.  Something like the sample below.  Chkobj can throw the following errors.  If you want to test for specific errors, you can use a MONITOR block.

CPF9801 Object &2 in library &3 not found.
CPF9802 Not authorized to object &2 in &3.
CPF9810 Library &1 not found.
CPF9815 Member &5 file &2 in library &3 not found.
CPF9820 Not authorized to use library &1.
CPF9830 Cannot assign library &1.
CPF9899 Error occurred during processing of command.

There are other methods, as well. For example, you can call the QUSROBJD API.  If your program is going to call this very frequently, the QUSROBJD call is probably more efficient than calling the CHKOBJ command via the QCMDEXC.

Or you can just call the QRCVDTAQ API - it will also return an error if you pass the name of a data queue that doesn't exist.

- Gary Patterson.

callp(e) qCmdExc (cmd : %len(cmd));
if %error
  'Missing library, object, or authority

Open in new window


Expert Comment

ID: 26171973
Garys code correctly answers the question that was asked.

When I do that kind of data queue processes I have the client create their own queue prior to making the request.  That way you KNOW the queue will be present.  You can just hang on the queue read right away.

Steve Bowdoin
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 26327030
Hi Steve,

An other approach is creating the DTAQ in CL before starting the RPG program:

Just create the DataQ and catch the error if it exist.

           CRTDTAQ DTAQ(MyLib/MyDTAQ) MAXLEN(50)
           MONMSC CPF0000

The MONMSG will suppres the error if the DTAQ exist.
so after these 2 lines It will be there.

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

LVL 16

Expert Comment

by:theo kouwenhoven
ID: 26477923
Did it work ????
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 28072259
there are more then one road to rome, isn't there?
LVL 36

Expert Comment

by:Gary Patterson
ID: 28235459
In the original question, the author specifically indicated that that it is the server program's job to create the data queue and populate it.  

In that particular case, creating the queue in the client could break the server, which is why I instead provided a relatively low-risk method for checking for the existence of the data queue in the client, rather than suggesting creating the queue where it could possibly interfere with the functionality of the server program.

I agree that, in general, it doesn't matter if the client or the server creates the queue, but in the particular case described in this question, and without seeing the server code, I think the best answer is to block on the client side and wait for the server to create and populate the queue.

- Gary


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows 7 does not have the best desktop search built in. This is something Windows 7 users have struggled with. You type something in, and your search results don’t always match what you are looking for, or it doesn’t actually work at all. There ar…
Windows 10 is here and for most admins this means frustration and challenges getting that first working Windows 10 image. As in my previous sysprep articles, I've put together a simple help guide to get you through this process. The aim is to achiev…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question