tldm-universe/CMS/BP.CUSTOM/CONVERT.PM.TLD
2024-09-10 15:25:06 -04:00

474 lines
12 KiB
Plaintext
Executable File

* CONVERT.PM.TLD
*
* 08/20/99 - CONVERT TLD PM FILE
*
$INCLUDE BP.MASTER GEN.COMMON
$INCLUDE BP.MASTER PM
*
OPEN 'PM' TO PM ELSE ABORT
OPEN 'PM.TRANS' TO PM.TRANS ELSE ABORT
OPEN 'PM.TRANS.TLD' TO PM.TRANS.TLD ELSE ABORT
OPEN 'PM.AUX' TO PM.AUX ELSE ABORT
OPEN 'PM.TLD' TO PM.TLD ELSE ABORT
OPEN 'PM.PLEDGES' TO PM.PLEDGES ELSE ABORT
OPEN 'PM.PLEDGES.TLD' TO PM.PLEDGES.TLD ELSE ABORT
OPEN 'GEN.KEYS' TO GEN.KEYS ELSE ABORT
OPEN 'GEN.KEYS.TLD' TO GEN.KEYS.TLD ELSE ABORT
OPEN 'NOTES.FILE' TO NOTES.FILE ELSE ABORT
OPEN 'NOTES.FILE.TLD' TO NOTES.FILE.TLD ELSE ABORT
OPEN 'PM.COMBINED' TO PM.COMBINED ELSE ABORT
OPEN 'EVENT.FILE' TO EVENT.FILE ELSE ABORT
OPEN 'EVENT.FILE.TLD' TO EVENT.FILE.TLD ELSE ABORT
OPEN 'FUND.FILE' TO FUND.FILE ELSE ABORT
OPEN 'FUND.FILE.TLD' TO FUND.FILE.TLD ELSE ABORT
OPEN 'TITLE' TO TITLE ELSE ABORT
OPEN 'TITLE.TLD' TO TITLE.TLD ELSE ABORT
OPEN 'STATUS.CODES' TO STATUS.CODES ELSE ABORT
OPEN 'STATUS.CODES.TLD' TO STATUS.CODES.TLD ELSE ABORT
OPEN 'CONVERT.PM.TLD.MESSAGE' TO MESSAGE.FILE ELSE ABORT
OPEN 'EMPLOYER.MASTER' TO EMPLOYER.MASTER ELSE ABORT
OPEN 'EMPLOYER.MASTER.TLD' TO EMPLOYER.MASTER.TLD ELSE ABORT
OPEN 'PM.JOURNAL' TO PM.JOURNAL ELSE ABORT
OPEN 'PM.JOURNAL.TLD' TO PM.JOURNAL.TLD ELSE ABORT
OPEN 'SG' TO SG ELSE ABORT
OPEN 'SG.TLD' TO SG.TLD ELSE ABORT
OPEN 'SG.MOVEMENT' TO SG.MOVEMENT ELSE ABORT
OPEN 'SG.MOVEMENT.TLD' TO SG.MOVEMENT.TLD ELSE ABORT
*
*
MSG.COUNT=0
HIGHNUM=0
KEY=''
STIME=TIME()
TOTAL.ARRAY=''
TOTAL.ARRAY<01,01>=0 ; TOTAL.ARRAY<02,01>='PM Records Read'
TOTAL.ARRAY<01,02>=0 ; TOTAL.ARRAY<02,02>='Combined Records'
TOTAL.ARRAY<01,03>=0 ; TOTAL.ARRAY<02,03>='PM Records Written'
TOTAL.ARRAY<01,04>=0 ; TOTAL.ARRAY<02,04>='Notes Records Converted'
TOTAL.ARRAY<01,05>=0 ; TOTAL.ARRAY<02,05>='New Notes Created Comments'
TOTAL.ARRAY<01,06>=0 ; TOTAL.ARRAY<02,06>='Note Records Not Converted'
TOTAL.ARRAY<01,07>=0 ; TOTAL.ARRAY<02,07>='Event Records Converted'
TOTAL.ARRAY<01,08>=0 ; TOTAL.ARRAY<02,08>='Fund Record Converted'
TOTAL.ARRAY<01,09>=0 ; TOTAL.ARRAY<02,09>='Pledge Records Converted'
TOTAL.ARRAY<01,10>=0 ; TOTAL.ARRAY<02,10>='Pledge Records Skipped'
TOTAL.ARRAY<01,11>=0 ; TOTAL.ARRAY<02,11>='Title Codes Converted'
TOTAL.ARRAY<01,12>=0 ; TOTAL.ARRAY<02,12>='Status Codes Converted'
TOTAL.ARRAY<01,13>=0 ; TOTAL.ARRAY<02,13>='Employer Master Records Converted'
TOTAL.ARRAY<01,14>=0 ; TOTAL.ARRAY<02,14>='Journal Records Converted'
TOTAL.ARRAY<01,15>=0 ; TOTAL.ARRAY<02,15>='Journal Records Skipped'
*
TOTAL.ARRAY<01,19>=0 ; TOTAL.ARRAY<02,19>='Message Log Entries'
TOTAL.ARRAY<01,20>=0 ; TOTAL.ARRAY<02,20>='Highest PM Number'
TTRANSIN=0
CDATE=DATE()
*
CRT CS
CRT @(0,4):"Enter 'Y' to clear PM file and convert TLD: ":
ANS=''
INPUT ANS
IF ANS # 'Y' THEN STOP
*
CRT @(0,22):CL:BEEP:"NOW CLEARING FILES - PLEASE WAIT!!!"
*
CLEARFILE NOTES.FILE ;* TEMP
CLEARFILE PM
CLEARFILE PM.AUX
CLEARFILE NOTES.FILE
CLEARFILE PM.COMBINED
*CLEARFILE EVENT.FILE ;* DO NOT CLEAR-SAVE 3 INITIAL EVENT DEF CODES
CLEARFILE FUND.FILE
CLEARFILE PM.PLEDGES
CLEARFILE MESSAGE.FILE
CLEARFILE STATUS.CODES
CLEARFILE TITLE
CLEARFILE EMPLOYER.MASTER
CLEARFILE SG
CLEARFILE SG.MOVEMENT
*
CLEARFILE PM.TRANS
WRITE 'NEW' ON GEN.KEYS,"CONVERT.PM.TLD"
*
CRT @(0,22):CL
*
SELECT FUND.FILE.TLD
50 READNEXT FUNDKEY THEN
READ FUNDREC FROM FUND.FILE.TLD,FUNDKEY THEN
WRITE FUNDREC ON FUND.FILE,FUNDKEY
TOTAL.ARRAY<1,8>=TOTAL.ARRAY<1,8>+1
END
GO 50
END
GOSUB 1000
*
SELECT EVENT.FILE.TLD
75 READNEXT EVENTKEY THEN
READ EVENTREC FROM EVENT.FILE.TLD,EVENTKEY THEN
IF REM(TOTAL.ARRAY<1,7>,500)=0 THEN GOSUB 1000
*
* ABS 04-13-98 three fields that need to be changed.
*
* EVENTREC<24>=EVENTREC<20> ; EVENTREC<20>=""
* EVENTREC<25>=EVENTREC<21> ; EVENTREC<21>=""
* EVENTREC<26>=EVENTREC<22> ; EVENTREC<22>=""
*
WRITE EVENTREC ON EVENT.FILE,EVENTKEY
TOTAL.ARRAY<1,7>=TOTAL.ARRAY<1,7>+1
END
GO 75
END
GOSUB 1000
*
SELECT TITLE.TLD
85 READNEXT TITLEKEY THEN
READ TITLEREC FROM TITLE.TLD,TITLEKEY THEN
WRITE TITLEREC ON TITLE,TITLEKEY
TOTAL.ARRAY<1,11>=TOTAL.ARRAY<1,11>+1
END
GO 85
END
READ TITLEREC FROM GEN.KEYS.TLD,"TITLE" THEN
WRITE TITLEREC ON GEN.KEYS,"TITLE"
END ELSE
MSG='GEN.KEYS TITLE RECORD MISSING'
END
GOSUB 1000
*
SELECT STATUS.CODES.TLD
90 READNEXT STAKEY THEN
READ STAREC FROM STATUS.CODES.TLD,STAKEY THEN
WRITE STAREC ON STATUS.CODES,STAKEY
TOTAL.ARRAY<1,12>=TOTAL.ARRAY<1,12>+1
END
GO 90
END
GOSUB 1000
*
*
SELECT SG.TLD
92 READNEXT SGKEY THEN
READ SGREC FROM SG.TLD,SGKEY THEN
WRITE SGREC ON SG,SGKEY
END
GO 92
END
GOSUB 1000
*
SELECT SG.MOVEMENT.TLD
94 READNEXT SGKEY THEN
READ SGREC FROM SG.MOVEMENT.TLD,SGKEY THEN
WRITE SGREC ON SG.MOVEMENT,SGKEY
END
GO 94
END
GOSUB 1000
*
*
999 *
*EXECUTE 'SELECT PM "6781792.1"' ;* TEMP
SELECT PM.TLD ;* TEMP
100 READNEXT KEY ELSE GO 200
READ OREC FROM PM.TLD,KEY ELSE GO 100
IF REM(TOTAL.ARRAY<1,1>,2000)=0 THEN GOSUB 1000
*IF TOTAL.ARRAY<1,1> > 2000 THEN GO 199
TOTAL.ARRAY<1,1>=TOTAL.ARRAY<1,1>+1
LOCATE("95",OREC,PM$STATUS;FND) THEN
TOTAL.ARRAY<1,2>=TOTAL.ARRAY<1,2>+1
WRITE OREC ON PM.COMBINED,KEY
GO 100
END
PMREC=''
PMAUX=''
PMKEY=KEY
WK=OCONV(PMKEY,"G0.1")
IF WK > HIGHNUM THEN
TOTAL.ARRAY<1,20>=WK ; HIGHNUM=WK
END
PMREC<PM$TITLE>=OREC<PM$TITLE>
PMREC<PM$FNAME>=OREC<PM$FNAME>
PMREC<PM$SALUTATION>=OREC<PM$SALUTATION>
PMREC<PM$MNAME>=OREC<PM$MNAME>
PMREC<PM$LNAME>=OREC<PM$LNAME>
PMREC<PM$ADDR1>=OREC<PM$ADDR1>
PMREC<PM$CITY>=OREC<PM$CITY>
PMREC<PM$STATE>=OREC<PM$STATE>
PMREC<PM$ZIP>=OREC<PM$ZIP>
*IF OREC<PM$PHONE> # '' THEN
* PMREC<PM$PHONE>=OREC<PM$PHONE>:'|H'
*END
PMREC<PM$PHONE>=OREC<PM$PHONE>
PMREC<PM$STATUS>=OREC<PM$STATUS>
PMREC<PM$SEGMENT>=OREC<PM$SEGMENT>
PMREC<PM$SEG.DATE>=OREC<PM$SEG.DATE>
PMREC<PM$ORIGIN>=OREC<PM$ORIGIN>
PMREC<PM$ORI.DATE>=OREC<PM$ORI.DATE>
* IF OREC<16> # '' THEN
* LAST.NOTE=OREC<PM$LAST.NOTE>
* IF LAST.NOTE='' THEN LAST.NOTE=0
* LAST.NOTE=LAST.NOTE+1
* PMREC<PM$LAST.NOTE>=1
* OREC<PM$LAST.NOTE>=LAST.NOTE ;* ADD ONE TO LAST.NOTE FIELD
* NOTEREC=''
* NOTEREC<1>=CDATE
* NOTEREC<3>=OREC<16>
* NOTEREC<6>='99999 - ROOT SYSADMIN'
* NOTEREC<7>='CNV'
* NOTEREC<8>='GEN'
* WRITE NOTEREC ON NOTES.FILE,PMKEY:"*":LAST.NOTE
* TOTAL.ARRAY<1,5>=TOTAL.ARRAY<1,5>+1
* END
PMREC<PM$ENTRY.OPERATOR>=OREC<PM$ENTRY.OPERATOR>
PMREC<PM$ADDR2>=OREC<PM$ADDR2>
PMREC<PM$ADDR3>=OREC<PM$ADDR3>
PMREC<PM$ADI>=OREC<PM$ADI>
PMREC<PM$SUFFIX>=OREC<PM$SUFFIX>
PMREC<PM$FAMILY.TITLE>=OREC<PM$FAMILY.TITLE>
PMREC<PM$FAMILY.SALUTATION>=OREC<PM$FAMILY.SALUTATION>
PMREC<PM$LAST.CHANGE>=OREC<PM$LAST.CHANGE>
PMREC<PM$SUBSCRIPTION>=OREC<PM$SUBSCRIPTION>
IF PMREC<PM$ZIP>='00000' THEN
PMREC<PM$ZIP>=''
PMREC<PM$GEO.CODE>='FOR'
END
IF PMREC<PM$ZIP>[1,3] MATCHES "1A0N1A" THEN
PMREC<PM$GEO.CODE>='CAN' ;*SPA* set Canadian GEO Code
PMREC<PM$COUNTRY>='CANADA'
END ELSE
IF PMREC<PM$ZIP>[1,5] MATCHES "5N" THEN
PMREC<PM$GEO.CODE>='USA'
END
END
*
PMREC<PM$HIGHEST.GIFT.DATE>=OREC<PM$HIGHEST.GIFT.DATE>
PMREC<PM$HIGHEST.GIFT.AMOUNT>=OREC<PM$HIGHEST.GIFT.AMOUNT>
PMREC<PM$AVG.GIFT>=OREC<PM$AVG.GIFT>
*
CT5=DCOUNT(OREC<PM$YEAR>,VM)
FOR XXX = 1 TO CT5
NEWYEAR='19':OREC<PM$YEAR,XXX>
PMREC<PM$YEAR,XXX>=NEWYEAR
PMREC<PM$SUM.DED,XXX>=OREC<PM$SUM.DED,XXX>
PMREC<PM$SUM.NON,XXX>=OREC<PM$SUM.NON,XXX>
NEXT XXX
*
PMREC<PM$SPOUSE>=OREC<PM$SPOUSE>
PMREC<PM$CANADA.RECEIPTS>=OREC<PM$CANADA.RECEIPTS>
PMREC<PM$SOC.SEC.NUM>=OREC<PM$SOC.SEC.NUM>
*
PMREC<PM$PLEDGE.COUNT>=OREC<PM$PLEDGE.COUNT>
PMREC<PM$AUDIT.RECORD>=OREC<PM$AUDIT.RECORD>
PMREC<PM$COMBINED.PARTNERS>=OREC<PM$COMBINED.PARTNERS>
*
PMREC<PM$DEMOG>=OREC<PM$DEMOG>
*
PMREC<PM$ORDER.NUMBERS>=OREC<PM$ORDER.NUMBERS>
* *
PMREC<PM$SHIP.ADDR>=OREC<PM$SHIP.ADDR> ;*
*
* IF OREC<43> # '' THEN ;* CCC.RSV.FLAG
* PMAUX<2>=OREC<43>
* END
* *
* IF OREC<44> # '' THEN ;* CDIVISION.CODE
* PMAUX<3>=OREC<44>
* END
*
IF OREC<PM$LAST.NOTE> # '' THEN
PMREC<PM$LAST.NOTE>=OREC<PM$LAST.NOTE>
END
*
IF OREC<PM$FOLLOWUP.DATE> # '' THEN
PMREC<PM$FOLLOWUP.DATE>=OREC<PM$FOLLOWUP.DATE>
END
*
IF OREC<PM$RADIO.CALL.LETTERS> # '' THEN
PMREC<PM$RADIO.CALL.LETTERS>=OREC<PM$RADIO.CALL.LETTERS>
END
*
*
IF OREC<PM$BALANCE> # '' THEN
PMREC<PM$BALANCE>=OREC<PM$BALANCE>
END
*
*
*
IF OREC<68> # '' THEN ;* USING TAX FIELD FOR TRAN CT FOR TLD
PMREC<PM$TAX>=OREC<68>
END
IF OREC<PM$TAX.ID> # '' THEN ;* TAX ID
PMREC<PM$TAX.ID>=OREC<PM$TAX.ID>
END
IF OREC<PM$CONTACT.NAME> # '' THEN
PMREC<PM$CONTACT.NAME>=OREC<PM$CONTACT.NAME>
END
IF OREC<PM$PO.REQUIRED> # '' THEN
PMREC<PM$PO.REQUIRED>=OREC<PM$PO.REQUIRED>
END
IF OREC<PM$CC.TYPE> # '' THEN
PMREC<PM$CC.TYPE>=OREC<PM$CC.TYPE>
END
IF OREC<PM$CC.NUM> # '' THEN
PMREC<PM$CC.NUM>=OREC<PM$CC.NUM>
END
IF OREC<PM$CC.EXPIRE> # '' THEN
PMREC<PM$CC.EXPIRE>=OREC<PM$CC.EXPIRE>
END
IF OREC<PM$CC.NAME> # '' THEN
PMREC<PM$CC.NAME>=OREC<PM$CC.NAME>
END
IF OREC<PM$CREDIT.RATE> # '' THEN
PMREC<PM$CREDIT.RATE>=OREC<PM$CREDIT.RATE>
END
IF OREC<PM$CREDIT.LIMIT> # '' THEN
PMREC<PM$CREDIT.LIMIT>=OREC<PM$CREDIT.LIMIT>
END
IF OREC<PM$PAYMENT.TERMS> # '' THEN
PMREC<PM$PAYMENT.TERMS>=OREC<PM$PAYMENT.TERMS>
END
IF OREC<PM$SHIP.MODE> # '' THEN
PMREC<PM$SHIP.MODE>=OREC<PM$SHIP.MODE>
END
IF OREC<PM$SOURCE.SALE> # '' THEN
PMREC<PM$SOURCE.SALE>=OREC<PM$SOURCE.SALE>
END
IF OREC<PM$PRICE.CLASS> # '' THEN
PMREC<PM$PRICE.CLASS>=OREC<PM$PRICE.CLASS>
END
IF OREC<PM$CREDIT.FUNDS> # '' THEN
PMREC<PM$CREDIT.FUNDS>=OREC<PM$CREDIT.FUNDS>
END
IF OREC<PM$LAST.STATEMENT> # '' THEN
PMREC<PM$LAST.STATEMENT>=OREC<PM$LAST.STATEMENT>
END
* *
* *
* * CONVERT EMPLOYER.MASTER RECORD (CONTAINS WORK NUM AND OTHER NEW PM FIELDS)
* *
READ EMPREC FROM EMPLOYER.MASTER.TLD,PMKEY THEN
WRITE EMPREC ON EMPLOYER.MASTER,PMKEY
TOTAL.ARRAY<1,13>=TOTAL.ARRAY<1,13>+1
END
*
TOTAL.ARRAY<1,3>=TOTAL.ARRAY<1,3>+1
*
WRITE PMREC ON PM,PMKEY
WRITE PMAUX ON PM.AUX,PMKEY
GO 100
199 *
*
*GO 299
200 * CONVERT NOTES FILE
*STOP ;* TEMP
SELECT NOTES.FILE.TLD
210 *
READNEXT NOTEKEY ELSE GO 299
READ OLDNOTE FROM NOTES.FILE.TLD,NOTEKEY ELSE GO 210
IF REM(TOTAL.ARRAY<1,4>,250)=0 THEN GOSUB 1000
PMKEY=OCONV(NOTEKEY,"G0*1")
READ PMREC FROM PM,PMKEY THEN
READV NOTENUM FROM PM.TLD,PMKEY,PM$LAST.NOTE ELSE ABORT
TOTAL.ARRAY<1,4>=TOTAL.ARRAY<1,4>+1
* PMREC<PM$LAST.NOTE>=PMREC<PM$LAST.NOTE>-1
* PMREC<PM$LAST.NOTE>=NOTENUM
* WRITE PMREC ON PM,PMKEY
NOTEREC=OLDNOTE
IF NOTEREC<6>='' THEN
NOTEREC<6>='99999 - SYSADMIN ROOT'
NOTEREC<7>='CNV'
NOTEREC<8>='GEN'
END ELSE
NOTEREC<9>=OLDNOTE<5>
NOTEREC<5>=''
END
* NOTEKEY=PMKEY:"*":PMREC<PM$LAST.NOTE>
WRITE NOTEREC ON NOTES.FILE,NOTEKEY
END ELSE
TOTAL.ARRAY<1,6>=TOTAL.ARRAY<1,6>+1
END
GO 210
299 *
* STOP ;* TEMP
*
300 * CONVERT PM.TRANS
SELECT PM.TRANS.TLD
310 READNEXT TRKEY THEN
READ TRREC FROM PM.TRANS.TLD,TRKEY THEN
IF REM(TTRANSIN,500)=0 THEN GOSUB 1000
TTRANSIN=TTRANSIN+1
READ PMREC FROM PM,TRKEY THEN
NEWTR=''
NEWTR=TRREC
WRITE NEWTR ON PM.TRANS,TRKEY
TTRANS=TTRANS+1
END
END
GO 310
END
*
400 * CONVERT PM.PLEDGES
SELECT PM.PLEDGES.TLD
410 READNEXT PGKEY THEN
READ PGREC FROM PM.PLEDGES.TLD,PGKEY THEN
READ PMREC FROM PM,PGKEY THEN
IF REM(TOTAL.ARRAY<1,9>,250)=0 THEN GOSUB 1000
TOTAL.ARRAY<1,9>=TOTAL.ARRAY<1,9>+1
WRITE PGREC ON PM.PLEDGES,PGKEY
END ELSE
TOTAL.ARRAY<1,10>=TOTAL.ARRAY<1,10>+1
END
END
GO 410
END
*
500 * CONVERT PM.JOURNAL
SELECT PM.JOURNAL.TLD
510 READNEXT JRKEY THEN
READ JREC FROM PM.JOURNAL.TLD,JRKEY THEN
READ PMREC FROM PM,JRKEY THEN
IF REM(TOTAL.ARRAY<1,14>,250)=0 THEN GOSUB 1000
TOTAL.ARRAY<1,14>=TOTAL.ARRAY<1,14>+1
WRITE JREC ON PM.JOURNAL,JRKEY
END ELSE
TOTAL.ARRAY<1,15>=TOTAL.ARRAY<1,15>+1
END
END
GO 510
END
*
GO 2000
*
*
1000 *
GKREC=''
CTIME=TIME()
DTIME=STIME-CTIME
GKREC<1>='STARTED: ':OCONV(STIME,"MTH")
GKREC<2>='FINISH : ':OCONV(CTIME,"MTH")
GKREC<3>='RUN TIME: ':OCONV(DTIME,"MTS")
LNNUM=5
DISP=0
FOR TT = 1 TO 20
WK=TOTAL.ARRAY<1,TT>'L#8':' ':TOTAL.ARRAY<2,TT>
GKREC<4+TT>=WK
NEXT TT
WRITE GKREC ON GEN.KEYS,"CONVERT.PM.TLD"
FOR TT = 1 TO 24
IF REM(TT,13)=0 THEN DISP=40 ; LNNUM=5
CRT @(0+DISP,LNNUM):GKREC<TT>'L#40'
LNNUM=LNNUM+1
NEXT TT
RETURN
*
2000 *
GOSUB 1000
STOP
*
3000 * WRITE TO MESSAGE.FILE
MSG.COUNT=MSG.COUNT+1
MSGLN=KEY'L#12':" ":MSG
WRITE MSGLN ON MESSAGE.FILE,MSG.COUNT'R%5'
RETURN
*
4000 * ADD TO DEMOG FIELDS
*
RETURN