tldm-universe/CMS/BP.CNV/CMSD.ORDER.CONV
2024-09-10 15:25:06 -04:00

103 lines
2.5 KiB
Plaintext
Executable File

* CMSD.ORDER.CONV
* AUTHOR: STEVEN ADAMS
* DATE: 10/23/95
* PURPOSE: TO CONVERT PM.ORDERS RECORDS TO NEW FORMAT (NEW NAME/ADDRESS LAYOUT)
*
$INCLUDE BP.MASTER GEN.COMMON
$INCLUDE BP.MASTER CMSD.IVD
*
EQU IVD$SHIP.TO.STREET TO 56
EQU IVD$SHIP.TO.ATTN1 TO 57
EQU IVD$SHIP.TO.ATTN2 TO 58
EQU IVD$SHIP.TO.CITY TO 59
EQU IVD$SHIP.TO.STATE TO 60
EQU IVD$SHIP.TO.ZIP TO 61
EQU IVD$SHIP.TO.COUNTRY TO 62
*
OPEN 'PM.ORDERS' TO PM.ORDERS ELSE ABORT 201,'PM.ORDERS'
*
CRT CS
CRT @(1,1):RV:' CMSD.ORDER.CONV ':ERV
CRT @(25,3):'ORDER CONVERSION TO NEW NAME/ADDRESS LAYOUT'
EOL=0 ; CT=0 ; NONE=0 ; OK=0 ; CNV=0 ; USA=0 ; CAN=0 ; FOR=0
SELECT PM.ORDERS
LOOP
READNEXT ID ELSE EOL=1
UNTIL EOL DO
IF REM(CT,100)=0 THEN GOSUB 2000
READU ORAY FROM PM.ORDERS,ID THEN
CT=CT+1
GOSUB 1000
RELEASE PM.ORDERS,ID
END
REPEAT
GOSUB 2000
CRT
STOP
*
1000 *
IF ORAY<IVD$SHIP.TO.NAME> = '' THEN
NONE=NONE+1
END ELSE
IF ORAY<IVD$SHIP.TO.NAME,6> # '' THEN
OK=OK+1
END ELSE
CNV=CNV+1
PNAME=ORAY<IVD$SHIP.TO.NAME>
PATTN1=ORAY<IVD$SHIP.TO.ATTN1>
PATTN2=ORAY<IVD$SHIP.TO.ATTN2>
PSTREET=ORAY<IVD$SHIP.TO.STREET>
PCITY=ORAY<IVD$SHIP.TO.CITY>
PSTATE=ORAY<IVD$SHIP.TO.STATE>
PZIP=ORAY<IVD$SHIP.TO.ZIP>
PCOUNTRY=ORAY<IVD$SHIP.TO.COUNTRY>
ORAY<IVD$SHIP.TO.NAME>=''
ORAY<IVD$SHIP.TO.NAME,6>=PNAME
ORAY<IVD$SHIP.TO.STREET>=''
ORAY<IVD$SHIP.TO.ATTN1>=''
ORAY<IVD$SHIP.TO.ATTN2>=''
ORAY<IVD$SHIP.TO.CITY>=''
ORAY<IVD$SHIP.TO.STATE>=''
ORAY<IVD$SHIP.TO.ZIP>=''
ORAY<IVD$SHIP.TO.COUNTRY>=''
ORAY<IVD$SHIP.TO.ADDRESS>=''
ORAY<IVD$SHIP.TO.ADDRESS,1>=PATTN1
ORAY<IVD$SHIP.TO.ADDRESS,2>=PATTN2
ORAY<IVD$SHIP.TO.ADDRESS,3>=PSTREET
ORAY<IVD$SHIP.TO.ADDRESS,4>=PCITY
ORAY<IVD$SHIP.TO.ADDRESS,5>=PSTATE
BEGIN CASE
CASE PZIP[1,5] MATCHES '5N'
PGEO='USA'
PCOUNTRY=''
USA=USA+1
CASE PZIP[1,3] MATCHES '1N1A1N'
PGEO='CAN'
PCOUNTRY='CAN'
CAN=CAN+1
CASE PZIP='00000'
PZIP=''
PGEO='FOR'
FOR=FOR+1
CASE 1
PGEO='FOR'
FOR=FOR+1
END CASE
ORAY<IVD$SHIP.TO.ADDRESS,6>=PZIP
ORAY<IVD$SHIP.TO.ADDRESS,7>=PCOUNTRY
ORAY<IVD$SHIP.TO.ADDRESS,8>=PGEO
WRITE ORAY ON PM.ORDERS,ID
END
END
RETURN
*
2000 *
CRT @(10,08):"Number of orders read: ":CT
CRT @(10,09):"Number of orders without SHIPTO: ":NONE
CRT @(10,10):"Number of orders OK: ":OK
CRT @(10,11):"Number of orders converted: ":CNV
CRT @(10,13):"Number of USA orders converted: ":USA
CRT @(10,14):"Number of CANADA orders converted: ":CAN
CRT @(10,15):"Number of FOREIGN orders converted: ":FOR
RETURN