Uni-Basic program :
The 'Input File' contains the file of exchanges to check in columnar 
format like 

XXX   XXX   XXX   ...
XXX   XXX   XXX   ...
XXX   XXX   XXX   ...
.
.
.
The 'Output File' contains the list of exchanges to process through
the Uni-Query paragraph, which will update the Benefactor address files.
OPENSEQ '{Directory}', "{Input File}" TO IN.FL ELSE STOP 'CANNOT OPEN INPUT FILE'
OPENSEQ '{Directory}', "{Output File}" TO OUT.FL ELSE STOP 'CANNOT OPEN OUTPUT FILE'

EOF = 0
REC.CNT = 0

EXECUTE "SELECT ADDRESS WITH ADDRESS.PHONES LIKE '{Old Area Code}...'"
EXECUTE "SAVE.LIST INFO.{Old Area Code}"
EXECUTE "CLEARSELECT"
EXECUTE "GET.LIST INFO.{Old Area Code}"

LOOP
  READNEXT ADDR_ID ELSE EOF = 1
UNTIL EOF
  REC.CNT = REC.CNT + 1
REPEAT
EXECUTE "CLEARSELECT"

EOF = 0

IF REC.CNT > 0 THEN
  LOOP
    READSEQ AC.DATA FROM IN.FL THEN
*
*  The next four statements may need to be modified to correctly
*  process the input exchange data.
*
      FOR J = 1 TO 10
        IF AC.DATA[4*J,3] <> '' THEN 
          EXECUTE "GET.LIST INFO.{Old Area Code}"
          SELECT.STATEMENT = "SELECT ADDRESS WITH ADDRESS.PHONES LIKE '{Old Area Code}":AC.DATA[4*J,3]:"...'"
          PRINT SELECT.STATEMENT
          EXECUTE SELECT.STATEMENT
          SEL.CNT = 0
          STRING.REC = ''
          EOF.SEL = 0
          LOOP
            READNEXT SEL_ID ELSE EOF.SEL = 1
          UNTIL EOF.SEL
            SEL.CNT = SEL.CNT + 1
          REPEAT
          EXECUTE "CLEARSELECT"
          IF SEL.CNT > 0 THEN
*
*  The next statement may need to be modified to correctly
*  process the input exchange data.
*
            STRING.REC = "{Uni-Query Paragraph} ":"{Old Area Code}":AC.DATA[4*J,3]:" {New Area Code}":AC.DATA[4*J,3]
            WRITESEQ STRING.REC APPEND ON OUT.FL ELSE PRINT 'could NOT WRITE RECORD '
          END
        END
      NEXT J
    END ELSE 
      EOF = 1
    END
  UNTIL EOF
  REPEAT
END
CLOSESEQ IN.FL
CLOSESEQ OUT.FL
EXECUTE "DELETE.LIST INFO.{Old Area Code}"
END
Uni-Query Paragraph :
PA
CLR
DISPLAY This routine selects all the ADDRESS records
DISPLAY and ADREL records with phone numbers that need
DISPLAY to be changed, then changes them.  It also leaves behind
DISPLAY savedlists of what was changed.
DISPLAY 
DISPLAY Replacing <<A,I2,Enter OLD 6-digit area code exchange (or QUIT): >> with <<A,I3,Enter NEW 6-digit area code exchange (or QUIT): >> . . .
*
* Change phone numbers in ADDRESS file ADDRESS.PHONES (field 18)
*
CHECKADDRESS:
*
* Get a list of ADDRESS records with numbers to change
*
SELECT ADDRESS \
WITH ADDRESS.PHONES \
LIKE "<<Enter OLD 6-digit area code exchange (or QUIT): >>..."
IF @SYSTEM.RETURN.CODE = 0 THEN GO CHECKADREL
SAVE.LIST TEMP1
*
* Prefix all the ADDRESS phone numbers with "XYZZY"
*
GET.LIST TEMP1
AE ADDRESS
DATA =TEMP.FIX 18`C//XYZZY/`C/^253/^253XYZZY/G`FI`=TEMP.FIX
DATA =TEMP.FIX
*
* Change any with the prefix and the area code/exchange combination
*
GET.LIST TEMP1
AE ADDRESS
DATA =TEMP.FIX 18`C/XYZZY<<Enter OLD 6-digit area code exchange (or QUIT): >>/<<Enter NEW 6-digit area code exchange (or QUIT): >>/G`FI`=TEMP.FIX
DATA =TEMP.FIX
*
* Remove prefix
*
GET.LIST TEMP1
AE ADDRESS
DATA =TEMP.FIX 18`C/XYZZY//G`FI`=TEMP.FIX
DATA =TEMP.FIX
*
* Save savedlist of ADDRESS records changed
*
DISPLAY Saving list of addresses changes as "ADDRESS_<<Enter OLD 6-digit area code exchange (or QUIT): >>_TO_<<Enter NEW 6-digit area code exchange (or QUIT): >>" . . .
GET.LIST TEMP1
SAVE.LIST ADDRESS_<<Enter OLD 6-digit area code exchange (or QUIT): >>_TO_<<Enter NEW 6-digit area code exchange (or QUIT): >>
*
* Change phone numbers in ADREL file LOCAL.PHONES (field 14)
*
CHECKADREL:
*
* Get a list of ADREL records with numbers to change
*
SELECT ADREL \
WITH LOCAL.PHONE \
LIKE "<<Enter OLD 6-digit area code exchange (or QUIT): >>..."
IF @SYSTEM.RETURN.CODE = 0 THEN GO DONE
SAVE.LIST TEMP1
*
* Prefix all the ADREL phone numbers with "XYZZY"
*
GET.LIST TEMP1
AE ADREL
DATA =TEMP.FIX 14`C//XYZZY/`C/^253/^253XYZZY/G`FI`=TEMP.FIX
DATA =TEMP.FIX
*
* Change any with the prefix and the area code/exchange combination
*
GET.LIST TEMP1
AE ADREL
DATA =TEMP.FIX 14`C/XYZZY<<Enter OLD 6-digit area code exchange (or QUIT): >>/<<Enter NEW 6-digit area code exchange (or QUIT): >>/G`FI`=TEMP.FIX
DATA =TEMP.FIX
*
* Remove prefix
*
GET.LIST TEMP1
AE ADREL
DATA =TEMP.FIX 14`C/XYZZY//G`FI`=TEMP.FIX
DATA =TEMP.FIX
*
* Save savedlist of ADREL records changed
*
DISPLAY Saving list of ADREL changes as "ADREL_<<Enter OLD 6-digit area code exchange (or QUIT): >>_TO_<<Enter NEW 6-digit area code exchange (or QUIT): >>" . . .
GET.LIST TEMP1
SAVE.LIST ADREL_<<Enter OLD 6-digit area code exchange (or QUIT): >>_TO_<<Enter NEW 6-digit area code exchange (or QUIT): >>
*
DONE:
*
DISPLAY All done

 

This page hosted by Get your own Free Homepage

Hosted by www.Geocities.ws

1