home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / moss.zip / MOSS.PRG < prev    next >
Text File  |  1986-11-09  |  3KB  |  145 lines

  1. * PROGRAM BY ROBERT MOSS
  2. * CIS ID#73717,47
  3. * This program is a utility to make handling a database user-friendly.
  4. * It allows you to search any database on a large number of fields;
  5. *  set a filter on the basis of a complex criterion;
  6. *  Index on any field;
  7. *  backup your database;
  8. *  add, delete, view, and change records;
  9. *  browse the database, and
  10. *  pack the database.
  11. *
  12. *  The program will work on ANY database.  The only restrictions are:
  13. *   - The FIRST field must be a text field.  Searches will be faster 
  14. *     if this field is the key field for an index.
  15. *   - In order to SELECT a subset of records, the database must contain 
  16. *     a logical field called MARK.
  17.  
  18.  
  19. public dab,filt,cl,cc,COND,con1,con2,con3,con4,con5,con6,con7,con8,con9,con10,con11,con12,con13,con14,con15,con16,con17,con18,con19
  20. public filt,indx
  21. filt=" ALL "
  22. clear
  23. dab=space(8)
  24. do set
  25. * SET chooses the database.
  26.  
  27. yn=" "
  28. don=0
  29. now=dtoc(date())
  30. do while .t.
  31. store 1 to start
  32. set delete on
  33. do while start=1
  34. start=0
  35. select 1
  36. go top
  37. clear
  38. SET TALK OFF
  39. enddo
  40. DO WHILE start=0
  41. clear
  42. set color to W+
  43. @2,10 SAY "  DATABASE UTILITY PROGRAMS:  Current Database:" +upper(dab)
  44. f1=field(1)
  45. @3,20 say "  Current record: "+&f1
  46. SET COLOR TO 
  47. @1,0 to 5,75 double
  48. SET COLOR TO W,/W
  49. if LEFT(FILT,1)="S"
  50. @4,20 say "USING SELECTED RECORDS ONLY"
  51. SET TALK OFF
  52. set filter to &cond
  53. go top
  54. ENDIF
  55. @6,5 SAY cdow(date())+", "+cmonth(date())+" "+str(day(date()),2)+", "+str(year(date()),4)+"; "+ str(recCOUNT(),4)+" records in database."
  56. SEL=" "
  57. set talk off
  58. @8,2 say "0. SWITCH to another database"
  59. @9,2 say "1. FIND a record"
  60. @10,2 SAY "2. ADD a record to the list"
  61. @11,2 SAY "3. DELETE this record "
  62. @12,2 SAY "4. VIEW/CHANGE current record"
  63. @13,2 say "5. SELECT records "
  64.  
  65. @18,42 say "C. Copy data onto floppy disks"                                            
  66. @19,42 say "Q. QUIT DBASE"
  67.  
  68. @8,42 say "A. reset to All records" 
  69. @9,42 SAY "B. Browse customer records"
  70. @10,42 say "I. Index records (temporarily)"
  71. @13,42 say "N. Go to Next record number"
  72. @15,42 say "P. PACK database to recover space"
  73. @7,0 TO 17,40 DOUBLE
  74. @7,40 TO 17,79 DOUBLE
  75. @17,0 TO 23,40 DOUBLE
  76. @17,40 TO 23,79 DOUBLE
  77.  
  78. sel=" "
  79. clear gets
  80. @ 24,8 SAY "Input your selection:" get sel PICTURE "!"
  81. read
  82. clear
  83. do case
  84. case sel="0"
  85.  do set
  86. case sel="P"
  87. clear
  88. set talk on
  89. pack
  90. go top
  91. set talk off
  92. case UPPER(SEL)="C"
  93. clear
  94. dr="A"
  95. @ 2,2 say "Copy to which drive ?" get dr picture "!"
  96.  read
  97. @ 3,2 say "Insert diskette in drive "+dr
  98. wait
  99. use
  100. dr=dr+":"
  101. dabf=trim(dab)+".d*"
  102. indxf=trim(indx)+".ndx"
  103. run copy &dabf &dr
  104. if len(trim(indx))>0
  105.  run copy &indxf &dr
  106. use &dab index &indx
  107. else
  108. use &dab
  109. endif
  110.  
  111. case upper(sel)="I"
  112.   DO indf
  113. case sel="Q"
  114. ?"Have a nice day!!"
  115. quit
  116. case sel="2"
  117. APPEND 
  118. case sel="3"
  119.  clear
  120.  ?"You wish to delete "+&f1+",  Correct (Y/N)?"
  121.  wait to yn
  122.  if upper(yn)="Y"
  123.  delete
  124.  skip
  125.  endif
  126. case sel$"14N"
  127.  if sel="1"
  128.   do find
  129. ex=.f.
  130.  endif
  131.  if sel="N"
  132.    skip
  133.  endif
  134.  CLEAR
  135. yn=" "
  136.  edit 
  137. case sel="5"
  138.  do report
  139. case upper(sel)="A"
  140.  set filter to  
  141. case upper(sel)="B"
  142.  browse noappend lock 1
  143. endcase
  144. enddo
  145. enddo