Defining variables
/* allocate storage for the message buffer. Note that the RECEIVE */ /* vector structure includes space for the standard vector header. */ MsgBuffer = malloc(sizeof(MQCIH) + sizeof(brrcv) + strlen(CMDSTRING) ) ; ⋮
Set up the MQMD
memcpy(mqmd.Format, MQFMT_CICS,sizeof((MQFMT_CICS)); memcpy(mqmd.MsgId, MQMI_NONE, sizeof(MQMI_NONE)); memcpy(mqmd.CorrelId, MQCI_NEW_SESSION, sizeof((MQCI_NEW_SESSION); mqmd.MsgType = MQMT_REQUEST; strncpy(mqmd.ReplyToQueue,"MyReplyQueue");
Set up the MQCIH
mqcih.LinkType = MQCLT_TRANSACTION ; mqcih.GetWaitInterval= 1000 ; /* one second */ mqcih.FacilityKeepTime = 10000 ; /* |= 0 says return token */ memcpy(mqcih.Facility,MQCFAC_NONE,sizeof(MQCFAC_NONE)); strncpy(mqcih.TransactionId, "CEMT", strlen("CEMT")); strncpy(mqcih.FacilityLike, " ", strlen(" ")); mqcih.UOWControl = MQCUOWC_FIRST; memcpy(mqcih.AttentionId,AID,sizeof(mqcih.AttentionId); /* enter pressed */
Set up the BRMQ
brvh.brmq_vector_length = sizeof(brrcv) + strlen(CMDSTRING) ; strncpy(brvh.brmq_vector_descriptor, RCV_VECTOR, strlen(RCV_VECTOR)) ; strncpy(brvh.brmq_vector_type, INBOUND, strlen(INBOUND)) ; strncpy(brvh.brmq_vector_version, VERSION, strlen(VERSION)) ; /* Initialize fields in the RECEIVE vector structure: */ strncpy(brrcv.brmq_re_transmit_send_areas, YES, strlen(YES)) ; strncpy(brrcv.brmq_re_buffer_indicator, NO, strlen(NO)) ; strncpy(brrcv.brmq_re_aid, AID, sizeof(brrcv.brmq_re_aid)) ; brrcv.brmq_re_data_len =strlen(CMDSTRING) ;
Building the message
/* Copy the MQCIH to the start of the message buffer */ memcpy(MsgBuffer, &mqcih, sizeof(MQCIH)) ; /* Append the RECEIVE vector to the CIH */ memcpy(MsgBuffer + sizeof(MQCIH), brrcv, sizeof(brrcv) ) ; /* Overlay the standard vector header on the RECEIVE vector */ memcpy(MsgBuffer + sizeof(MQCIH), brvh, sizeof(brvh) ) ; /* Append the command string to the vector structure */ strncpy(MsgBuffer + sizeof(MQCIH) + sizeof(brrcv), CMDSTRING, strlen(CMDSTRING)) ; /* the message is now ready for the MQPUT with length of sizeof(MQCIH) + sizeof(brrcv)+ strlen(CMDSTRING);
Parent topic:
Example: Invoking CEMT I TASK from an application
fg15590_