ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General IBM MQ Support » MQ Series channel exit on NT

Post new topic  Reply to topic
 MQ Series channel exit on NT « View previous topic :: View next topic » 
Author Message
xabhijit
PostPosted: Fri Apr 04, 2003 6:21 am    Post subject: MQ Series channel exit on NT Reply with quote

Newbie

Joined: 04 Apr 2003
Posts: 6

I have configured a sender and receiver channel on 2000.I have defined a new format and created the dll and copied it in MQSeries/Exits dir.Next I run my MQPUT with MQMD as my new format in the code.But the code end with

MQPUT ended with reason code 2026...

Can anyone say what is wrong. Else can any one give me a step by step instruction to write a channel exit on NT/2000.

Thanx,
Abhijit.
Back to top
View user's profile Send private message
bower5932
PostPosted: Fri Apr 04, 2003 6:32 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

If you are getting a 2026 on the MQPUT, I don't think your channel exits have even come into play. I'd double-check your code to make sure that you didn't corrupt the MQMD while you were building it. If you don't spot anything, post the code fragment here.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
meekings
PostPosted: Fri Apr 04, 2003 6:49 am    Post subject: Reply with quote

Voyager

Joined: 28 Jun 2001
Posts: 86
Location: UK, South West

I think format names beginning MQ* are reserved - probably better to name it something else. MQ may be getting in your way and trying to deal with it first.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
xabhijit
PostPosted: Sun Apr 06, 2003 8:25 pm    Post subject: Reply with quote

Newbie

Joined: 04 Apr 2003
Posts: 6

Here is the complete steps which I have tried
1)Created QM1 and QM2 where QM1 is running on Port 1411 and QM2 running on 1412.I have created a remote Q def + a transmission Q and a sender channel with data convert Yes in QM1 and a corresponding receiver channel and local Q in QM2.
2)I have created a format
typedef struct _mymsg {
MQCHAR ID;
} mymsg; and I name it as MYFORMAT and created a dll.I have also defined the entry point in the MYFORMAT.DEF and placed the dll and .def file in the MQSERIES/Exits directory
3)I tried to run the following code --
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cmqc.h>

#define BLANKS ''
#define MQFMT_TEST "MYFORMAT"

