107 lines
2.2 KiB
Plaintext
Executable File
107 lines
2.2 KiB
Plaintext
Executable File
* CLEAN.CASH.BALANCES
|
|
*
|
|
$INCLUDE BP.MASTER GEN.COM2
|
|
$INCLUDE BP.MASTER CMSD.IVD
|
|
*
|
|
EQU TRUE TO 1 ; EQU FALSE TO 0 ; EQU MINUS TO -1
|
|
*
|
|
OPEN 'RESULT.FILE' TO RESULT.FILE ELSE ABORT
|
|
OPEN 'PM.ORDERS.INDEX.PENDING' TO PX ELSE ABORT
|
|
OPEN 'PM.ORDERS' TO PM.ORDERS ELSE ABORT
|
|
OPEN 'GEN.KEYS' TO GEN.KEYS ELSE ABORT
|
|
*
|
|
PROG.NAME='CLEAN.CASH.BALANCES'
|
|
READ SYSTEM.SETUP FROM GEN.KEYS,'SYSTEM.SETUP' ELSE ABORT
|
|
*
|
|
FILENAME='PM.ORDERS'
|
|
*
|
|
* check command line for WR switch
|
|
PRODUCTION=FALSE
|
|
GET(ARG.) CMD THEN
|
|
IF CMD="WR" THEN
|
|
PRODUCTION=TRUE
|
|
END
|
|
END
|
|
*
|
|
ACCT=@WHO
|
|
CRT CS:RV:PROG.NAME:ERV
|
|
CRT @(0,1):"Processing in ":ACCT:" (":SYSTEM.SETUP<27>:")"
|
|
*
|
|
CDATE=DATE()
|
|
CTIME=TIME()
|
|
COUNTS=PROG.NAME:"_":CDATE:"_":CTIME
|
|
ERRORS=PROG.NAME:".ERRORS":"_":CDATE:"_":CTIME
|
|
*
|
|
CNT=0 ; REFRESH=500
|
|
ERAY=''
|
|
ERAY<3>=TIMEDATE()
|
|
*
|
|
SELECT PX
|
|
EOF=FALSE
|
|
LOOP
|
|
READNEXT ID ELSE EOF=TRUE
|
|
UNTIL EOF DO
|
|
IF REM(CNT,REFRESH) ELSE GOSUB 5000
|
|
CNT=CNT+1
|
|
EMSG='RECORDS SELECTED' ; GOSUB 9000
|
|
GOSUB 1000 ;* process data
|
|
REPEAT
|
|
GOSUB 5000
|
|
CRT @(0,22):"Process complete! Press return... ":
|
|
INPUT DUMMY
|
|
RETURN
|
|
*
|
|
1000 *
|
|
READU IREC FROM PM.ORDERS,ID THEN
|
|
EMSG='RECORDS READ' ; GOSUB 9000
|
|
END ELSE
|
|
EMSG='RECORDS MISSING' ; GOSUB 9000 ; GOSUB 9500
|
|
RELEASE PM.ORDERS,ID
|
|
RETURN
|
|
END
|
|
UPDATE.SW=FALSE
|
|
IF IREC<IVD$TERMS>='C' THEN
|
|
UPDATE.SW=TRUE
|
|
IREC<IVD$TERMS>='30' ;* Net 30
|
|
END
|
|
IF UPDATE.SW THEN
|
|
IF PRODUCTION THEN
|
|
WRITE IREC ON PM.ORDERS,ID
|
|
END
|
|
EMSG='RECORDS WRITTEN' ; GOSUB 9000
|
|
END
|
|
RELEASE PM.ORDERS,ID
|
|
RETURN
|
|
*
|
|
5000 *
|
|
ERAY<4>=TIMEDATE()
|
|
CRT @(0,2):"Processing ":FILENAME:
|
|
IF PRODUCTION THEN
|
|
CRT " ":RV:"PRODUCTION":ERV
|
|
END ELSE
|
|
CRT " ":RV:"TEST ONLY":ERV
|
|
END
|
|
ECT=DCOUNT(ERAY<1>,VM)
|
|
CRT @(11,4):"Start Time: ":ERAY<3>
|
|
CRT @(11,5):"Current Time: ":ERAY<4>
|
|
FOR E=1 TO ECT
|
|
CRT @(0,7+E):ERAY<2,E>'R#10':" ":ERAY<1,E>
|
|
NEXT E
|
|
WRITE ERAY ON RESULT.FILE,COUNTS
|
|
RETURN
|
|
*
|
|
9000 *
|
|
LOCATE(EMSG,ERAY,1;FND.ERR;'AL') THEN
|
|
ERAY<2,FND.ERR>=ERAY<2,FND.ERR>+1
|
|
END ELSE
|
|
ERAY=INSERT(ERAY,1,FND.ERR;EMSG)
|
|
ERAY=INSERT(ERAY,2,FND.ERR;1)
|
|
END
|
|
RETURN
|
|
*
|
|
9500 *
|
|
READU ER FROM RESULT.FILE,ERRORS ELSE ER=''
|
|
ER=INSERT(ER,-1;EMSG:": ":ID)
|
|
WRITE ER ON RESULT.FILE,ERRORS
|
|
RETURN
|