PillarSoft

http://www.pillarsoft.net/os-2-software/rexx/manipulate-two-queues-beginning-and-intermediate-l.shtml

Manipulate two queues (Beginning and Intermediate level)

Contributed by: Doug Rickman, Global Hydrology and Climate Center, MSFC, NASA

This is aimed at beginning and intermediate REXX users.


 


/*****************************************************************************/
/**************************** Queue Control **********************************/

/* Create a named queue, make it active,flush it, then fill it with the  */
/* directory list.                                                       */
rc=rxqueue('CREATE','DIRLISTQ')
rc=rxqueue('SET','DIRLISTQ')
do while queued()<>0
   pull afile
   end
'@echo off'
'dir /f 'search||'*.met | rxqueue 'DIRLISTQ        /* NOTE USE OF FILTER */

/* create a second named queue to hold the unsorted list                 */
rc=rxqueue('CREATE','LISTQ')

/* read the directory list and open each file, extra specified data      */
/* store raw result in the queue LISTQ                                   */
do while queued()<>0                /* the active list is still DIRLISTQ */
   pull afile
   i=i+1
    /* do something with the information "afile" and output to DataOut.i */
   ...
  DataOut.i=stuff

/* change the active queue and put DataOut.i into ListQ then reset queue */
   trash=rxqueue('SET','LISTQ')
   queue DataOut.i
   trash=rxqueue('SET','DIRLISTQ')
end /* do while queued <> 0 */

/* now look into LISTQ and get the information stored there              */
rc=rxqueue('SET','LISTQ')
do while queued()<>0
   pull stuff
   say stuff
   end

/* to read data from the queue without changing case do   ....           */
   Data=linein("QUEUE:")