|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Issue with C code while using PCF |
« View previous topic :: View next topic » |
Author |
Message
|
sanjoo |
Posted: Wed Jan 11, 2006 9:45 pm Post subject: Issue with C code while using PCF |
|
|
 Acolyte
Joined: 26 Oct 2005 Posts: 65
|
I am trying to use a C code which has PCF commands.
I am preparing the command and writting on SYSTEM.ADMIN.COMMAND.QUEUE.
However, I can see the message going on dead letter queue with RC 2029 (MQRC_MSG_TYPE_ERROR).
Any guesses what is this error about?
I have build this code from example given in PCF manual and altered somewhat.
I am attaching the code just for reference ----
/*===========================================================================*/
/* */
/* This is a program to inquire of the default queue manager about the */
/* local queues defined to it. */
/* */
/* The program takes this information and appends it to a file */
/* SAVEQMGR.TST which is of a format suitable for RUNMQSC. It could, */
/* therefore, be used to recreate or clone a queue manager. */
/* */
/* It is offered as an example of using Programmable Command Formats (PCFs) */
/* as a method for administering a queue manager. */
/* */
/*===========================================================================*/
/* Include standard libraries */
#include <memory.h>
#include <stdio.h>
/* Include MQSeries headers */
#include <cmqc.h>
#include <cmqcfc.h>
#include <cmqxc.h>
#include<stdlib.h>
#include<string.h>
typedef struct LocalQParms {
MQCHAR48 QName;
MQLONG QType;
MQCHAR64 QDesc;
MQLONG InhibitPut;
MQLONG DefPriority;
MQLONG DefPersistence;
MQLONG InhibitGet;
MQCHAR48 ProcessName;
MQLONG MaxQDepth;
MQLONG MaxMsgLength;
MQLONG BackoutThreshold;
MQCHAR48 BackoutReqQName;
MQLONG Shareability;
MQLONG DefInputOpenOption;
MQLONG HardenGetBackout;
MQLONG MsgDeliverySequence;
MQLONG RetentionInterval;
MQLONG DefinitionType;
MQLONG Usage;
MQLONG OpenInputCount;
MQLONG OpenOutputCount;
MQLONG CurrentQDepth;
MQCHAR12 CreationDate;
MQCHAR8 CreationTime;
MQCHAR48 InitiationQName;
MQLONG TriggerControl;
MQLONG TriggerType;
MQLONG TriggerMsgPriority;
MQLONG TriggerDepth;
MQCHAR64 TriggerData;
MQLONG Scope;
MQLONG QDepthHighLimit;
MQLONG QDepthLowLimit;
MQLONG QDepthMaxEvent;
MQLONG QDepthHighEvent;
MQLONG QDepthLowEvent;
MQLONG QServiceInterval;
MQLONG QServiceIntervalEvent;
} LocalQParms;
void ProcessStringParm( MQCFST *pPCFString, LocalQParms *DefnLQ );
void ProcessIntegerParm( MQCFIN *pPCFInteger, LocalQParms *DefnLQ );
int AddToFileQLOCAL( LocalQParms DefnLQ );
void MQParmCpy( char *target, char *source, int length );
void PutMsg( MQHCONN hConn, /* Connection to queue manager */
MQCHAR8 MsgFormat, /* Format of user data to be put in msg */
MQHOBJ hQName, /* handle of queue to put the message to */
MQCHAR48 QName, /* name of queue to put the message to */
MQBYTE *UserMsg, /* The user data to be put in the message */
MQLONG UserMsgLen /* */
);
void PutMsg( MQHCONN hConn, /* Connection to queue manager */
MQCHAR8 MsgFormat, /* Format of user data to be put in msg */
MQHOBJ hQName, /* handle of queue to put the message to */
MQCHAR48 QName, /* name of queue to put the message to */
MQBYTE *UserMsg, /* The user data to be put in the message */
MQLONG UserMsgLen /* */
)
{
MQLONG CompCode; /* completion code */
MQLONG Reason; /* MQOPEN completion code */
MQPMO pmo = {MQPMO_DEFAULT}; /* put message options */
MQMD md = {MQMD_DEFAULT}; /* Message Descriptor */
memcpy(md.Format, /* character string format */
MQFMT_ADMIN, (size_t)MQ_FORMAT_LENGTH);
strcpy(md.ReplyToQ,"SAN_IN\0");
MQPUT(hConn, /* connection handle */
hQName, /* object handle */
&md, /* message descriptor */
&pmo, /* default options (datagram) */
UserMsgLen, /* message length */
&UserMsg, /* message buffer */
&CompCode, /* completion code */
&Reason); /* reason code */
}
void GetMsg( MQHCONN hConn /* handle of queue manager */
, MQLONG MQParm /* Options to specify nature of get */
, MQHOBJ hQName /* handle of queue to read from */
, MQCHAR48 QName /* name of queue to read from */
, MQBYTE *UserMsg /* Input/Output buffer containing msg */
, MQLONG ReadBufferLen /* Length of supplied buffer */
);
void GetMsg( MQHCONN hConn /* handle of queue manager */
, MQLONG MQParm /* Options to specify nature of get */
, MQHOBJ hQName /* handle of queue to read from */
, MQCHAR48 QName /* name of queue to read from */
, MQBYTE *UserMsg /* Input/Output buffer containing msg */
, MQLONG ReadBufferLen /* Length of supplied buffer */
)
{
MQLONG CompCode; /* completion code */
MQLONG Reason; /* MQOPEN completion code */
MQGMO gmo = {MQGMO_DEFAULT}; /* put message options */
MQMD md = {MQMD_DEFAULT}; /* Message Descriptor */
MQLONG messlen; /* message length received */
gmo.Options = MQParm;
strcpy(md.Format,"MQSTR ");
MQGET(hConn, /* connection handle */
hQName, /* object handle */
&md, /* message descriptor */
&gmo, /* get message options */
ReadBufferLen, /* buffer length */
UserMsg, /* message buffer */
&messlen, /* message length */
&CompCode, /* completion code */
&Reason); /* reason code */
}
MQHOBJ OpenQ( MQHCONN hConn
, MQCHAR48 QName
, MQLONG OpenOpts
);
MQHOBJ OpenQ( MQHCONN hConn
, MQCHAR48 QName
, MQLONG OpenOpts
)
{
MQHOBJ Hobj;
MQLONG CompCode; /* completion code */
MQLONG Reason; /* MQOPEN completion code */
MQOD od = {MQOD_DEFAULT}; /* Object Descriptor */
strcpy(od.ObjectName, QName);
MQOPEN(hConn, /* connection handle */
&od, /* object descriptor for queue */
OpenOpts, /* open options */
&Hobj, /* object handle */
&CompCode, /* completion code */
&Reason); /* reason code */
return(Hobj);
}
int main( int argc, char *argv[] )
{
MQCHAR48 QMgrName; /* Name of connected queue mgr */
MQHCONN hConn; /* handle to connected queue mgr */
MQOD ObjDesc; /* */
MQLONG OpenOpts; /* */
MQLONG CompCode; /* MQ API completion code */
MQLONG Reason; /* Reason qualifying above */
/* */
MQHOBJ hAdminQ; /* handle to output queue */
MQHOBJ hReplyQ; /* handle to input queue */
/* */
MQLONG AdminMsgLen; /* Length of user message buffer */
MQBYTE *pAdminMsg; /* Ptr to outbound data buffer */
MQCFH *pPCFHeader; /* Ptr to PCF header structure */
MQCFST *pPCFString; /* Ptr to PCF string parm block */
MQCFIN *pPCFInteger; /* Ptr to PCF integer parm block */
MQLONG *pPCFType; /* Type field of PCF message parm */
LocalQParms DefnLQ; /* */
/* */
char ErrorReport[40]; /* */
MQCHAR8 MsgFormat; /* Format of inbound message */
short Index; /* Loop counter */
/* Connect to default queue manager */
memset( QMgrName, '\0', sizeof( QMgrName ) );
MQCONN( "SAN1" /* I : use default queue manager */
, &hConn /* O : queue manager handle */
, &CompCode /* O : Completion code */
, &Reason /* O : Reason qualifying CompCode */
);
if ( CompCode != MQCC_OK ) {
printf( "MQCONN failed for %s, CC=%d RC=%d\n"
, QMgrName
, CompCode
, Reason
);
exit( -1 );
} /* endif */
/* Open all the required queues */
hAdminQ = OpenQ( hConn, "SYSTEM.ADMIN.COMMAND.QUEUE\0", MQOO_OUTPUT );
hReplyQ = OpenQ( hConn, "SAN_IN\0", MQOO_INPUT_EXCLUSIVE );
/* ****************************************************************** */
/* Put a message to the SYSTEM.ADMIN.COMMAND.QUEUE to inquire all */
/* the local queues defined on the queue manager. */
/* */
/* The request consists of a Request Header and a parameter block */
/* used to specify the generic search. The header and the parameter */
/* block follow each other in a contiguous buffer which is pointed */
/* to by the variable pAdminMsg. This entire buffer is then put to */
/* the queue. */
/* */
/* The command server, (use STRMQCSV to start it), processes the */
/* SYSTEM.ADMIN.COMMAND.QUEUE and puts a reply on the application */
/* ReplyToQ for each defined queue. */
/* ****************************************************************** */
/* Set the length for the message buffer */
AdminMsgLen = MQCFH_STRUC_LENGTH
+ MQCFST_STRUC_LENGTH_FIXED + MQ_Q_NAME_LENGTH
+ MQCFIN_STRUC_LENGTH
;
/* ----------------------------------------------------------------- */
/* Set pointers to message data buffers */
/* */
/* pAdminMsg points to the start of the message buffer */
/* */
/* pPCFHeader also points to the start of the message buffer. It is */
/* used to indicate the type of command we wish to execute and the */
/* number of parameter blocks following in the message buffer. */
/* */
/* pPCFString points into the message buffer immediately after the */
/* header and is used to map the following bytes onto a PCF string */
/* parameter block. In this case the string is used to indicate the */
/* nameof the queue we want details about, * indicating all queues. */
/* */
/* pPCFInteger points into the message buffer immediately after the */
/* string block described above. It is used to map the following */
/* bytes onto a PCF integer parameter block. This block indicates */
/* the type of queue we wish to receive details about, thereby */
/* qualifying the generic search set up by passing the previous */
/* string parameter. */
/* */
/* Note that this example is a generic search for all attributes of */
/* all local queues known to the queue manager. By using different, */
/* or more, parameter blocks in the request header it is possible */
/* to narrow the search. */
/* ----------------------------------------------------------------- */
pAdminMsg = (MQBYTE *)malloc( AdminMsgLen );
pPCFHeader = (MQCFH *)(pAdminMsg);
pPCFString = (MQCFST *)(pAdminMsg
+ MQCFH_STRUC_LENGTH
);
pPCFInteger = (MQCFIN *)( pAdminMsg
+ MQCFH_STRUC_LENGTH
+ MQCFST_STRUC_LENGTH_FIXED + MQ_Q_NAME_LENGTH
);
/* Setup request header */
pPCFHeader->Type = MQCFT_COMMAND;
pPCFHeader->StrucLength = MQCFH_STRUC_LENGTH;
pPCFHeader->Version = MQCFH_VERSION_1;
pPCFHeader->Command = MQCMD_INQUIRE_Q;
pPCFHeader->MsgSeqNumber = MQCFC_LAST;
pPCFHeader->Control = MQCFC_LAST;
pPCFHeader->ParameterCount = 2;
/* Setup parameter block */
pPCFString->Type = MQCFT_STRING;
pPCFString->StrucLength = MQCFST_STRUC_LENGTH_FIXED + MQ_Q_NAME_LENGTH;
pPCFString->Parameter = MQCA_Q_NAME;
pPCFString->CodedCharSetId = MQCCSI_DEFAULT;
pPCFString->StringLength = MQ_Q_NAME_LENGTH;
memset( pPCFString->String, ' ', MQ_Q_NAME_LENGTH );
memcpy( pPCFString->String, "*", 1 );
/* Setup parameter block */
pPCFInteger->Type = MQCFT_INTEGER;
pPCFInteger->StrucLength = MQCFIN_STRUC_LENGTH;
pPCFInteger->Parameter = MQIA_Q_TYPE;
pPCFInteger->Value = MQQT_LOCAL;
PutMsg( hConn /* Queue manager handle */
, MQFMT_ADMIN /* Format of message */
, hAdminQ /* Handle of command queue */
, "SYSTEM.ADMIN.COMMAND.QUEUE\0"
, (MQBYTE *)pAdminMsg /* Data part of message to put */
, AdminMsgLen
);
free( pAdminMsg );
/* ****************************************************************** */
/* Get and process the replies received from the command server onto */
/* the applications ReplyToQ. */
/* */
/* There will be one message per defined local queue. */
/* */
/* The last message will have the Control field of the PCF header */
/* set to MQCFC_LAST. All others will be MQCFC_NOT_LAST. */
/* */
/* An individual Reply message consists of a header followed by a */
/* number a parameters, the exact number, type and order will depend */
/* upon the type of request. */
/* */
/* ------------------------------------------------------------------ */
/* */
/* The message is retrieved into a buffer pointed to by pAdminMsg. */
/* This buffer as been allocated to be large enough to hold all the */
/* parameters for a local queue definition. */
/* */
/* pPCFHeader is then allocated to point also to the beginning of */
/* the buffer and is used to access the PCF header structure. The */
/* header contains several fields. The one we are specifically */
/* interested in is the ParameterCount. This tells us how many */
/* parameters follow the header in the message buffer. There is */
/* one parameter for each local queue attribute known by the */
/* queue manager. */
/* */
/* At this point we do not know the order or type of each parameter */
/* block in the buffer, the first MQLONG of each block defines its */
/* type; they may be parameter blocks containing either strings or */
/* integers. */
/* */
/* pPCFType is used initially to point to the first byte beyond the */
/* known parameter block. Initially then, it points to the first byte */
/* after the PCF header. Subsequently it is incremented by the length */
/* of the identified parameter block and therefore points at the */
/* next. Looking at the value of the data pointed to by pPCFType we */
/* can decide how to process the next group of bytes, either as a */
/* string, or an integer. */
/* */
/* In this way we parse the message buffer extracting the values of */
/* each of the parameters we are interested in. */
/* */
/* ****************************************************************** */
/* AdminMsgLen is to be set to the length of the expected reply */
/* message. This structure is specific to Local Queues. */
AdminMsgLen = MQCFH_STRUC_LENGTH
+ (MQCFST_STRUC_LENGTH_FIXED * 12)
+ (MQCFIN_STRUC_LENGTH * 30)
+ MQ_Q_NAME_LENGTH
+ MQ_Q_DESC_LENGTH
+ MQ_PROCESS_NAME_LENGTH
+ MQ_Q_NAME_LENGTH
+ MQ_CREATION_DATE_LENGTH
+ MQ_CREATION_TIME_LENGTH
+ MQ_Q_NAME_LENGTH
+ MQ_TRIGGER_DATA_LENGTH
+ MQ_Q_NAME_LENGTH
+ MQ_Q_NAME_LENGTH
+ MQ_Q_MGR_NAME_LENGTH
+ MQ_Q_NAME_LENGTH
;
/* Set pointers to message data buffers */
pAdminMsg = (MQBYTE *)malloc( AdminMsgLen );
do {
GetMsg( hConn /* Queue manager handle */
, MQGMO_WAIT
/* Parameters on Get */
, hReplyQ /* Get queue handle */
, "SAN_IN\0"
, (MQBYTE *)pAdminMsg /* pointer to message area */
, AdminMsgLen /* length of get buffer */
);
/* Examine Header */
pPCFHeader = (MQCFH *)pAdminMsg;
/* Examine first parameter */
pPCFType = (MQLONG *)(pAdminMsg + MQCFH_STRUC_LENGTH);
Index = 1;
while ( Index <= pPCFHeader->ParameterCount ) {
/* Establish the type of each parameter and allocate */
/* a pointer of the correct type to reference it. */
switch ( *pPCFType ) {
case MQCFT_INTEGER:
pPCFInteger = (MQCFIN *)pPCFType;
ProcessIntegerParm( pPCFInteger, &DefnLQ );
Index++;
/* Increment the pointer to the next parameter by the */
/* length of the current parm. */
pPCFType = (MQLONG *)( (MQBYTE *)pPCFType
+ pPCFInteger->StrucLength
);
break;
case MQCFT_STRING:
pPCFString = (MQCFST *)pPCFType;
ProcessStringParm( pPCFString, &DefnLQ );
Index++;
/* Increment the pointer to the next parameter by the */
/* length of the current parm. */
pPCFType = (MQLONG *)( (MQBYTE *)pPCFType
+ pPCFString->StrucLength
);
break;
} /* endswitch */
} /* endwhile */
/* ********************************************************* */
/* Message parsed, append to output file */
/* ********************************************************* */
AddToFileQLOCAL( DefnLQ );
/* ********************************************************* */
/* Finished processing the current message, do the next one. */
/* ********************************************************* */
} while ( pPCFHeader->Control == MQCFC_NOT_LAST ); /* enddo */
free( pAdminMsg );
/* *************************************** */
/* Processing of the local queues complete */
/* *************************************** */
}
void ProcessStringParm( MQCFST *pPCFString, LocalQParms *DefnLQ )
{
switch ( pPCFString->Parameter ) {
case MQCA_Q_NAME:
MQParmCpy( DefnLQ->QName, pPCFString->String, 48 );
break;
case MQCA_Q_DESC:
MQParmCpy( DefnLQ->QDesc, pPCFString->String, 64 );
break;
case MQCA_PROCESS_NAME:
MQParmCpy( DefnLQ->ProcessName, pPCFString->String, 48 );
break;
case MQCA_BACKOUT_REQ_Q_NAME:
MQParmCpy( DefnLQ->BackoutReqQName, pPCFString->String, 48 );
break;
case MQCA_CREATION_DATE:
MQParmCpy( DefnLQ->CreationDate, pPCFString->String, 12 );
break;
case MQCA_CREATION_TIME:
MQParmCpy( DefnLQ->CreationTime, pPCFString->String, 8 );
break;
case MQCA_INITIATION_Q_NAME:
MQParmCpy( DefnLQ->InitiationQName, pPCFString->String, 48 );
break;
case MQCA_TRIGGER_DATA:
MQParmCpy( DefnLQ->TriggerData, pPCFString->String, 64 );
break;
} /* endswitch */
}
void ProcessIntegerParm( MQCFIN *pPCFInteger, LocalQParms *DefnLQ )
{
switch ( pPCFInteger->Parameter ) {
case MQIA_Q_TYPE:
DefnLQ->QType = pPCFInteger->Value;
break;
case MQIA_INHIBIT_PUT:
DefnLQ->InhibitPut = pPCFInteger->Value;
break;
case MQIA_DEF_PRIORITY:
DefnLQ->DefPriority = pPCFInteger->Value;
break;
case MQIA_DEF_PERSISTENCE:
DefnLQ->DefPersistence = pPCFInteger->Value;
break;
case MQIA_INHIBIT_GET:
DefnLQ->InhibitGet = pPCFInteger->Value;
break;
case MQIA_SCOPE:
DefnLQ->Scope = pPCFInteger->Value;
break;
case MQIA_MAX_Q_DEPTH:
DefnLQ->MaxQDepth = pPCFInteger->Value;
break;
case MQIA_MAX_MSG_LENGTH:
DefnLQ->MaxMsgLength = pPCFInteger->Value;
break;
case MQIA_BACKOUT_THRESHOLD:
DefnLQ->BackoutThreshold = pPCFInteger->Value;
break;
case MQIA_SHAREABILITY:
DefnLQ->Shareability = pPCFInteger->Value;
break;
case MQIA_DEF_INPUT_OPEN_OPTION:
DefnLQ->DefInputOpenOption = pPCFInteger->Value;
break;
case MQIA_HARDEN_GET_BACKOUT:
DefnLQ->HardenGetBackout = pPCFInteger->Value;
break;
case MQIA_MSG_DELIVERY_SEQUENCE:
DefnLQ->MsgDeliverySequence = pPCFInteger->Value;
break;
case MQIA_RETENTION_INTERVAL:
DefnLQ->RetentionInterval = pPCFInteger->Value;
break;
case MQIA_DEFINITION_TYPE:
DefnLQ->DefinitionType = pPCFInteger->Value;
break;
case MQIA_USAGE:
DefnLQ->Usage = pPCFInteger->Value;
break;
case MQIA_OPEN_INPUT_COUNT:
DefnLQ->OpenInputCount = pPCFInteger->Value;
break;
case MQIA_OPEN_OUTPUT_COUNT:
DefnLQ->OpenOutputCount = pPCFInteger->Value;
break;
case MQIA_CURRENT_Q_DEPTH:
DefnLQ->CurrentQDepth = pPCFInteger->Value;
break;
case MQIA_TRIGGER_CONTROL:
DefnLQ->TriggerControl = pPCFInteger->Value;
break;
case MQIA_TRIGGER_TYPE:
DefnLQ->TriggerType = pPCFInteger->Value;
break;
case MQIA_TRIGGER_MSG_PRIORITY:
DefnLQ->TriggerMsgPriority = pPCFInteger->Value;
break;
case MQIA_TRIGGER_DEPTH:
DefnLQ->TriggerDepth = pPCFInteger->Value;
break;
case MQIA_Q_DEPTH_HIGH_LIMIT:
DefnLQ->QDepthHighLimit = pPCFInteger->Value;
break;
case MQIA_Q_DEPTH_LOW_LIMIT:
DefnLQ->QDepthLowLimit = pPCFInteger->Value;
break;
case MQIA_Q_DEPTH_MAX_EVENT:
DefnLQ->QDepthMaxEvent = pPCFInteger->Value;
break;
case MQIA_Q_DEPTH_HIGH_EVENT:
DefnLQ->QDepthHighEvent = pPCFInteger->Value;
break;
case MQIA_Q_DEPTH_LOW_EVENT:
DefnLQ->QDepthLowEvent = pPCFInteger->Value;
break;
case MQIA_Q_SERVICE_INTERVAL:
DefnLQ->QServiceInterval = pPCFInteger->Value;
break;
case MQIA_Q_SERVICE_INTERVAL_EVENT:
DefnLQ->QServiceIntervalEvent = pPCFInteger->Value;
break;
} /* endswitch */
}
/* ------------------------------------------------------------------------ */
/* */
/* This process takes the attributes of a single local queue and adds them */
/* to the end of a file, SAVEQMGR.TST, which can be found in the current */
/* directory. */
/* */
/* The file is of a format suitable for subsequent input to RUNMQSC. */
/* */
/* ------------------------------------------------------------------------ */
int AddToFileQLOCAL( LocalQParms DefnLQ )
{
char ParmBuffer[120]; /* Temporary buffer to hold for output to file */
FILE *fp; /* Pointer to a file */
/* Append these details to the end of the current SAVEQMGR.TST file */
fp = fopen( "SAVEQMGR.TST", "a" );
sprintf( ParmBuffer, "DEFINE QLOCAL ('%s') REPLACE +\n", DefnLQ.QName );
fputs( ParmBuffer, fp );
sprintf( ParmBuffer, " DESCR('%s') +\n" , DefnLQ.QDesc );
fputs( ParmBuffer, fp );
if ( DefnLQ.InhibitPut == MQQA_PUT_ALLOWED ) {
sprintf( ParmBuffer, " PUT(ENABLED) +\n" );
fputs( ParmBuffer, fp );
} else {
sprintf( ParmBuffer, " PUT(DISABLED) +\n" );
fputs( ParmBuffer, fp );
} /* endif */
sprintf( ParmBuffer, " DEFPRTY(%d) +\n", DefnLQ.DefPriority );
fputs( ParmBuffer, fp );
if ( DefnLQ.DefPersistence == MQPER_PERSISTENT ) {
sprintf( ParmBuffer, " DEFPSIST(YES) +\n" );
fputs( ParmBuffer, fp );
} else {
sprintf( ParmBuffer, " DEFPSIST(NO) +\n" );
fputs( ParmBuffer, fp );
} /* endif */
if ( DefnLQ.InhibitGet == MQQA_GET_ALLOWED ) {
sprintf( ParmBuffer, " GET(ENABLED) +\n" );
fputs( ParmBuffer, fp );
} else {
sprintf( ParmBuffer, " GET(DISABLED) +\n" );
fputs( ParmBuffer, fp );
} /* endif */
sprintf( ParmBuffer, " MAXDEPTH(%d) +\n", DefnLQ.MaxQDepth );
fputs( ParmBuffer, fp );
sprintf( ParmBuffer, " MAXMSGL(%d) +\n", DefnLQ.MaxMsgLength );
fputs( ParmBuffer, fp );
if ( DefnLQ.Shareability == MQQA_SHAREABLE ) {
sprintf( ParmBuffer, " SHARE +\n" );
fputs( ParmBuffer, fp );
} else {
sprintf( ParmBuffer, " NOSHARE +\n" );
fputs( ParmBuffer, fp );
} /* endif */
if ( DefnLQ.DefInputOpenOption == MQOO_INPUT_SHARED ) {
sprintf( ParmBuffer, " DEFSOPT(SHARED) +\n" );
fputs( ParmBuffer, fp );
} else {
sprintf( ParmBuffer, " DEFSOPT(EXCL) +\n" );
fputs( ParmBuffer, fp );
} /* endif */
if ( DefnLQ.MsgDeliverySequence == MQMDS_PRIORITY ) {
sprintf( ParmBuffer, " MSGDLVSQ(PRIORITY) +\n" );
fputs( ParmBuffer, fp );
} else {
sprintf( ParmBuffer, " MSGDLVSQ(FIFO) +\n" );
fputs( ParmBuffer, fp );
} /* endif */
if ( DefnLQ.HardenGetBackout == MQQA_BACKOUT_HARDENED ) {
sprintf( ParmBuffer, " HARDENBO +\n" );
fputs( ParmBuffer, fp );
} else {
sprintf( ParmBuffer, " NOHARDENBO +\n" );
fputs( ParmBuffer, fp );
} /* endif */
if ( DefnLQ.Usage == MQUS_NORMAL ) {
sprintf( ParmBuffer, " USAGE(NORMAL) +\n" );
fputs( ParmBuffer, fp );
} else {
sprintf( ParmBuffer, " USAGE(XMIT) +\n" );
fputs( ParmBuffer, fp );
} /* endif */
if ( DefnLQ.TriggerControl == MQTC_OFF ) {
sprintf( ParmBuffer, " NOTRIGGER +\n" );
fputs( ParmBuffer, fp );
} else {
sprintf( ParmBuffer, " TRIGGER +\n" );
fputs( ParmBuffer, fp );
} /* endif */
switch ( DefnLQ.TriggerType ) {
case MQTT_NONE:
sprintf( ParmBuffer, " TRIGTYPE(NONE) +\n" );
fputs( ParmBuffer, fp );
break;
case MQTT_FIRST:
sprintf( ParmBuffer, " TRIGTYPE(FIRST) +\n" );
fputs( ParmBuffer, fp );
break;
case MQTT_EVERY:
sprintf( ParmBuffer, " TRIGTYPE(EVERY) +\n" );
fputs( ParmBuffer, fp );
break;
case MQTT_DEPTH:
sprintf( ParmBuffer, " TRIGTYPE(DEPTH) +\n" );
fputs( ParmBuffer, fp );
break;
} /* endswitch */
sprintf( ParmBuffer, " TRIGDPTH(%d) +\n", DefnLQ.TriggerDepth );
fputs( ParmBuffer, fp );
sprintf( ParmBuffer, " TRIGMPRI(%d) +\n", DefnLQ.TriggerMsgPriority);
fputs( ParmBuffer, fp );
sprintf( ParmBuffer, " TRIGDATA('%s') +\n", DefnLQ.TriggerData );
fputs( ParmBuffer, fp );
sprintf( ParmBuffer, " PROCESS('%s') +\n", DefnLQ.ProcessName );
fputs( ParmBuffer, fp );
sprintf( ParmBuffer, " INITQ('%s') +\n", DefnLQ.InitiationQName );
fputs( ParmBuffer, fp );
sprintf( ParmBuffer, " RETINTVL(%d) +\n", DefnLQ.RetentionInterval );
fputs( ParmBuffer, fp );
sprintf( ParmBuffer, " BOTHRESH(%d) +\n", DefnLQ.BackoutThreshold );
fputs( ParmBuffer, fp );
sprintf( ParmBuffer, " BOQNAME('%s') +\n", DefnLQ.BackoutReqQName );
fputs( ParmBuffer, fp );
if ( DefnLQ.Scope == MQSCO_Q_MGR ) {
sprintf( ParmBuffer, " SCOPE(QMGR) +\n" );
fputs( ParmBuffer, fp );
} else {
sprintf( ParmBuffer, " SCOPE(CELL) +\n" );
fputs( ParmBuffer, fp );
} /* endif */
sprintf( ParmBuffer, " QDEPTHHI(%d) +\n", DefnLQ.QDepthHighLimit );
fputs( ParmBuffer, fp );
sprintf( ParmBuffer, " QDEPTHLO(%d) +\n", DefnLQ.QDepthLowLimit );
fputs( ParmBuffer, fp );
if ( DefnLQ.QDepthMaxEvent == MQEVR_ENABLED ) {
sprintf( ParmBuffer, " QDPMAXEV(ENABLED) +\n" );
fputs( ParmBuffer, fp );
} else {
sprintf( ParmBuffer, " QDPMAXEV(DISABLED) +\n" );
fputs( ParmBuffer, fp );
} /* endif */
if ( DefnLQ.QDepthHighEvent == MQEVR_ENABLED ) {
sprintf( ParmBuffer, " QDPHIEV(ENABLED) +\n" );
fputs( ParmBuffer, fp );
} else {
sprintf( ParmBuffer, " QDPHIEV(DISABLED) +\n" );
fputs( ParmBuffer, fp );
} /* endif */
if ( DefnLQ.QDepthLowEvent == MQEVR_ENABLED ) {
sprintf( ParmBuffer, " QDPLOEV(ENABLED) +\n" );
fputs( ParmBuffer, fp );
} else {
sprintf( ParmBuffer, " QDPLOEV(DISABLED) +\n" );
fputs( ParmBuffer, fp );
} /* endif */
sprintf( ParmBuffer, " QSVCINT(%d) +\n", DefnLQ.QServiceInterval );
fputs( ParmBuffer, fp );
switch ( DefnLQ.QServiceIntervalEvent ) {
case MQQSIE_OK:
sprintf( ParmBuffer, " QSVCIEV(OK)\n" );
fputs( ParmBuffer, fp );
break;
case MQQSIE_NONE:
sprintf( ParmBuffer, " QSVCIEV(NONE)\n" );
fputs( ParmBuffer, fp );
break;
case MQQSIE_HIGH:
sprintf( ParmBuffer, " QSVCIEV(HIGH)\n" );
fputs( ParmBuffer, fp );
break;
} /* endswitch */
sprintf( ParmBuffer, "\n" );
fputs( ParmBuffer, fp );
fclose(fp);
return(0);
}
/* ------------------------------------------------------------------------ */
/* */
/* The queue manager returns strings of the maximum length for each */
/* specific parameter, padded with blanks. */
/* */
/* We are interested in only the nonblank characters so will extract them */
/* from the message buffer, and terminate the string with a null, \0. */
/* */
/* ------------------------------------------------------------------------ */
void MQParmCpy( char *target, char *source, int length )
{
int counter=0;
while ( counter < length && source[counter] != ' ' ) {
target[counter] = source[counter];
counter++;
} /* endwhile */
if ( counter < length) {
target[counter] = '\0';
} /* endif */
} _________________ Sanjoo
Keep smiling
 |
