home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / manage2.zip / MAINTAIN.PRG next >
Text File  |  1986-05-30  |  13KB  |  425 lines

  1. **    Last revision: May 26, 1986 at 15:15
  2. * maintain.prg
  3. STOR .t. TO more
  4. DO WHIL more
  5.  STOR '?' TO command
  6.  CLEA
  7.  IF clipper
  8.   @ 0,0, 22, 79 BOX frame
  9.   @ 4,1 SAY line1
  10.   @ 19,1 SAY line1
  11.  ELSE
  12.   @ 0,0 TO 4,79
  13.   @ 0,0 TO 19,79
  14.   @ 0,0 TO 22,79 DOUBLE
  15.  ENDI
  16.  @ 20,5 SAY 'Please select one of the above options. You may also leave this menu'
  17.  @ 21,5 SAY "by typing 'Q' and get on-line HELP by typing '?'."
  18.  @ 02,04 SAY dconame + "  -  FILE MAINTENANCE MENU"
  19.  @ 02,65 SAY DTOC(DATE())
  20.  @ 07,24 SAY 'A. Backup data files'
  21.  @ 08,24 SAY 'B. Browse through building file'
  22.  @ 09,24 SAY 'C. Browse through tenant file'
  23.  @ 10,24 SAY 'D. Display building file'
  24.  @ 11,24 SAY 'E. Display tenant file'
  25.  @ 12,24 SAY 'F. First initialization of Property Manager Program'
  26.  @ 13,24 SAY 'G. Change company name or default drive'
  27.  @ 14,24 SAY 'H. Purge building and tenant file'
  28.  @ 15,24 SAY 'I. Re-index the records into all indexes'
  29.  @ 16,24 SAY 'J. Return to main menu'
  30.  @ 18,23 SAY "PLEASE SELECT ONE OF THE OPTIONS"
  31.  @ 18,58 GET command PICTURE '!'
  32.  READ
  33.  DO WHIL AT(COMMAND, 'ABCDEFGHIJ?*Q') = 0
  34.   STOR '?' TO command
  35.   @ 18,58 GET command PICTURE '!'
  36.   READ
  37.  ENDD
  38.  DO CASE
  39.  CASE command = 'A'
  40.   STOR 'Y' TO doit
  41.   CLEA
  42.   @ 01,05 SAY 'This module makes a backup of the DATA Files to another disk'
  43.   @ 03,05 SAY 'Do you want to do a backup of the DATA Files (Y/N) ?'
  44.   @ 03,60 GET doit PICTURE '!'
  45.   READ
  46.   IF doit = 'Y'
  47.    @ 01,00
  48.    @ 03,00
  49.    @ 03,05 SAY 'The left drive is Drive A  - The right drive is Drive B'
  50.    @ 04,05 SAY 'The DATA File is on drive '+dr+' and you normally backup to drive B'
  51.    @ 06,05 SAY 'Make sure the backup disk is in the drive selected for backup'
  52.    STOR 'B' TO bdr
  53.    @ 08,05 SAY 'Which drive selected for backup DATA File ? ' GET bdr PICTURE '!'
  54.    READ
  55.    DO WHIL AT(bdr,'ABCD') = 0
  56.     @ 08,05 SAY 'Which drive selected for backup DATA File ? ' GET bdr PICTURE '!'
  57.     READ
  58.    ENDD while @
  59.    IF bdr <> dr
  60.     @ 10,05 SAY 'Now copying DATA Files from drive '+dr+' to drive '+bdr+ ' '
  61.     SET ECHO ON
  62.     SET TALK ON
  63.     SELE A
  64.     USE &dr.:build INDEX &dr.:code
  65.     COPY TO &bdr.:buildbak
  66.     SELE B
  67.     USE &dr.:tenant INDEX &dr.:codea
  68.     COPY TO &bdr.:tenbak
  69.     SET TALK OFF
  70.     SET ECHO OFF
  71.     SELE A
  72.     USE &dr.:build INDEX &dr.:code
  73.    ELSE
  74.     @ 10,05 SAY "Can't backup to same drive - Aborting"
  75.     @ 12,00 SAY 'Hit RETURN to Continue'
  76.     SET CONSOLE OFF
  77.     WAIT
  78.     SET CONSOLE ON
  79.    ENDI not same drive
  80.   ENDI do backup
  81.   LOOP
  82.  CASE command = 'B'
  83.   IF .NOT. clipper
  84. * browse thru records
  85.    CLEA
  86.    @ 01,12 SAY '***WARNING***  ***WARNING***  ***WARNING***'
  87.    @ 03,13 SAY 'Changes made will be written to the File'
  88.    @ 06,12 SAY 'CTRL-C write current record & go down'
  89.    @ 07,12 SAY 'CTRL-R write current record & go up'
  90.    @ 08,12 SAY 'CTRL-Z/B pans screen left or right'
  91.    @ 09,12 SAY 'CTRL-V toggles Insert on or off'
  92.    @ 10,12 SAY 'CTRL-G Delete character under cursor'
  93.    @ 11,12 SAY 'CTRL-U Delete or Recall current record'
  94.    @ 12,12 SAY "CTRL-Q exit Don't Write Current record"
  95.    @ 13,12 SAY 'CTRL-W exit and Save all changes'
  96. * get a starting point in file
  97.    STOR '  ' TO stletter
  98.    @ 15,12 SAY 'We are using the building code index to browse'
  99.    @ 16,12 SAY '....so please tell me the starting code number'
  100.    @ 17,12 SAY 'or as much of it as you want to.'
  101.    @ 19,12 SAY '           Where shall we start.............'
  102.    @ 19,57 Get stletter PICTURE '99'
  103.    @ 22,00
  104.    READ
  105.    STOR TRIM(stletter) TO stletter
  106. * goto starting point or next if no find
  107.    SEEK stletter
  108.    IF (EOF() .OR. BOF())
  109.     GO top
  110.    ENDI
  111. * browse thru file
  112.    SET ESCAPE OFF
  113.     BROW fields bcode, baddr
  114. * commented out for compile
  115.    SET ESCAPE ON
  116.   ELSE
  117.    CLEAR
  118.    @ 17,24 SAY 'Function not available in Clipper'
  119.    @ 18,23 SAY ' PLEASE HIT ANY KEY TO CONTINUE                    '
  120.    SET CONSOL OFF
  121.    WAIT
  122.    SET CONSOL ON
  123.   ENDI
  124.   LOOP
  125.  CASE command = 'C'
  126.   IF .NOT. clipper
  127.    CLEA
  128.    SELE B
  129.    USE &dr.:tenant INDEX &dr.:codea
  130. * browse thru records
  131.    CLEA
  132.    @ 01,12 SAY '***WARNING***  ***WARNING***  ***WARNING***'
  133.    @ 03,13 SAY 'Changes made will be written to the File'
  134.    @ 06,12 SAY 'CTRL-C write current record & go down'
  135.    @ 07,12 SAY 'CTRL-R write current record & go up'
  136.    @ 08,12 SAY 'CTRL-Z/B pans screen left or right'
  137.    @ 09,12 SAY 'CTRL-V toggles Insert on or off'
  138.    @ 10,12 SAY 'CTRL-G Delete character under cursor'
  139.    @ 11,12 SAY 'CTRL-U Delete or Recall current record'
  140.    @ 12,12 SAY "CTRL-Q exit Don't Write Current record"
  141.    @ 13,12 SAY 'CTRL-W exit and Save all changes'
  142. * get a starting point in file
  143.    STOR '     ' TO stletter
  144.    @ 15,12 SAY 'We are using the building code index to browse'
  145.    @ 16,12 SAY '....so please tell me the starting code number'
  146.    @ 17,12 SAY 'or as much of it as you want to.'
  147.    @ 19,12 SAY '           Where shall we start.............'
  148.    @ 19,57 Get stletter PICTURE '99999'
  149.    @ 22,00
  150.    READ
  151.    STOR TRIM(stletter) TO stletter
  152. * goto starting point or next if no find
  153.    SEEK stletter
  154.    IF (EOF() .OR. BOF())
  155.     GO top
  156.    ENDI
  157. * browse thru file
  158.    SET ESCAPE OFF
  159.     BROW fields bcode, tunit, tenant 
  160. * commented out for compile
  161.    SET ESCAPE ON
  162.    SELE A
  163.    USE &dr.:build INDEX &dr.:code
  164.   ELSE
  165.    CLEAR
  166.    @ 17,24 SAY 'Function not available in Clipper'
  167.    @ 18,23 SAY ' PLEASE HIT ANY KEY TO CONTINUE                    '
  168.    SET CONSOL OFF
  169.    WAIT
  170.    SET CONSOL ON
  171.   ENDI
  172.   LOOP
  173.  CASE command = 'D'
  174.   CLEA
  175.   @ 02,12 SAY 'Records are displayed by code number and you can select the '
  176.   @ 03,12 SAY 'starting code letter or any part of it.  If I do not find that'
  177.   @ 04,12 SAY 'number in the file, I will start at the beginning'
  178.   @ 06,12 SAY 'When WAITING hit space bar to continue... or ESCape to quit'
  179. * get a starting point in file
  180.   STOR '  ' TO stletter
  181.   @ 10,12 SAY 'Place at which to start display'
  182.   @ 10,57 Get stletter PICTURE '99'
  183.   READ
  184.   STOR TRIM(stletter) TO stletter
  185. * goto starting point or next if no find
  186.   SEEK stletter
  187.   IF (EOF() .OR. BOF())
  188.    GO top
  189.   ENDI
  190. * display selected list
  191.   CLEA
  192.   SET ESCAPE OFF
  193.   DISP NEXT 65000 bcode, SUBSTR(bdata,1,38), SUBSTR(baddr,1,20)
  194.   IF EOF()
  195.    WAIT
  196.   ENDI
  197.   SET ESCAPE ON
  198.   LOOP
  199.  CASE command = 'E'
  200.   SELE B
  201.   USE &dr.:tenant INDEX &dr.:codea
  202.   CLEA
  203.   @ 02,12 SAY 'Records are displayed by code number and you can select the '
  204.   @ 03,12 SAY 'starting code letter or any part of it.  If I do not find that'
  205.   @ 04,12 SAY 'number in the file, I will start at the beginning'
  206.   @ 06,12 SAY 'When WAITING hit space bar to continue... or ESCape to quit'
  207. * get a starting point in file
  208.   STOR '     ' TO stletter
  209.   @ 10,12 SAY 'Place at which to start display'
  210.   @ 10,57 Get stletter PICTURE '99999'
  211.   READ
  212.   STOR TRIM(stletter) TO stletter
  213. * goto starting point or next if no find
  214.   SEEK stletter
  215.   IF (EOF() .OR. BOF())
  216.    GO top
  217.   ENDI
  218. * display selected list
  219.   CLEA
  220.   SET ESCAPE OFF
  221.   DISP NEXT 65000 bcode, tunit, ttype, tenant
  222.   IF EOF()
  223.    WAIT
  224.   ENDI
  225.   SET ESCAPE ON
  226.   SELE A
  227.   USE &dr.:build INDEX &dr.:code
  228.   LOOP
  229.  CASE command = 'F'
  230.   CLEA
  231.   STOR 'N' TO option
  232.   TEXT
  233.  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  234.  
  235.         W A R N I N G       W  A  R  N  I N  G       W A R N I N G
  236.         =============       ==================      ==============
  237.  
  238.         This option is designed to create a new data base file to
  239.         startup this program the first time. It will mark for     
  240.         deletion all of the sample files we gave you in the build- 
  241.         ing and tenant databases. Then add your records and come
  242.         back to the maintenance menu to purge. A similar program 
  243.         is found on the Accounting Maintenance menu.
  244.  
  245.         NEVER RUN THIS OPTION UNLESS YOU HAVE BACKED UP THE PROGRAM        
  246.  
  247.  
  248.  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.   ENDT
  256.   @ 19,20 SAY 'ARE YOU READY TO PROCEED'
  257.   @ 19,47 GET option PICTURE '!'
  258.   READ
  259.   IF option = 'Y'
  260.    SELE B
  261.    USE &dr.:tenant
  262.    ZAP
  263.    SELE A
  264.    USE &dr.:build
  265.    SET INDEX TO &dr.:code
  266.    ZAP
  267.   ENDI option = 'Y'
  268.   LOOP
  269.  CASE command = 'G'
  270.   DO init
  271.   LOOP
  272.  CASE command = 'H'
  273.   STOR 'N' TO comman
  274.   CLEA
  275.   @ 02,05 SAY '*****   WARNING!   *****   WARNING!   *****   WARNING!   ****'
  276.   @ 04,05 SAY 'This will PERMANENTLY remove any deleted records.'
  277.   @ 06,05 SAY 'Type Y to continue, any other key to cancel this operation'
  278.   @ 06,64 GET comman PICTURE '!'
  279.   READ
  280.   IF comman = 'Y'
  281.    CLEA
  282. * give the user something to read while file is packed
  283.    TEXT
  284.  
  285. Records which have been marked for deletion are being removed from the file.
  286.  
  287. When that is completed, all records will be reindexed. 
  288.  
  289.                ..........so please be patient.
  290.  
  291.    ENDT
  292. *pack the file to remove deleted records
  293. *but let us know how many records are deleted
  294.    SELE A
  295.    USE &dr.:build
  296.    SET index to &dr.:code
  297.    @ 06,00 SAY 'The building data base contains ' + STR(reccount(),4)+' files before deletions'
  298.    @ 07,00 SAY ' '
  299.    SET TALK ON
  300.    PACK
  301.    SET TALK OFF
  302.    IF .NOT. clipper
  303.     CLEA
  304.    ENDI
  305.    @ 08,00 SAY 'The building data base contains ' + STR(reccount(),4)+' files after deletions'
  306.    SELE B
  307.    USE &dr.:tenant
  308.    SET INDEX TO &dr.:codea
  309.    IF .NOT. clipper
  310.     CLEA
  311.    ENDI
  312.    @ 10,00 SAY 'The tenant data base contains ' + STR(reccount(),4) + ' files before deletions'
  313.    @ 11,00 SAY ' '
  314.    SET TALK ON
  315.    PACK
  316.    SET TALK OFF
  317.    @ 18,00
  318.    @ 18,00 SAY 'The tenant data base contains ' + STR(reccount(),4) + ' files after deletions'
  319.    SELE A
  320.    USE &dr.:build INDEX &dr.:code
  321.    @ 19,00
  322.    @ 20,00
  323.    @ 21,00
  324.    @ 22,00
  325.    @ 21,00 SAY ' *************************************************************************'
  326.    @ 22,20 SAY 'Hit any key to Continue '
  327.    SET CONSOLE OFF
  328.    WAIT
  329.    SET CONSOLE ON
  330.   ENDI comman = Y
  331.   LOOP
  332.  CASE command = 'I'
  333. * re-initialize index files
  334.   CLEA
  335.   @ 2,00 SAY 'We are going to index to all of the indexes.'
  336.   IF .NOT. clipper
  337.    @ 3,00 SAY 'We will keep you posted as we do it.'
  338.   ENDI
  339.   @ 5,00 SAY 'Please be patient as this takes a little time...'
  340.   @ 7,00 SAY 'Records are now being re-indexed'
  341.   SET TALK ON
  342.   SET ECHO ON
  343.   SELE B
  344.   USE &dr.:tenant
  345.   INDE on bcode to &dr.:codea
  346.   SELE A
  347.   USE &dr.:build
  348.   INDE ON bcode TO &dr.:code
  349.   SET INDEX TO &dr.:code
  350.   SET TALK OFF
  351.   SET ECHO OFF
  352.   LOOP
  353.  CASE command = '*'
  354. * backdoor exit
  355.   IF .NOT. clipper
  356.    CLEA all
  357.    CANC
  358.   ENDI
  359.  CASE command = '?'
  360.   CLEA
  361.   TEXT
  362.  
  363.  
  364.        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
  365.  
  366. The maintenance menu allows you to work with both the building and the tenant
  367. databases.   Some of the options on this screen are exceedingly powerful  and
  368. should be used with care.
  369.  
  370. The browse command allows you to examine certain of the data in the files and
  371. make changes directly in the file.  Because of size limitations, you can only
  372. browse in the code, address and type fields in the building database  and  in
  373. the code, unit and tenant name fields in the tenant database.   Browse is not 
  374. available in Clipper.
  375.  
  376. The same type of space limitations apply in the display mode.  However, it is
  377. a simple, non-dangerous (and preferable) way to view multiple records. In the
  378. building mode  I display the code, the units, the type, the acquisition  date
  379. and part of the address. In the tenant mode I display the code, tenant,  type
  380. and tenant name.
  381.  
  382.  
  383.                 Please hit any key to continue........
  384.   ENDT
  385.   SET CONSOLE OFF
  386.   WAIT
  387.   SET CONSOLE ON
  388.   CLEA
  389.   TEXT
  390.  
  391. Purge deleted entries  -  this permanently removes from the file all entries
  392. marked for deletion and then reindexes the file. Use this carefully and only
  393. purge after you have made a backup of the file.
  394.  
  395. Backup data file - I hate to say this -  but computers goof and disks are so
  396. so delicate. ALWAYS ALWAYS ALWAYS never let a week go by without a backup  -
  397. so all you lose is one week (do it every day if you want).  This program can
  398. make an automatic backup of the data to another disk.    There should always   
  399. be another copy of the program and data, but backup is a convenient way for 
  400. an extra copy.
  401.  
  402. Reindex -  this is necessary if you are going to search for a file using the 
  403. search by index command. 
  404.  
  405. The first time initialization option has instructions. Basically, first time
  406. around run it to delete the sample files. The set name option refers to the
  407. name that appears on the top of the menu and on reports. You can change it
  408. anytime. Note, when going from dBASE version to another or from one operating
  409. system to another, you must delete memory variable files. This file is      
  410. MANAGE.DAT. If deleted, the program will reinitialize itself.
  411.  
  412.              Please press any key to return to the menu......... 
  413.   ENDT
  414.   SET CONSOLE OFF
  415.   WAIT
  416.   SET CONSOLE ON
  417.   CLEA
  418.   LOOP
  419.  CASE (command = 'J' .OR. command = 'Q')
  420.   STOR .f. TO more
  421.  ENDC
  422. ENDD while more
  423. RETU
  424. 
  425.