SeanHoppe.com › Cleo CodeSamples › Create Automatic Email for Late EDI Acknowledgments
FEXLLMUSC IF E K DISK FQPRINT O F 198 PRINTER OFLIND(*INOF) FORMLEN(66) FORMOFL(64) F USROPN *------------------------------------------------------------------------- D USADAT S D DATFMT(*USA) INZ(*SYS) D ACKED S 5 0 D COUNT S 5 0 D SENTTM S 4 0 *------------------------------------------------------------------------- * get 1st records for yesterdays date & save values C YESTERDAY CHAIN @LLMUSC 10 C EXSR @NEWTPC C DOW *IN10 = *OFF C IF LMGPC1 = 'IN' C IF LITPCD <> TPCSAV AND COUNT > 0 * send email for previous trading partner C EXSR @SENDEMAIL C EXSR @NEWTPC C ENDIF * print acknowledgement details C LMASTM COMP 'A' 11 C LMASTM COMP 'E' 12 C LMASTM COMP 'P' 13 C *YMD0 MOVE LIINDT USADAT C MOVE LIINTM SENTTM C EXCEPT #INVOICES C ENDIF * accumulate counts C IF *IN11 OR *IN12 C ADD 1 ACKED C ENDIF * C ADD 1 COUNT C ENDIF * C YESTERDAY READE @LLMUSC 10 C ENDDO * send email if last trading partner not sent C COUNT CASGT 0 @SENDEMAIL C ENDCS C MOVE *ON *INLR C RETURN *------------------------------------------------------------------------- C @NEWTPC BEGSR *------------------------------------------------------------------------- * open splf, print heading & save values C OPEN QPRINT C EXCEPT #HEADER C MOVE LITPCD TPCSAV 6 C MOVE LMMSCL MSCSAV 10 C ENDSR *------------------------------------------------------------------------- C @SENDEMAIL BEGSR *------------------------------------------------------------------------- * print previous trading partner total, close & send splf via Keyesmail C EXCEPT #TOTAL C CLOSE QPRINT C EVAL CMD = 'CHGSPLFA FILE(QPRINT) + C SPLNBR(*LAST) OUTQ(QUSRSYS/KMLOUTQ) + C USRDFNDTA(''¬Email KMLEDI/' + %TRIM(MSCSAV)+ C ' ¬From EDI@xxxxx.com ¬Subj EDI 997 ACKNOWL+ C EDGEMENT STATUS REPORT ¬Temp *HTML'')' C CALL 'QCMDEXC' KML 13 C Z-ADD 0 COUNT C Z-ADD 0 ACKED C ENDSR *------------------------------------------------------------------------- C *INZSR BEGSR *------------------------------------------------------------------------- C KML PLIST C PARM CMD 256 C PARM 256 LEN 15 5 C SUBDUR 1:*DAYS USADAT C *YMD0 MOVE USADAT YESTERDAY 6 C ENDSR *------------------------------------------------------------------------- OQPRINT E #HEADER 1 O '<font face="Verdana">' O E 20 #HEADER 1 O USADAT O +1 'invoices for' O '<font size="+2"><b>' O TPTRNM +1 O '</font></b><ol>' O E 30 #HEADER 1 O USADAT O +1 'ship notices for' O '<font size="+2"><b>' O TPTRNM +1 O '</font></b><ol>' *--------- O E #INVOICES 1 O 12 '<font color="blue">' O 13 '<font color="red">' O '<li type="square">' O LMREF2 O 12 'Acknowledged in error' O 13 'NOT acknowledged since' O 13 SENTTM ' : ' O '</li></font>' O E #NOTICES 1 O 12 '<font color="blue">' O 13 '<font color="red">' O '<li type="square">' O LMREF1 O 12 'Acknowledged in error' O 13 'NOT acknowledged since' O 13 SENTTM +1 ' : ' O '</li></font>' *--------- O E #TOTAL 2 O '</ol><u>' O COUNT 3 O '</u> Sent, <u>' O ACKED 3 +3 O '</u> Acknowledged' O E #TOTAL 3 O '*** END OF REPORT ***' O '</font>'