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 » Dummy MQ data exit

Post new topic  Reply to topic
 Dummy MQ data exit « View previous topic :: View next topic » 
Author Message
kumarbai
PostPosted: Wed May 29, 2013 6:03 am    Post subject: Dummy MQ data exit Reply with quote

Apprentice

Joined: 24 May 2013
Posts: 45

I managed to write a dummy data conversion exit program for MQIMSVS .
Can someone verify whether this is a really a dummy exit and make sure it will not do any conversion?




Code:
/* @(#) samples/c/amqsvfc0.c, samples, p701, p701-105-110415 1.13.3.1 09/08/17 00:58:48 */
 /********************************************************************/
 /*                                                                  */
 /* Program name: AMQSVFC0                                           */
 /*                                                                  */
 /* Description: Sample C skeleton of a Data Conversion exit         */
 /*              routine                                             */
 /*                                                                  */
 /* <N_OCO_COPYRIGHT>                                                */
 /* Licensed Materials - Property of IBM                             */
 /*                                                                  */
 /* 63H9336                                                          */
 /* (c) Copyright IBM Corp. 1994, 2005 All Rights Reserved.          */
 /*                                                                  */
 /* US Government Users Restricted Rights - Use, duplication or      */
 /* disclosure restricted by GSA ADP Schedule Contract with          */
 /* IBM Corp.                                                        */
 /* <NOC_COPYRIGHT>                                                  */
 /*                                                                  */
 /*                                                                  */
 /********************************************************************/
 /*                                                                  */
 /* Function:                                                        */
 /*                                                                  */
 /*   AMQSVFC0 is a sample C skeleton of a Data Conversion exit      */
 /*   routine.                                                       */
 /*   Each Data Conversion exit routine converts a single named      */
 /*   Format.  This skeleton is intended as a wrapper for code       */
 /*   fragments generated by the Data Conversion Exit-generation     */
 /*   utility program - crtmqcvx.                                    */
 /*                                                                  */
 /*   The utility produces one code fragment for each data           */
 /*   structure; a format may be defined in terms of several         */
 /*   such structures so that several code fragments will need       */
 /*   to be added to this skeleton to produce a routine to do        */
 /*   data conversion of the entire Format.                          */
 /*                                                                  */
 /*   For Windows and OS/2 systems:                                  */
 /*     Once complete the code should be compiled into a DLL with    */
 /*     the name of the DLL being the name of the format to be       */
 /*     converted. Note that this name should also be put into the   */
 /*     sample .DEF file (AMQSVFC2.DEF for OS/2, AMQSVFCN.DEF for    */
 /*     Windows NT) - replace the library name FORMAT1 with the name */
 /*     of the format being converted.                               */
 /*                                                                  */
 /*   For Unix systems:                                              */
 /*     Once complete the code should be compiled into a loadable    */
 /*     object. The name of the object should be the name of the     */
 /*     format to be converted.                                      */
 /*                                                                  */
 /*   See the WebSphere MQ Application Programming Guide for         */
 /*   further information.                                           */
 /*                                                                  */
 /********************************************************************/
 /*                                                                  */
 /*  AMQSVFC0 takes the parameters defined for a Data Conversion     */
 /*  exit routine in the CMQXC.H header file.                        */
 /*                                                                  */
 /********************************************************************/
 #include <cmqc.h>              /* For MQI datatypes                 */
 #include <cmqxc.h>             /* For MQI exit-related definitions  */
 #include <amqsvmha.h>          /* For sample macro definitions      */

 /********************************************************************/
 /* Insert the function prototypes for the functions produced by     */
 /* the data conversion utility program.                             */
 /********************************************************************/

 MQDATACONVEXIT MQStart;
