* DATE 04/01/85 22:46 * maintain.bk - file maintenance STOR t TO more DO WHIL more STOR CHR(PEEK(063)) TO dr ERAS STOR '?' TO command @ 02,00 SAY '---------------------' @ 02,20 SAY '---------------------' @ 02,40 SAY '---------------------' @ 02,60 SAY '--------------------' @ 02,19 SAY '> > > F I L E M A I N T E N A N C E < < <' @ 05,22 SAY 'A. Find duplicate records' @ 06,22 SAY 'B. Verify and merge new entries' @ 07,22 SAY 'C. Verify deleted entries' @ 08,22 SAY 'D. Purge deleted entries from file' @ 09,22 SAY 'E. Backup data file' @ 10,22 SAY 'F. Re-index the records' @ 11,22 SAY 'G. Use browse command' @ 12,22 SAY 'H. Change default values' @ 13,22 SAY 'I. Create a new database' @ 14,22 SAY 'J. Return to main menu' @ 17,00 SAY '--------------------' @ 17,20 SAY '--------------------' @ 17,40 SAY '--------------------' @ 17,60 SAY '--------------------' @ 19,30 SAY 'WHAT NEXT' @ 19,40 GET command picture '!' READ DO CASE CASE command = 'A' ERAS @ 07,22 SAY'Looking for duplicate records' DO dupcheck.bk CASE command = 'B' ERAS @ 07,22 SAY'Looking for un-verified new records' DO verifnew.bk CASE command = 'C' ERAS @ 07,22 SAY'Looking for records marked for deletion' DO verifdel.bk CASE commandv 'D' DO purge.bk CASE command = 'E' STOR 'Y' TO doit ERAS @ 01,05 SAY 'This module makes a backup of the DATA File to another disk' @ 03,05 SAY 'Do you want to do a backup of the DATA File (Y/N) ?' @ 03,59 GET doit PICTURE '!' READ IF doit = 'Y' @ 03,00 @ 07,05 SAY 'The DATA File is on drive '+dr+' and you normally backup to drive B' @ 09,05 SAY 'Make sure the backup disk is in the drive selected for backup' RESE STOR 'B' TO bdr @ 13,05 SAY 'Which drive selected for backup DATA File ? ' GET bdr PICTURE '!' READ DO WHIL @(bdr,'AB') = 0 @ 13,05 SAY 'Which drive selected for backup DATA File ? ' GET bdr PICTURE '!' READ ENDD IF bdr <> dr @ 17,05 SAY 'Now copying DATA File from drive '+dr+' to drive '+bdr+ ' ' COPY TO &bdr.:bookbak ELSE @ 17,05 SAY "Can't backup to same drive - Aborting" @ 23,00 SAY 'Hit RETURN to Continue' SET CONSOLE OFF WAIT SET CONSOLE ON ENDI ENDI CASE command = 'F' ERAS @ 7,00 SAY 'Records are now being re-indexed' @ 9,00 SAY 'I will keep you posted as I go along - but......' @ 10,00 SAY 'Please be patient as this will take a little time' @ 12,00 SAY ' ' REST FROM bdata additive STOR CHR(PEEK(063)) TO dr SET TALK ON SET ECHO ON INDE ON !(title) TO &dr.:&tindex INDE ON !(auth1) TO &dr.:&aindex SET INDEX TO &dr.:&tindex SET TALK OFF SET ECHO OFF CASE command = 'G' ERAS @ 01,12 SAY '***WARNING*** ***WARNING*** ***WARNING***' @ 02,12 SAY 'Changes made will be written to the File' @ 04,12 SAY 'Use this function with extreme care !!!!' @ 06,12 SAY 'CTRL-C write current record & go down' @ 07,12 SAY 'CTRL-R write current record & go up' @ 08,12 SAY 'CTRL-Z/B pans screen left or right' @ 09,12 SAY 'CTRL-V toggles Insert on or off' @ 10,12 SAY 'CTRL-G Delete character under cursor' @ 11,12 SAY 'CTRL-U Delete or Recall current record' @ 12,12 SAY "CTRL-Q exit Don't Write Current record" @ 13,12 SAY 'CTRL-W exit and Save all changes' STOR 'T' TO info @ 17,12 SAY 'You can browse by itle or by uthor.' @ 18,20 SAY 'Which shall it be ? ' @ 18,42 GET info PICTURE '!' READ REST FROM bdata additive STOR CHR(PEEK(063)) TO dr IF info = 'A' SET index TO &dr.:&aindex ELSE SET index TO &dr.:&tindex ENDI STOR 'A' TO letter @ 20,12 SAY 'At what letter of alphabet to start browsing' @ 20,57 Get letter PICTURE '!' READ FIND &letter IF # = 0 DO WHIL # = 0 STOR RANK(letter) + 1 TO nextl IF nextl <= 91 STOR CHR(nextl) TO next FIND &next STOR next TO letter ELSE GO top ENDI nextl ENDD ENDI SET ESCAPE OFF IF info = 'A' BROW fields auth1, auth2, auth3 ELSE BROW ENDI SET ESCAPE ON SET INDEX TO &dr.:&tindex RELE letter, next, nextl, info CASE command = 'H' DO init.bk CASE command = '?' ERAS TEXT M A I N T E N A N C E M E N U H E L P S C R E E N The duplicate record option will allow you to find records that may be duplicates. In that option you will have the opportunity to edit or delete the records presented. Everytime you add a new record the program makes a note in the file that the item is new. The verify new module brings up all of the new records and gives you the chance to accept or reject them or to edit them. The verify deleted records option brings up all records which have been marked deleted. It gives you a second chance before you run the purge option - which permanently removes the records from the files (and then reindexes the file). Backup is an option to make a backup copy of the data file. It is preferable to use a full disk backup program to copy the data disk. Browse is a handy option - but for expert use only. Please hit any key to continue......... ENDT SET CONSOLE OFF WAIT SET CONSOLE ON ERAS TEXT The reindex command allows you to reindex all off the index files connected with the data base. You will note that every so often dBASE will give you a 'RECORD OUT OF RANGE' error message. That usually means there is an incorrect end of file marker in the file. First reindex to see if that solves the problem. If that does not work, go into dBASE after renaming the problem file 'TEMP.DBF.' Then, while in dBASE - 'USE TEMP' and then COPY TO (the original file name). That should solve it. If you still have lost records, while still using TEMP (but at what is supposedly the end of the file) SKIP 2 and then COPY NEXT 500 TO TEMP1. Chances are you will recover just about all of the records. If that doesn't work, try one of the commercial programs, such as REPAIR (from HILCO SOFTWARE, Mt. Vernon, Washington) to fix the data base. Defaults are reset by the default reset option. The create new data base option will allow you to set up a new blank data base. After you create it you should go to the add option to put data in it. (When you return to the main menu you will see data from the earlier data base. However, you will actually be in the NEW data base.) Hit any key to return to the program....... ENDT SET CONSOLE OFF WAIT SET CONSOLE ON ERAS CASE command = 'I' ERAS STOR CHR(PEEK(063)) TO dr STOR dr TO dr1 STOR 'N' TO answer STOR ' ' TO newdbf @ 05,10 SAY 'What is the name of the new database ? ' @ 05,60 GET newdbf PICTURE 'BK!!!!!!' READ @ 06,10 SAY 'On what drive do you want this database ' @ 06,60 GET dr1 PICTURE '!' READ IF dr1 = dr @ 10,10 SAY 'You can change data disks if you want to (BUT ONLY IF THE DATA AND' @ 11,10 SAY 'THE PROGRAM ARE ON DIFFERENT DISKS)' @ 13,10 SAY 'DO YOU WANT TO CHANGE DATA DISKS ?' @ 13,52 GET answer PICTURE '!' READ ENDI dr1 STOR dr1 TO dr POKE 063,(64+@(dr,'ABDCEFGHIJKLMNOPQRSTUVWXYZ')) IF .NOT. FILE ("&newdbf") IF answer = 'Y' COPY STRUCT TO TEMP USE TEMP @ 15,10 SAY 'PUT A FORMATTED DISK IN DRIVE '+dr1+'. HIT ANY KEY WHEN DONE' SET CONSOLE OFF WAIT SET CONSOLE ON RESE COPY TO &dr.:&newdbf USE &dr.:&newdbf DELE FILE TEMP ELSE COPY STRUCT TO &dr.:&newdbf USE &dr.:&newdbf ENDI answer = 'Y' STOR newdbf+'.dbf' TO base RELE answer, dr1, STOR 'T' +TRIM($(base,1,7)) TO tindex STOR 'A' +TRIM($(base,1,7)) TO aindex STOR TRIM($(base,1,8)) TO base RELE add, more, command, newdbf SAVE TO bdata STORE t TO more INDE ON !(title) TO &dr.:&tindex INDE ON !(auth1) TO &dr.:&aindex SET INDEX TO &dr.:&tindex ERAS @ 10,10 SAY 'The first thing you should do is return to the main menu and' @ 11,10 SAY 'then go to ADD records. Until you add a record and index the' @ 12,10 SAY 'file will show a record from the prior data base which can be' @ 13,10 SAY 'quite confusing and can cause problems.' @ 15,30 SAY 'HIT ANY KEY TO CONTINUE' SET CONSOL OFF WAIT SET CONSOL ON ELSE @ 15,10 SAY 'Data base already exists - please return to main menu and try again' @ 17,40 SAY 'HIT ANY KEY TO CONTINUE' SET CONSOL OFF WAIT SET CONSOL ON ENDI CASE (command = 'J' .OR. command = 'Q') STOR f TO more ENDC ENDD RELE ALL STOR t TO first K