Product Site

14.1.3.2. Named Queues

Your program creates (and deletes) named queues. You can name the queue yourself or leave the naming to the language processor. Your program must know the name of the queue to use a named queue. To obtain the name of the queue, use the RXQUEUE function:
previous_queue=rxqueue("set",newqueuename)

This sets the new queue name and returns the name of the previous queue.

The following Rexx instructions manipulate the queue:

Rexx functions that manipulate QUEUE: as a device name are:

Here is an example of using a queue:
Example 14.3. Sample Rexx Procedure Using a Queue
/*                                                                            */
/* push/pull WITHOUT multiprogramming support                                 */
/*                                                                            */
push date() time()                                /* push date and time       */
do 1000                                           /* let's pass some time     */
  nop                                             /* doing nothing            */
end                                               /* end of loop              */
pull a b                                          /* pull them                */
say "Pushed at " a b ", Pulled at " date() time() /* say now and then         */

/*                                                                            */
/*              push/pull WITH multiprogramming support                       */
/*        (no error recovery, or unsupported environment tests)               */
/*                                                                            */
newq = RXQUEUE("Create")                          /* create a unique queue    */
oq = RXQUEUE("Set",newq)                          /* establish new queue      */
push date() time()                                /* push date and time       */
do 1000                                           /* let's spend some time    */
  nop                                             /* doing nothing            */
end                                               /* end of loop              */
pull a b                                          /* get pushed information   */
say "Pushed at " a b ", Pulled at " date() time() /* tell user                */
call RXQUEUE "Delete",newq                   /* destroy unique queue created  */
call RXQUEUE "Set",oq               /* reset to default queue (not required)  */

Special considerations: