LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   ibm mq series (https://www.linuxquestions.org/questions/programming-9/ibm-mq-series-515826/)

girish_hilage 01-03-2007 03:26 AM

ibm mq series
 
I have one query regarding ibm mq series:

To open the MQ series queue I am using the API as follows:
MQOPEN (HCon, &od, MQOO_OUTPUT, &HObj, &CompCode, &Reason);

In "CompCode" it returns if the function is succeeded or not and in the "Reason" it returns the reason code specifying the reason.

But the problem is "Reason" is an integer but I want the actual reason in the string format i.e. actual error text (e.g. error string like "File not found").

So, does anybody know any function in IBM MQ series (just like perror()) to convert the "Reason" code to the actual error text?

Regards,
Girish

paulsm4 01-03-2007 10:03 AM

Hi -

AFAIK, there is no equivalent of "perror ()" for IBM MQSeries. But it shouldn't be difficult to write one for yourself. The documentation you would need is on-line here:
Websphere MQ Application Programming Reference

'Hope that helps .. PSM

girish_hilage 01-05-2007 05:48 AM

Do you mean,

void mq_perror (int reason_code, char *reason_string, int n)
{
switch (reason_code)
{
case MQRC_Q_MGR_NOT_AVAILABLE :
strncpy (reason_string, n, "Queue Manager not Available");
break;

case MQRC_REPORT_OPTIONS_ERROR :
strncpy (reason_string, n, "Invalid options in Report field in the message descriptor MQMD");
break;

and so on ...........
}
}

Regards,
Girish

paulsm4 01-05-2007 10:04 AM

Hi, girish_hilage -

Yup: that's exactly what I mean.

One minor suggestion - mq_perror would be a lot more useful if it returned a pointer to your *reason buffer:
Code:

char * mq_perror (int reason_code, char *reason_string, int n)
That way, you could use it directly inside of "printf()", etc. Just a thought...

girish_hilage 01-07-2007 03:31 AM

Yes. Thank you very much for your reply.


All times are GMT -5. The time now is 01:09 PM.