Интеграция приложений на основе WebSphere MQ


Example.9.3


/* Листинг программы distlist */

/* Program name: Distlist */

/* Description: Distlist C program pass messages to output queues */

/* by Distribution list for indicated Queue Manager */

/* distlist.ini file give list of queue and distlist.dat give file */

/* of message which copied to the output queue */

#include

#include

#include

#include

#include

#include

char queue[1000][48] ;

char buf[48];

int queuenamelen;

time_t tmr;

FILE * fp;

FILE *fptr;

static void print_usage(void);

static void print_responses( char * comment, PMQRR pRR, MQLONG NumQueues, PMQOR pOR);

int main(int argc, char **argv)

{

typedef enum {False, True} Bool;

MQOD od = {MQOD_DEFAULT}; /* Object Descriptor */

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

MQPMO pmo = {MQPMO_DEFAULT}; /* put message options */

MQHCONN Hcon; /* connection handle */

MQHOBJ Hobj; /* object handle */

MQLONG O_options; /* MQOPEN options */

MQLONG C_options; /* MQCLOSE options */

MQLONG CompCode; /* completion code */

MQLONG OpenCode; /* MQOPEN completion code */

MQLONG Reason; /* reason code */

MQCHAR48 QManager; /* queue manager name */

MQLONG buflen; /* buffer length */

char buffer[101]; /* message buffer */

MQLONG Index ; /* Index into list of queues */

MQLONG NumQueues ; /* Number of queues */

PMQRR pRR=NULL; /* Pointer to response records */

PMQOR pOR=NULL; /* Pointer to object records */

Bool DisconnectRequired=False;/* Already connected switch */

Bool Connected=False; /* Connect succeeded switch */

typedef struct

{

MQBYTE24 MsgId;

MQBYTE24 CorrelId;

} PutMsgRec, *pPutMsgRec;

pPutMsgRec pPMR=NULL; /* Pointer to put msg records */

MQLONG PutMsgRecFields=MQPMRF_MSG_ID | MQPMRF_CORREL_ID;

/* Open ini file and setting value */

if ( (fptr=fopen ("distlist.ini","r" )) == NULL )

{printf("Cannot open distlist.ini file" );

print_usage();

exit(1); }

else{

fgets(QManager, 48, fptr);

queuenamelen = strlen(QManager) - 1;

QManager[queuenamelen] = ' ';




Начало  Назад  Вперед



Книжный магазин