Create 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 (program CSQ4TCD1) supplied with IBM MQ for z/OS . For the names and locations of the sample applications on other platforms, see Sample procedural programs (platforms except z/OS ).
â‹® 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; } â‹®Parent topic: C language examples