|
Back to top |
|
 |
mqmhr |
Posted: Thu Jan 12, 2006 1:34 am Post subject: |
|
|
Centurion
Joined: 28 Dec 2004 Posts: 105
|
Did you try specifying the message type as MQMT_REQUEST? |
|
Back to top |
|
 |
sanjoo |
Posted: Thu Jan 12, 2006 2:06 am Post subject: |
|
|
 Acolyte
Joined: 26 Oct 2005 Posts: 65
|
Thanks for that.
That worked and even I got the reply back on ReplyToQ but that is not correct one. I am using md.Format ="MQSTR " . Is this correct?
Sorry for real newbie questions. _________________ Sanjoo
Keep smiling
 |
|
Back to top |
|
 |
mqmhr |
Posted: Thu Jan 12, 2006 2:19 am Post subject: |
|
|
Centurion
Joined: 28 Dec 2004 Posts: 105
|
It is quite clearly documented in the Guide that the format for the PCF request needs to be MQFMT_ADMIN.
Following that document is likely to help you solve the problem quicker than waiting for replies from the forum. |
|
Back to top |
|
 |
wschutz |
Posted: Thu Jan 12, 2006 2:34 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Are you really trying to re-create saveqmgr, or are you just using it as an example? _________________ -wayne |
|
Back to top |
|
 |
