$BASICTYPE "U" PROGRAM MEMO.NO.EXPIRE * PROPERTY OF BRANT PUTTKAMMER, PLEASE CONTACT ME IF YOU HAVE QUESTIONS * PLEASE USE CAUTION WHEN RUNNING THIS PROGRAM ON YOUR SYSTEM * brant 12/08/2015 - search MEMO for diary memos without an expiration date, * output results to report for cleanup... ********************************************************************* TOTRECORDS=0 TOTERRORS=0 NOW=TIME() DATE=DATE() STARTDATE=1 REPORTTIME=TIMEDATE() FMON=OCONV(DATE(),'DM') FDAY=OCONV(DATE(),'DD') FYEAR=OCONV(DATE(),'DY') TRIMNOW=SUBSTRINGS(NOW,1,4) COMPLETE='THE MEMO FILE HAS BEEN SEARCHED FOR MISSING EXPIRATION DATES,' COMPLETE=COMPLETE:CHAR(10):'YOUR REPORT IS IN THE HOLD DIRECTORY...' OPEN '','MEMO' READONLY TO MEMO ELSE GO DONE OPENSEQ '_HOLD_','1_DIARY.MEMOS.NO.EXPIRATION.':FMON:FDAY:'_':TRIMNOW TO REPORTNAME ELSE NULL PCPERFORM " cat /dev/null > SAVEDLISTS/BADMEMOLIST000 " DATAOUTPUT="MEMBER-NUMBER,ERROR-DETAIL,MEMO-DATE,MEMO-USER" ********************************************************************* PRINT "START TIME ":OCONV(TIME(),"MTH") *EXECUTE 'SELECT MEMO WITH @ID LIKE "281..." SAMPLE 50' EXECUTE 'SELECT MEMO' GOSUB WRITELINE NEXTMEMID:READNEXT MEMID ELSE GO DONE READ MEMREC FROM MEMO,MEMID ELSE GO NEXTMEMID TOTRECORDS=TOTRECORDS+1 ** EXPIRECOUNT=DCOUNT(MEMREC<1>,@VM) FOR J=1 TO EXPIRECOUNT MEMODATE = MEMREC<1,J> MEMODATEDISP = OCONV(MEMODATE,"D4/") MEMOUSER = MEMREC<5,J> MEMODETAIL = TRIMS(MEMREC<8,J>) EXPIREDATE = MEMREC<9,J> EXPIREDATEDISP = OCONV(EXPIREDATE,"D4/") * STARTDATE GIVES CU A WAY TO LIMIT WHAT MEMOS ARE REPORTED IF EXPIREDATE = "" AND MEMODATE > STARTDATE THEN TOTERRORS=TOTERRORS+1 ERRORDETAIL = "NO-DIARY-MEMO-EXPIRATION-DATE" * SEND MEMBER NUMBER TO SAVEDLIST PCPERFORM " echo ":MEMID:" >> SAVEDLISTS/BADMEMOLIST000 " * DATAOUTPUT="MEMBER-NUMBER=[":MEMID:"] ERRORDETAIL=[":ERRORDETAIL:"] MEMODATEDISP=[":MEMODATEDISP:"] MEMOUSER=[":MEMOUSER:"] MEMODETAIL=[":MEMODETAIL:"]" DATAOUTPUT="":MEMID:",":ERRORDETAIL:",":MEMODATEDISP:",":MEMOUSER:"" * WRITESEQ DATAOUTPUT APPEND TO REPORTNAME ELSE NULL GOSUB WRITELINE GO NEXTJ END GO NEXTJ NEXTJ: NEXT J ** *IF MOD(TOTRECORDS,1000) = 0 THEN * PRINT "CURRENTLY PROCESSING MEMO RECORD #":TOTRECORDS:"..." *END GO NEXTMEMID ********************************************************************* GETLISTREPORT: EXECUTE 'SP.ASSIGN HS!MISSING.DATES.DIARY.MEMOS' EXECUTE 'GET-LIST BADMEMOLIST' CMD = \SORT MEMO BY MEMO_OP MEMBER_NO MEMO_DATE MEMO_OPNAME HEADING "'C'**ROUTE THIS REPORT TO SUPERVISOR** - MISSING EXPIRATION DATES FOR DIARY MEMOS OF 'TLL'" REQUIRE.SELECT LPTR\ EXECUTE CMD RETURN ********************************************************************* WRITELINE: WRITESEQ DATAOUTPUT APPEND TO REPORTNAME ELSE NULL RETURN ********************************************************************* DONE: * IF YOU WANT TO PRODUCE A REPORT GO TO SUB IF TOTERRORS > 0 THEN * GOSUB GETLISTREPORT END PRINT PRINT "END TIME ":OCONV(TIME(),"MTH") PRINT PRINT "THERE WERE A TOTAL OF ":TOTERRORS:" ERRORS FOUND" CLOSE MEMO CLOSESEQ REPORTNAME PRINT COMPLETE STOP END