Hooking into the Global template
  


You can add to the "lists of queues" with calls to template-generated procedures but should be careful to avoid leaving an invalid queue reference in one of the lists. The template helps out here by providing procedures to remove queues but in the case of the 'global list' you must definitely match up all 'adds' with a 'remove' before a queue is destroyed.

So, most sensitive is the template generated 'list of global queues'. Populated at start-up with any queues it manages to find, here is it's declaration:

QVEQ::GLOBALQ       QUEUE,PRE(QEGQ)
QUEUENAME               STRING(80)
RECORDS                 LONG
STATEMENT               STRING(80)
QUEUEREF                &QUEUE
                    END

Add a queue by calling:

QViewAddGlobalQ(*QUEUE TheQueue,<STRING TheQueueName>,<STRING TheStatement>)

Remove a queue by calling:

QViewKillGlobalQ(*QUEUE TheQueue)


At the (window) procedure level three queues are declared and populated at start-up:

QVEQ:MODULEQ       QUEUE(QVEQ::MODULEQ)
                   END
QVEQ:LOCALQ        QUEUE(QVEQ::LOCALQ)
                   END
QVEQ:CONTROLQ      QUEUE(QVEQ::CONTROLQ)
                   END
Here are the types:

QVEQ::MODULEQ       QUEUE,TYPE
QUEUENAME               STRING(80)
RECORDS                 LONG
STATEMENT               STRING(80)
QUEUEREF                &QUEUE
                    END

QVEQ::LOCALQ        QUEUE,TYPE
QUEUENAME               STRING(80)
RECORDS                 LONG
STATEMENT               STRING(80)
DESCRIPTION             STRING(80)
QUEUEREF                &QUEUE
                    END

QVEQ::CONTROLQ      QUEUE,TYPE
CONTROL                 STRING(80)
QUEUENAME               STRING(80)
RECORDS                 LONG
TYPE                    STRING(80)
QUEUEREF                &QUEUE
                    END

These lists are much less sensitive, you are unlikely to cause a problem by adding a queue to these lists UNLESS it is subsequently destroyed and you call up the "show me my queues" window. Probably best to avoid the module and control lists (although procedures to add / remove queues are generated - search them out in the template or generated code if you find a need for them). Stick with QVEQ::LOCALQ if there's a local queue you want to take a look at. Given a queue declaration:

MyQueue   QUEUE,PRE(MQ)
Something   STRING(50)
          END

Add the queue by calling:

QViewAddQ(*QVEQ::LOCALQ TheQViewQ ,*QUEUE TheQueue ,<STRING TheQueueName> ,<STRING TheStatement>)

Sample code:

QViewAddQ(QVEQ:LOCALQ,MyQueue,'My Queue Name but optional','My Queue Statement but very optional')

And if you have manually added a queue that you are going to destroy - match the QViewAddQ() call with:

QViewKillQ(QVEQ:LOCALQ,MyQueue)