MQLONG ConvertMQIMSVS (PMQBYTE *in_cursor,
PMQBYTE *out_cursor,
PMQBYTE in_lastbyte,
PMQBYTE out_lastbyte,
MQHCONN hConn,
MQLONG opts,
MQLONG MsgEncoding,
MQLONG ReqEncoding,
MQLONG MsgCCSID,
MQLONG ReqCCSID,
MQLONG CompCode,
MQLONG Reason);

 /********************************************************************/
 /* On some Unix systems, the name of this function is not important */
 /* as it is not actually used to call the conversion exit but it    */
 /* must be an exported symbol or the entrypoint to the module.  On  */
 /* other systems (typically SVR4-based implementations) the name    */
 /* must be set to MQStart. On Windows and OS/2, the function must   */
 /* exported in the .DEF file.                                       */
 /* More information can be found in the WebSphere MQ Application    */
 /* Programming Guide.                                               */
 /********************************************************************/
 void MQENTRY MQStart(
   PMQDXP   pDataConvExitParms, /* Data-conversion exit parameter    */
                                /* block                             */
   PMQMD    pMsgDesc,           /* Message descriptor                */
   MQLONG   InBufferLength,     /* Length in bytes of InBuffer       */
   PMQVOID  pInBuffer,          /* Buffer containing the unconverted */
                                /* message                           */
   MQLONG   OutBufferLength,    /* Length in bytes of OutBuffer      */
   PMQVOID  pOutBuffer)         /* Buffer containing the converted   */
                                /* message                           */
 {
   MQLONG   ReturnCode   = MQRC_NONE;
   MQHCONN  hConn        = pDataConvExitParms->Hconn;
   MQLONG   opts         = pDataConvExitParms->AppOptions;
   PMQBYTE  in_cursor    = (PMQBYTE)pInBuffer;
   PMQBYTE  out_cursor   = (PMQBYTE)pOutBuffer;
   PMQBYTE  in_lastbyte  = (PMQBYTE)pInBuffer + InBufferLength - 1;
   PMQBYTE  out_lastbyte = (PMQBYTE)pOutBuffer + OutBufferLength - 1;
   MQLONG   MsgEncoding  = pMsgDesc->Encoding;
   MQLONG   ReqEncoding  = pDataConvExitParms->Encoding;
   MQLONG   MsgCCSID     = pMsgDesc->CodedCharSetId;
   MQLONG   ReqCCSID     = pDataConvExitParms->CodedCharSetId;
   MQLONG   CompCode     = pDataConvExitParms->CompCode;
   MQLONG   Reason       = pDataConvExitParms->Reason;

   /******************************************************************/
   /* Insert calls to the code fragments to convert the format's     */
   /* structure(s) here.                                             */
    ReturnCode = ConvertMQIMSVS(
   &in_cursor,
   &out_cursor,
   in_lastbyte,
   out_lastbyte,
   hConn,
   opts,
   MsgEncoding,
   ReqEncoding,
   MsgCCSID,
   ReqCCSID,
   CompCode,
   Reason);                             
   /******************************************************************/


   /******************************************************************/
   /* Check whether the conversion succeeded                         */
   /******************************************************************/
   if ((ReturnCode == MQRC_NONE) ||
       (ReturnCode == MQRC_TRUNCATED_MSG_ACCEPTED))
   {
     pDataConvExitParms->ExitResponse = MQXDR_OK;
     /****************************************************************/
     /* Always return new length. Queue manager code decides         */
     /* if the new length is to be reported.                         */
     /* Warning - this assumes that out_cursor has been set up to    */
     /* point to the end of the message. Routines produced by the    */
     /* data conversion exit utility will do this BUT if you are     */
     /* writing your own routines ensure it is updated or the        */
     /* message could end up with a zero length and appear not to    */
     /* get converted!                                               */
     /****************************************************************/
     pDataConvExitParms->DataLength = (MQLONG)(out_cursor
                                         - (PMQBYTE)pOutBuffer);
   }
   /******************************************************************/
   /* Otherwise indicate that conversion of the message data failed. */
   /******************************************************************/
   else
   {
     pDataConvExitParms->ExitResponse = MQXDR_CONVERSION_FAILED;
   }
   /******************************************************************/
   /* It the message is not already truncated update comp code, and  */
   /* reason.                                                        */
   /******************************************************************/
   if (Reason != MQRC_TRUNCATED_MSG_ACCEPTED)
   {
      pDataConvExitParms->Reason = ReturnCode;

     if (ReturnCode == MQRC_NONE)
     {
       pDataConvExitParms->CompCode   = MQCC_OK;
     }
     else
     {
       pDataConvExitParms->CompCode = MQCC_WARNING;
     }
   }

   return;
 }

 /********************************************************************/
 /* Insert the functions produced by the data conversion exit        */
 /* utility program.                                                 */
 /********************************************************************/
MQLONG ConvertMQIMSVS(
PMQBYTE *in_cursor,
PMQBYTE *out_cursor,
PMQBYTE in_lastbyte,
PMQBYTE out_lastbyte,
MQHCONN hConn,
MQLONG opts,
MQLONG MsgEncoding,
MQLONG ReqEncoding,
MQLONG MsgCCSID,
MQLONG ReqCCSID,
MQLONG CompCode,
MQLONG Reason)
{
MQLONG ReturnCode = MQRC_NONE;

return(ReturnCode);

Fail:
return(ReturnCode);
}



 /********************************************************************/
 /*                                                                  */
 /* END OF AMQSVFC0                                                  */
 /*                                                                  */
 /********************************************************************/





PS:Mr Vitor ! This is not a duplicate post.Please dont lock it.
Back to top
View user's profile Send private message
zpat
PostPosted: Wed May 29, 2013 6:12 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

You really do want other people to do your job for you!

I've never coded C but even I can work out what lines to remove so that it does nothing and sets a successful return code.

Although - using a "dummy" data exit is a terrible solution to whatever problem you think you have.

Fix the programming error at source!
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed May 29, 2013 6:15 am    Post subject: Re: Dummy MQ data exit Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

kumarbai wrote:
Can someone verify whether this is a really a dummy exit and make sure it will not do any conversion?


It's still unnecessary. Also remember that exits run as part of the queue manager and any fault or failure in the exit will cause (at best) queue manager performance to drop and (at worst) cause the queue manager to crash.

kumarbai wrote:
Mr Vitor ! This is not a duplicate post.


You're still looking for us to do you job. Rather than fixing your conversion problem for you, you now want us to review code for you.

What happens when you test the exit? Does conversion occur? You could find that out much more quickly than waiting for a response here.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » Dummy MQ data exit
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.