84 lines
2.0 KiB
Plaintext
84 lines
2.0 KiB
Plaintext
|
* CMSD.ORDER.CONV.DPOINT
|
||
|
* AUTHOR: STEVEN ADAMS
|
||
|
* DATE: 1/15/95
|
||
|
* PURPOSE: TO INSERT DISTRIBUTION POINTS INTO ORDERS
|
||
|
*
|
||
|
$INCLUDE BP.MASTER GEN.COMMON
|
||
|
$INCLUDE BP.MASTER CMSD.IVD
|
||
|
*
|
||
|
EQU TRUE TO 1 ; EQU FALSE TO 0
|
||
|
*
|
||
|
FILENAME='PM.ORDERS'
|
||
|
DISP=100 ;* number of records to process between displays
|
||
|
*
|
||
|
OPEN FILENAME TO FILEVAR ELSE ABORT
|
||
|
OPEN 'GEN.KEYS' TO GEN.KEYS ELSE ABORT
|
||
|
CNT=0 ; DP.CNT='' ; EOL=FALSE
|
||
|
*
|
||
|
CRT CS:@(1,1):RV:@WHO:" account ":FILENAME:" Conversion":ERV
|
||
|
*
|
||
|
READ CORP FROM GEN.KEYS,"CORPORATION.CODES" ELSE CORP=''
|
||
|
READ DP FROM GEN.KEYS,"DISTRIBUTION.POINTS" ELSE
|
||
|
DP=''
|
||
|
DP<1>="M":VM:"P"
|
||
|
DP<2>="Micahtek Mail Processing":VM:"Micahtek Phone Processing"
|
||
|
DP<3>="MTEK":VM"MTEK"
|
||
|
DP<4>="MAIL":VM:"PHONE"
|
||
|
DP<5>=CORP<1,1>:VM:CORP<1,1>
|
||
|
WRITE DP ON GEN.KEYS,"DISTRIBUTION.POINTS"
|
||
|
END
|
||
|
*
|
||
|
SELECT FILEVAR
|
||
|
LOOP
|
||
|
READNEXT ID ELSE EOL=TRUE
|
||
|
UNTIL EOL DO
|
||
|
IF REM(CNT,DISP)=0 THEN GOSUB 2000
|
||
|
READU IREC FROM FILEVAR,ID THEN GOSUB 1000
|
||
|
RELEASE FILEVAR,ID
|
||
|
CNT=CNT+1
|
||
|
REPEAT
|
||
|
GOSUB 2000
|
||
|
CRT @(0,22):"Process complete. Press return...":
|
||
|
*INPUT DUMMY
|
||
|
RETURN
|
||
|
*
|
||
|
1000 *
|
||
|
* perform conversion here
|
||
|
ITEM.CNT=DCOUNT(IREC<IVD$ITEM>,VM)
|
||
|
DPOINT=IREC<IVD$CHANNEL>[1,1]
|
||
|
LOCATE(DPOINT,DP,1;WH) ELSE DPOINT='M'
|
||
|
LOCATE(DPOINT,DP.CNT,1;FND;'AL') ELSE
|
||
|
DP.CNT=INSERT(DP.CNT,1,FND;DPOINT)
|
||
|
DP.CNT=INSERT(DP.CNT,2,FND;0)
|
||
|
DP.CNT=INSERT(DP.CNT,3,FND;0)
|
||
|
DP.CNT=INSERT(DP.CNT,4,FND;0)
|
||
|
DP.CNT=INSERT(DP.CNT,5,FND;0)
|
||
|
END
|
||
|
DP.SW=0
|
||
|
FOR II=1 TO ITEM.CNT
|
||
|
IF IREC<IVD$ITEM.BO.TAG,II>#DPOINT THEN
|
||
|
DP.SW=1
|
||
|
IREC<IVD$ITEM.BO.TAG,II>=DPOINT
|
||
|
DP.CNT<3,FND>=DP.CNT<3,FND>+1
|
||
|
END ELSE
|
||
|
DP.CNT<5,FND>=DP.CNT<5,FND>+1
|
||
|
END
|
||
|
NEXT II
|
||
|
IF DP.SW THEN
|
||
|
DP.CNT<2,FND>=DP.CNT<2,FND>+1
|
||
|
END ELSE
|
||
|
DP.CNT<4,FND>=DP.CNT<4,FND>+1
|
||
|
END
|
||
|
WRITE IREC ON FILEVAR,ID
|
||
|
RETURN
|
||
|
*
|
||
|
2000 *
|
||
|
CRT @(5,4):"Items read: ":CNT:
|
||
|
CRT @(0,5):'DIST #ORDERS #ITEMS #ORDERS OK #ITEMS OK':
|
||
|
DD=DCOUNT(DP.CNT<1>,VM)
|
||
|
FOR D=1 TO DD
|
||
|
CRT @(0,6+D):DP.CNT<1,D>'L#4':DP.CNT<2,D>'R#10':DP.CNT<3,D>'R#12':
|
||
|
CRT DP.CNT<4,D>'R#13':DP.CNT<5,D>'R#12':
|
||
|
NEXT D
|
||
|
RETURN
|