C example: Creating a dynamic queue
This example demonstrates how to use the MQOPEN call to create a dynamic queue.
This extract is taken from the Mail Manager sample application.
For IBM® MQ for z/OS® this is program CSQ4TCD1.
For the names and locations of the sample applications, see the following topics:
⋮
MQLONG HCONN = 0; /* Connection handle */
MQHOBJ HOBJ; /* MailQ Object handle */
MQHOBJ HobjTempQ; /* TempQ Object Handle */
MQLONG CompCode; /* Completion code */
MQLONG Reason; /* Qualifying reason */
MQOD ObjDesc = {MQOD_DEFAULT};
/* Object descriptor */
MQLONG OpenOptions; /* Options control MQOPEN */
/*----------------------------------------- */
/* Initialize the Object Descriptor (MQOD) */
/* control block. (The remaining fields */
/* are already initialized.) */
/*------------------------------------------*/
strncpy( ObjDesc.ObjectName,
SYSTEM_REPLY_MODEL,
MQ_Q_NAME_LENGTH );
strncpy( ObjDesc.DynamicQName,
SYSTEM_REPLY_INITIAL,
MQ_Q_NAME_LENGTH );
OpenOptions = MQOO_INPUT_AS_Q_DEF;
/*------------------------------------------*/
/* Open the model queue and, therefore, */
/* create and open a temporary dynamic */
/* queue */
/*------------------------------------------*/
MQOPEN( HCONN,
&ObjDesc,
OpenOptions,
&HobjTempQ,
&CompCode,
&Reason );
if ( CompCode == MQCC_OK ) {
}
else {
/*---------------------------------------*/
/* Build an error message to report the */
/* failure of the opening of the model */
/* queue */
/*---------------------------------------*/
MQMErrorHandling( "OPEN TEMPQ", CompCode,
Reason );
ErrorFound = TRUE;
}
return ErrorFound;
}
⋮
![[UNIX, Linux, Windows, IBM i]](../common/../develop/ngmulti.gif)
![[z/OS]](../common/../develop/ngzos.gif)