$BASICTYPE "U" PROGRAM OPER.STATS.ACTIVITY * PROPERTY OF BRANT PUTTKAMMER, PLEASE CONTACT ME IF YOU HAVE QUESTIONS * PLEASE USE CAUTION WHEN RUNNING THIS PROGRAM ON YOUR SYSTEM * brant 02/04/2016 - search OPER.STATS to get data over time range * based on date range, output results to csv report for graphing... ********************************************************************* TOTRECORDS=0 DAILYTOTRECORDS=0 NOW=TIME() DATE=DATE() STARTDATE=DATE-30 ORIGSTARTDATE=STARTDATE ENDDATE=DATE-1 REPORTTIME=TIMEDATE() FMON=OCONV(DATE(),'DM') FDAY=OCONV(DATE(),'DD') FYEAR=OCONV(DATE(),'DY') TRIMNOW=SUBSTRINGS(NOW,1,4) ERRORDETAIL="" COMPLETE='THE OPER.STATS FILE HAS BEEN SEARCHED FOR YOUR DATE RANGE,' COMPLETE=COMPLETE:CHAR(10):'YOUR REPORT IS IN THE HOLD DIRECTORY...' OPENSEQ '_HOLD_','1_OPER.STATS.ALL.ACTIVITY.':FMON:FDAY:'_':TRIMNOW TO REPORTNAME1 ELSE NULL PCPERFORM " cat /dev/null > SAVEDLISTS/OPERSTATS000 " DATAOUTPUT1="OPERATOR-DATE,OPERATOR-NAME,OPERATOR-BRANCH,TOTAL-COUNT" ********************************************************************* PRINT "START TIME ":OCONV(TIME(),"MTH") BEGTIME=OCONV(TIME(),"MTH") GOSUB WRITELINE1 ** TOTRECORDS=0 OPEN '',"OPER.STATS" READONLY TO OPER.STATS ELSE GOSUB ERROROUT EXECUTE "SELECT OPER.STATS WITH OPER_STATS_DATE GE '":STARTDATE:"' AND WITH OPER_STATS_DATE LE '":ENDDATE:"'" NEXTOPERSTATS:READNEXT OPERSTATSID ELSE GO DONE READ OPERSTATSREC FROM OPER.STATS,OPERSTATSID ELSE GO NEXTOPERSTATS OPSTAT_DATE=FIELD(OPERSTATSID,'*',1) OPSTAT_BRANCH=OPERSTATSREC<1,1> OPSTAT_NAME=OPERSTATSREC<2,1> OPSTAT_TOTAL_COUNT=OPERSTATSREC<18,1> TOTRECORDS=TOTRECORDS+1 DATAOUTPUT1="":OCONV(OPSTAT_DATE,"D4/"):",":OPSTAT_NAME:",":OPSTAT_BRANCH:",":OPSTAT_TOTAL_COUNT:"" GOSUB WRITELINE1 GO NEXTOPERSTATS ** CLOSE OPER.STATS ********************************************************************* ERROROUT: PRINT "CAN NOT OPEN OPER.STATS!" GO DONE ********************************************************************* WRITELINE1: WRITESEQ DATAOUTPUT1 APPEND TO REPORTNAME1 ELSE NULL RETURN ********************************************************************* DONE: PRINT PRINT "YOUR PROGRAM BEGAN AT ":BEGTIME PRINT "END TIME ":OCONV(TIME(),"MTH") PRINT "THERE WERE ":TOTRECORDS:" RECORDS FOUND WITHIN YOUR DATE RANGE OF ":OCONV(STARTDATE,"D4/"):" - ":OCONV(ENDDATE,"D4/"):"" PRINT CLOSESEQ REPORTNAME1 PRINT COMPLETE STOP END