>DO WHILE .T. && always run > DOEVENTS && allow person to shut down report server > =Sleep(500) && sleep for .5 of a second to allow server CPU to server other requests > DOEVENTS && allow person to shut down report server > > * checks queue for new items added > * go to next request in queue that hasn't be started > SELECT reportq > SET ORDER TO id > > * force use to see new records by locking and unlocking > IF RLOCK('0', 'reportq') then > UNLOCK RECORD 0 in reportq > ENDIF > > LOCATE FOR reportq.started = {} > IF FOUND() = .T. && pending reports > * execute report > oRep = CREATEOBJECT("reportmaker") > ? TTOC(DATETIME()) + ": " + reportq.repcomm > REPLACE reportq.started WITH DATETIME() > lcCommand = reportq.repcomm > lcXML1 = reportq.xml1 > lcXML2 = reportq.xml2 > lcResult = &lcCommand > RELEASE oRep > * upon completion writes report path and file name or message to queue > SELECT reportq > REPLACE reportq.result WITH lcResult > REPLACE reportq.finished WITH DATETIME() > ? TTOC(DATETIME()) + ": " + reportq.result > RELEASE oRep > lcResult = "" && blank out for next time > lcCommand = "" && blank out for next time > lcXML1 = "" > lcXML2 = "" > ENDIF >ENDDO > >Have you included memory management via SYS(3050) / SYS(1104)? Might you have a memory leak that's only manifesting itself after a very long period of time?