sanjoo |
Posted: Thu Jan 12, 2006 2:45 am Post subject: |
|
|
 Acolyte
Joined: 26 Oct 2005 Posts: 65
|
I am using this just an example and then would like to think on how PCF can be used to administor our setup.
I even tried with mqmd.format=MQFMT_ADMIN while getting the message but from explorer I can see some unreadable data with MQADMIN format and SAVEQMGR.TST looks like this ---
DEFINE QLOCAL ('ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ') REPLACE +
DESCR('ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ') REPLACE +
') +
PUT(DISABLED) +
DEFPRTY(-858993460) +
DEFPSIST(NO) +
GET(DISABLED) +
MAXDEPTH(690474188) +
MAXMSGL(1346720288) +
NOSHARE +
DEFSOPT(EXCL) +
MSGDLVSQ(FIFO) +
NOHARDENBO +
USAGE(XMIT) +
TRIGGER +
TRIGDPTH(-859045878) +
TRIGMPRI(723535171) +
TRIGDATA('ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ') +
PROCESS('ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ') REPLACE +
') +
') +
INITQ('ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ') REPLACE +
') +
RETINTVL(-858993460) +
BOTHRESH(1162035532) +
BOQNAME(' +
') +
') +
SCOPE(CELL) +
QDEPTHHI(-858993460) +
QDEPTHLO(-858993460) +
QDPMAXEV(DISABLED) +
QDPHIEV(DISABLED) +
QDPLOEV(DISABLED) +
QSVCINT(-858993460) +
****
To me it seems to be a Format option issue... not sure. _________________ Sanjoo
Keep smiling
 |
|
Back to top |
|
 |
wschutz |
Posted: Thu Jan 12, 2006 3:28 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
That sample was used as the genisis of supportpac MS03 (saveqmgr). You might want to download that and see how it works, as I'm told its widely used ...  _________________ -wayne |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|