Create and bind a table

Use the MQCreateVtiReceive() function to create a table and bind it to a queue.

The following example creates a table named vtimq, and binds it to the queue defined by service IDS.DEFAULT.SERVICE and policy IDS.DEFAULT.POLICY.
BEGIN WORK;

EXECUTE FUNCTION MQICreateVtiReceive ("VtiMQ", 
                "IDS.DEFAULT.SERVICE",  "IDS.DEFAULT.POLICY");

Using a SELECT statement on a table created with MQCreateVtiReceive(), results in a message is received from the table, which is the equivalent of calling the MQReceive() function on the queue. For both functions, the messages selected are removed from the queue.

To browse the messages on the queue without removing the messages from the queue, use the MQCreateVtiRead() function. In the following example, MQCreateVtiRead() binds the table vtimq to a queue:
BEGIN WORK;

EXECUTE FUNCTION MQCreateVtiRead (vtimq, read-service, policy, maxMessage)

For complete information about the MQCreateVtiRead() or MQCreateVtiReceive() functions, see MQ messaging functions.