Flushing a queue

[Autolink] Menu

Some user (including myself in one of the last versions of RXT&T) say that using rxqueue /CLEAR to flush the REXX queue is significantly faster than flushing the queue with LINEIN or PULL if there are a lot of entries in the queue.

Well, I've done some tests and in my tests, the PULL statement was always faster. But you may use the code below to test this behaviour on your PC.

 
/* program to test the speed of flushing the REXX queue               */

                        /* init the variables                         */
  queueThreshold = 1000
  queueLines = 1000
  queueLineLength = 100

  do forever

    call LineOut , "Enter EXIT on any question to exit the program"

    call CharOut , "  Enter the queue threshold ("""" for " || ,
                   queueThreshold || "): "
    userInput = translate( lineIn() )
    if userInput = "EXIT" then
      exit
    if userInput <> "" then
      queueThreshold = userInput

    call CharOut , "  Enter the no. of lines for the queue ("""" for " || ,
                   queueLines || "): "
    userInput = translate( lineIn() )
    if userInput = "EXIT" then
      exit
    if userInput <> "" then
      queueLines = userInput

    call CharOut , "  Enter the length for the lines in the queue " || ,
                   "("""" for " || queueLineLength || "): "
    userInput = translate( lineIn() )
    if userInput = "EXIT" then
      exit
    if userInput <> "" then
      queueLineLength = userInput

                        /* fill the queue                             */
    call CharOut , "  Now filling the queue with " || queueLines || ,
                   " lines with " || queueLineLength || " characters  ..."

    do i = 1 to queueLines
      push copies( "X", queueLineLength )
    end /* do i = 1 to queueLines */
    call LineOut , " done."
    call LineOut , "  There are now " || queued() || " lines in the queue."

    call CharOut , "  Now flushing the queue ..."
    call time "R"
    call FlushQueue
    call LineOut , " done. Time used: " || time("E")
  end /* do forever */

exit

/* ------------------------------------------------------------------ */
/* function: flush the default REXX queue                             */
/*                                                                    */
/* call:     FlushQueue                                               */
/*                                                                    */
/* returns:  nothing                                                  */
/*                                                                    */
/*                                                                    */
FlushQueue:
  queueCount = queued()
  if queueCount >= queueThreshold then
  do
    call LineOut , "  Using rxqueue ..."
    ADDRESS "CMD" "RXQUEUE /CLEAR"
  end /* if */
  else
  do
    call LineOut , "  Using parse pull ..."
    do i = 1 to queueCount
      parse pull
    end /* do i = 1 to queueCount */
  end /* else */
return


[Back: Check if a queue exists]
[Next: Queues versus files]