!S ~EOM1.ibs,RPG 100!O `EOM1 ,RPG 200!L @EOM1 ,E 300 CLEAR & ESCAPETO EOJ & ERRORTO EOJ & ~HEX0$=STRING("@00@",252) 50000 ~RPGDATE$=SUB(DATE$,1,2)+"/"+SUB(DATE$,3,2)+"/"+SUB(DATE$,5,2) 50001 CLOSE(PRINTER) & OPEN(PRINTER)"LP4 " 99000 SET LINES=58 1200 SET MARGIN=151 1300 USE "~RPGUSE" 6000 ~FIELD$=DSTAT("CL1" EXCP=CLK) 51000CLK: ~WFILE$=PARTITION$+RSUB(TIME$,1,2) & ~WDIR$="RPG" 51001 CLOSE(PFILE) & OPEN(PFILE)"MAS0B " DIR=" " 100000 ~KEYSIZE=18 & ~FTYPE$="S" 100100NEXT000:READ (GATE,SORT) EXCP=PRDERR0 200000 INQUIRE IMAGE(PFILE,LINK000) KEY=NUM(~KEY$,~ERR) 200001PRDERR0:IF EXCP=46 GO NEXT000 990000EOJ: PRINT(0)(EN)EXCP=NOTERM 9999910NOTERM: 9999911 GO NEXT000 400900TITL000: FORMAT @(0);_ 10001"[M04 MAEOM04] Summary Report -- SALES BY SALES TYPE" 10002 IF ( RCODE0$ NE 'DI' `) GO SORT 140001 ~SORTREC$=~SORTREC$+ODEPT0$ 150001 ~SORTREC$=~SORTREC$+CNBR0$ 150002 ~SORTREC$=~SORTREC$+OSDATE0$ 150003 USE "~RPGUSE",,20100 120000 USE "~RPGUSE",,40100 9999954 ~SORTLEN= 15 100400SORT: ~RECNO=~RECNO+1 & ~KEY$=STR(~RECNO) 130000 INQUIRE IMAGE(PFILE,LINK000) KEY=~RECNO EXCP=SRDERR & ~SORTREC$="" 130020 WRITE (GATE,SORT) & ~SORT$="Y" & GO SORT 160000SRDERR: IF EXCP=46 GO SORT 160100SEND: IF ~SORT$="" GO EOJ 160101 FILE (GATE) CTL="@06@" 160200LENGTH 1 & LOCAL ~CH1$ 5001LENGTH 1 & LOCAL ~CH1$ 5002LINK000: FORMAT _ 11001LENGTH 2 & LOCAL RCODE0$ 5003 RCODE0$,@(10);_ 11002LENGTH 5 & LOCAL CNBR0$ 5004 CNBR0$,@(13);_ 11003LENGTH 2 & LOCAL ODEPT0$ 5005 ODEPT0$,@(56);_ 11004LENGTH 8 & LOCAL OSDATE0$ 5006 OSDATE0$,@(64);_ 11005LENGTH 9.2 & LOCAL ONET0 5007 ONET0,@(108) 11006LENGTH 11.2 & LOCAL ~TOT01 5008 IF ~T0=0 ~TOT01=~TOT01+ONET0 207001LENGTH 11.2 & LOCAL ~STOT011 5009 IF ~T0=0 ~STOT011=~STOT011+ONET0 207002 ~STOT011=0 800110LENGTH 2 & LOCAL BREAK01$ 5010LENGTH 1 & LOCAL ~BFLAG1$,~BFLG1$ 5011BREAK001:IF ~BFLG1$ NE "X" GO BR001 800102 IF ~LINCNT+1>LINES GOSUB TOP001 800103 PRINT(PRINTER,BREAK001) & ~LINCNT=~LINCNT+2 & ~BFLG1$="" 800104BR001: BREAK01$=ODEPT0$ & RETURN 800199LENGTH 1.0 & LOCAL ~T0 5012 ~T0=1 207003 ~T0=0 200006CH011: FORMAT _ 9001 "NET",@(10);_ 9002 "DEPT/SALES",@(19) 9003CH012: FORMAT _ 9004 "AMOUNT",@(7);_ 9005 "TYPE",@(22);(LF) 9006TOP001: PRINT(PRINTER)(Spool Message="M04 $MAEOM04") 901001 ~LINCNT=0 & ~PAGE=~PAGE+1 901002 PRINT(PRINTER,TOP) & ~LINCNT=~LINCNT+2 901003 PRINT(PRINTER)"" & ~LINCNT=~LINCNT+1 901004 IF ~CH1$="Y" PRINT(PRINTER)"" & ~LINCNT=~LINCNT+1 901025 IF ~CH1$="Y" AND ~LINCNT+3>LINES GOSUB TOP001 901026 IF ~CH1$="Y" PRINT(PRINTER,CH011) & ~LINCNT=~LINCNT+1 203001 PRINT(PRINTER,CH011) & ~LINCNT=~LINCNT+1 901027 IF ~CH1$="Y" PRINT(PRINTER,CH012) & ~LINCNT=~LINCNT+2 203002 PRINT(PRINTER,CH012) & ~LINCNT=~LINCNT+2 901028 ~CH1$="" 203003 ~CH1$="" 901029 RETURN 901030 PRINT(PRINTER,TITL000) & ~LINCNT=~LINCNT+1 901010TOP: FORMAT (FF);@(0);"Date: ";~RPGDATE$;_ 10004" Time: ";TIME$,5;" Report: ";_ 10005 "#EOM1 (03.01)";@(60);"Page:";~PAGE;(CR);_ 10006"SALES TRANSACTION FILE (BY ORDER)",@(0) 10007TOTAL001:FORMAT _ 13001 ~TOT01,@(0);_ 13002"**********",@(19) 13003 ~BFLG1$="X" 207004 IF ~LINCNT+1>LINES GOSUB TOP001 994990 PRINT(PRINTER,TOTAL001) & ~LINCNT=~LINCNT+1 994991BREAK001:FORMAT _ 12001 ~STOT011,@(0);_ 12002 BREAK01$,@(19);(LF) 12003 IF ODEPT0$ NE BREAK01$ GOSUB BREAK001 202800 IF ~BFLAG1$="" BREAK01$=ODEPT0$ & ~BFLAG1$="X" 202400 GOSUB BREAK001 990100 ~CH1$="Y" & GOSUB TOP001 199000XIT: CLOSE(PRINTER) & WRITE(#,RUNIT) & EXIT 9999999!R QREPEXIT 400