× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



If you're using system() then something like this:

if (rc=system(cmdstring)) {
if (!strcmp(_EXCP_MSGID, "CPF9801"))
return ERR_OBJ_NOT_FOUND;
if (!strcmp(_EXCP_MSGID, "CPF9810"))
return ERR_LIB_NOT_FOUND;
return -1;
} else
return 0; // Object found



On 11/10/2016 6:27 PM, Buck Calabro wrote:
On 11/10/2016 11:54 AM, Kelly Beard wrote:
http://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_71/apis/qmhqrdqd.htm

QMHQRDQD() is an API without an error receiver variable, yet the page lists
possible error codes. How do you get these back from the API? I need a
good C/C++ example on this.
This particular API returns errors the old fashioned way - as exception
messages. If the API runs into an issue (like not authorised to the
library) then IBM i will send a message to your program (the caller of
the API) telling you so.

You need to monitor for, and receive those messages.

The whole topic is covered in 'Handling Exceptions in a Program'
https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_72/rzarh/hexcp.htm#hexcp

It's a little upside down to typical C where you get errno via a 'side
channel' and you can check it or not as you see fit. When IBM i throws
exception messages, your code gets interrupted and a white message
occurs unless you specifically monitor and handle the message.

Also, isn't there a reason no CRTDTAQ API is available? Why just a
command? That makes it difficult to capture any potential errors on that
as well.
This works the same as QMHQRDQD(); you handle the exception message that
arises.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.