int main(int argc, char **argv)
{


FILE *fp;
int i;


MQOD od = {MQOD_DEFAULT}; /* Object Descriptor */
MQOD odr = {MQOD_DEFAULT}; /* Object Descriptor for reply */
//MQMD md = {MQMD_DEFAULT}; /* Message Descriptor */
MQMD md ; /* Message Descriptor */
MQPMO pmo = {MQPMO_DEFAULT}; /* put message options */


MQHCONN Hcon; /* connection handle */
MQHOBJ Hobj; /* object handle (server) */
MQHOBJ Hreply; /* object handle for reply */
MQLONG O_options; /* MQOPEN options */
MQLONG C_options; /* MQCLOSE options */
MQLONG CompCode; /* completion code */
MQLONG OpenCode; /* MQOPEN completion code */
MQLONG Reason; /* reason code */
MQLONG CReason; /* reason code for MQCONN */
char buffer[100]; /* message buffer */
MQLONG buflen; /* buffer length */
//MQLONG replylen; /* reply length */
char QMName[50], QName[50]; /* queue manager name
*/
//MQBYTE24 myCorrelid;
//int replyct;

printf("MQPUT start...\n");
if (argc < 1)
{
printf("Required parameter missing - queue name\n");
exit(99);
}
//printf("Argc is %d\n", argc);
strcpy(QName, argv[1]);

QMName[0] = 0; /* default */
if (argc > 2)
strcpy(QMName, argv[2]);

//1.
MQCONN(QMName, /* queue manager */
&Hcon, /* connection handle */
&CompCode, /* completion code */
&CReason); /* reason code */


if (CompCode == MQCC_FAILED)
{
printf("MQCONN ended with reason code %ld\n", CReason);
exit(CReason);
}


strncpy(od.ObjectName, argv[1], MQ_Q_NAME_LENGTH);


O_options = MQOO_OUTPUT /* open queue for output */
+ MQOO_FAIL_IF_QUIESCING; /* but not if MQM stopping */

//2.
MQOPEN(Hcon, /* connection handle */
&od, /* object descriptor for queue */
O_options, /* open options */
&Hobj, /* object handle */
&OpenCode, /* completion code */
&Reason); /* reason code */


if (Reason != MQRC_NONE)
{
printf("MQOPEN ended with reason code %ld\n", Reason);
}

if (OpenCode == MQCC_FAILED)
{
printf("unable to open server queue for output %ld \n", Reason);
i= Reason;
MQDISC(&Hcon, /* connection handle */
&CompCode, /* completion code */
&Reason);
exit(i);
}


O_options = MQOO_INPUT_EXCLUSIVE
+ MQOO_FAIL_IF_QUIESCING;

CompCode = OpenCode; /* use MQOPEN result for initial test */
fp = stdin;

fgets(buffer, sizeof(buffer) - 1, fp) ;

buflen = strlen(buffer) - 1;
buffer[buflen] = '\0';


///
/****************************************************************/
/* The following two statements are not required if the MQGMO */
/* version is set to MQGMO_VERSION_2 and and gmo.MatchOptions */
/* is set to MQGMO_NONE */
/****************************************************************/
/* */
/* In order to read the messages in sequence, MsgId and */
/* CorrelID must have the default value. MQGET sets them */
/* to the values in for message it returns, so re-initialise */
/* them before every call */
/* */
/****************************************************************/
memcpy(md.MsgId, MQMI_NONE, sizeof(md.MsgId));
memcpy(md.CorrelId, MQCI_NONE, sizeof(md.CorrelId));

/****************************************************************/
/* */
/* MQGET sets Encoding and CodedCharSetId to the values in */
/* the message returned, so these fields should be reset to */
/* the default values before every call, as MQGMO_CONVERT is */
/* specified. */
/* */
/****************************************************************/

md.Encoding = MQENC_NATIVE;
md.CodedCharSetId = MQCCSI_Q_MGR;


///

md.MsgType = MQMT_REQUEST; /* message is a request */
md.Report = MQRO_EXCEPTION_WITH_DATA;

//char *strncpy( char *strDest, const char *strSource, size_t count );
strncpy(md.ReplyToQ,"DLQ", strlen("DLQ"));

//memcpy(md.Format, MQFMT_STRING, MQ_FORMAT_LENGTH);
//void *memcpy( void *dest, const void *src, size_t count );

//memcpy(md.Format, MQFMT_TEST, MQ_FORMAT_LENGTH);
memcpy(md.Format, "MYFORMAT", MQ_FORMAT_LENGTH);
//memcpy(md.Format, MQFMT_NONE, MQ_FORMAT_LENGTH);
//3.


MQPUT(Hcon,
Hobj,
&md, //message descriptor
&pmo, //put message options
buflen,
buffer,
&CompCode,
&Reason);

if (Reason != MQRC_NONE)
{
printf("MQPUT ended with reason code %ld\n", Reason);
}

/*
MQRC_MD_ERROR (2026, X'7EA') Message descriptor not valid.
*/
//4.
MQCLOSE(Hcon, /* connection handle */
&Hreply, /* object handle */
C_options,
&CompCode, /* completion code */
&Reason); /* reason code */
//5.
MQDISC(&Hcon, /* connection handle */
&CompCode, /* completion code */
&Reason); /* reason code */
printf ("\n closed all Components .. \n\n");

}
Back to top
View user's profile Send private message
vmcgloin
PostPosted: Mon Apr 07, 2003 12:18 am    Post subject: Reply with quote

Knight

Joined: 04 Apr 2002
Posts: 560
Location: Scotland

Could the problem be that you are not populating the md with default values?

Code:
//MQMD md = {MQMD_DEFAULT}; /* Message Descriptor */
MQMD md ; /* Message Descriptor */


Quote:
MQRC_MD_ERROR (2026, X'07EA')

Explanation: The MQMD structure is not valid, for one of the following reasons:

The StrucId field is not MQMD_STRUC_ID.
The Version field specifies a value that is not valid or not supported.
The parameter pointer is not valid. (It is not always possible to detect parameter pointers that are not valid; if not detected, unpredictable results occur.)
The queue manager cannot copy the changed structure to application storage, even though the call is successful. This can occur, for example, if the pointer points to read-only storage.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » MQ Series channel exit on NT
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.