/* sample routine to copy the queue into a compound variable */ "@dir | rxqueue" call CopyQueueIntoStem "filesFound" say filesFound.0 || " entries found." do i = 1 to filesFound.0 say i || "-> " || filesFound.i end /* do i = 1 to filesFound.0 */ exit 0 /* ------------------------------------------------------------------ */ /* function: Save all entries from within the queue into a compound */ /* variable */ /* */ /* call: CopyQueueIntoStem stem */ /* */ /* where: stem - stem of the compound variable for the lines from */ /* the queue */ /* */ /* returns: no. of entries read */ /* */ CopyQueueIntoStem: parse arg rqis.__stemName /* set the return code */ rc = 0 if rqis.__stemName <> "" then do if right( rqis.__stemName,1 ) <> "." then rqis.__StemName = rqis.__StemName || "." if symbol( rqis.__StemName || "0" ) <> "VAR" then do /* the compound variable is not used at this */ /* time -- init the number of stem elements */ /* with 0 */ rqis.__iLine = rqis.__StemName || "0 = 0 " interpret rqis.__iLine rqis.__InitNo = 0 end /* if */ else do /* compound variable is already in use */ rqis.__InitNo = value( rqis.__StemName || "0" ) end /* else */ if queued() <> 0 then do rqis.__iLine = "i = " rqis.__StemName || "0" interpret rqis.__iLine /* create the code to read the queue */ rqis.__iLine = , "do until queued() = 0; " , " rqis.__qLine = strip( lineIn( ""QUEUE:"" ) ); " , " if rqis.__qLine <> """" then " , " do; " , " i = i +1; " , rqis.__StemName || "i = rqis.__qLine; " , " end; " , "end;" /* and now execute the code to read the queue */ interpret rqis.__iLine /* correct the no. of lines in stem.0 */ rqis.__iLine = rqis.__StemName || "0 = i " interpret rqis.__iLine /* set the return code */ rc = i - rqis.__InitNo end /* if stream( ... */ end /* if rqis.__stemName <> "" then */ do while queued() <> 0 rqis.__dummyLine = lineIN( "QUEUE:" ) end /* do while */ drop rqis. RETURN rc