home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / datamage.zip / DOCS.ZIP / INDEXING.DOC < prev    next >
Text File  |  1991-02-09  |  9KB  |  153 lines

  1.                    THE DATAMAGE  file indexing instructions
  2.  
  3.  
  4.  
  5. DATAMAGE,  starting  with V: 3.1, has two indexing schemes.  At your  beck  and
  6. call  are  FILE INDEXES and BINARY indexes.  The FILE indexes are  disk  files.
  7. The BINARY indexes are the ORDER of the records in the current group.  The FILE
  8. indexes  are  used  to find a record or records in the  datafile.   The  BINARY
  9. indexes  can  be  used  to find records but that's not  really  what  they  do.
  10. Searching  a  BINARY index, whether or not a match is found, takes you  to  the
  11. place in the BROWSE display where your entries WOULD be in the current order.
  12.  
  13. FILE INDEXES:
  14.  
  15. The  terms:   FILE  INDEX,  UNIQUE INDEX and CROSS INDEX  are  defined  in  the
  16. glossary of the instructions for the BASE program.  Briefly, a file index is  a
  17. series of numeric values stored in a datafile on disk. These numbers  represent
  18. the    contents   of  the  records  in  segments   defined   during    datafile
  19. installation  as  indexed.  The purpose of a file index is to be able  to  find
  20. records by entering the content of the indexed segment.
  21.  
  22. An indexed datafile is provided as a sample.  It is in the sub-directory of the
  23. sample  datafile disk called CUSTOMER.  This datafile also illustrates the  use
  24. of  the  POWRMAIL  program,  and contains the  names,  titles,  company  names,
  25. addresses etc. of several concerns involved in the distribution of software for
  26. the  P.C.   Start  the BASE program, and access this  datafile  in  the  normal
  27. manner.
  28.  
  29. As  always,  press F4 to make a map of the file.  As you can see, four  of  the
  30. data  segments  comprising  this file are indexed.  Segment  8  is  indexed  as
  31. unique,  and  segments 1, 2, and 3 are cross-indexed.  Now, print  all  records
  32. using  the I/O group.  You want to place segments 1, 2, 3, and 8 in  the  group
  33. before  starting the printout.  Or, select alpha, target #3, title,  and  enter
  34. president as your search string.  You'll still print enough records to test the
  35. indexing.
  36.  
  37. To  access  the find a record sub-routine press F5.  After  giving  a  positive
  38. response  to  the dialog box opt to search the unique index on  segment  eight,
  39. phone  number.   Now, enter the phone number of any record on  your  list.   Be
  40. certain that it is exactly correct before pressing return.  The record will  be
  41. found  quickly, and displayed in the usual manner.  After you exit  the  record
  42. display/update function the dialog box will ask you if that was the record  you
  43. wanted to see, or if you would like to continue the search.
  44.  
  45. Now try the F5 routine again.  This time, use the index created for segment  3,
  46. As a search value, enter PRESIDENT.
  47.  
  48. The  records that contain PRESIDENT in segment 3 will be displayed,  one  after
  49. another.   After  each record you will be asked to select this  record,  or  to
  50. continue the search.  Opt to continue the search until it is completed.   Then,
  51. press 1 for a re-try.  Finally, opt to search the cross index.
  52.  
  53. You  may  choose to search any or all indexed fields to find a record,  in  any
  54. combination you choose.
  55.  
  56. Now,  use your listing and select records in all available manners,  until  you
  57. are  familiar with the indexing process.  Although we have made this a  simple,
  58. menu-driven process, it is still quite difficult to comprehend for those new to
  59. datafile operation.
  60.  
  61.  
  62. DATABASE DESIGN CONSIDERATIONS:
  63.  
  64.  
  65. When  designing  a  user-installed  datafile to  include  indexing,  many  more
  66. considerations  must be made before declaring a segment as indexed.  Using  the
  67. sample  as  an example, suppose we might have two people in the  same  company,
  68. with  the  same phone number, in the file.  When we went to  enter  the  second
  69. record containing the same phone number the unique index would be checked,  and
  70. the record entry process would be aborted, due to the duplication, which is not
  71. allowed in a segment defined as unique.
  72.  
  73. Try  it.  From the main menu, opt for record entry.  Enter garbage in  segments
  74. 1, 2, and three.  When you get to segment 8, try a phone number that appears in
  75. one of the records on your listing.  The program refuses to write the record to
  76. disk.   The same thing will happen if you attempt to update an existing  record
  77. to  contain  a  phone number already present in another record.   This  can  be
  78. irritating, but will make sure that no duplicates are entered.
  79.  
  80. The  indexed  segments are treated differently by the other programs  as  well.
  81. The  BASE  program will refuse to write a code into the survivor group  if  the
  82. target  segment is declared as indexed.
  83.  
  84. POWER  COPY will not change records in an indexed datafile if the target  field
  85. is indexed.  Of course, POWER COPY will move data into a file that is  indexed,
  86. and will move data into indexed fields in records created during the inter-file
  87. update.  These new records will be checked for index violations, and aborted if
  88. a duplication is found.
  89.  
  90. The indexing sub-routines ignore cases and spaces.  In other words, the values:
  91. "ABC",  "abc"  and "A  B  C" all produce the same index value,  and  would  all
  92. produce a match for each other.  So, if you fail to capitalize a letter in your
  93. search  value,  or embed the wrong number of spaces between the  words  of  the
  94. search value, the record will be found if you opt to ignore spacing.
  95.  
  96. Also ignored by the indexes are case and all characters not in the sets:   A-Z,
  97. a-z  and 0-9.  So, opting to ignore case/spacing in a search, and entering  KA-
  98. BOOM CHEMICALS INC will find a record containing KABOOM CHEMICALS, INC.
  99.  
  100. The  indexing does not work like a string sort; you must enter every  character
  101. of your search value.  Searching for "JONES" will not produce a match for every
  102. record containing the search string; only those containing the word "jones" (in
  103. either or mixed case) and nothing else.
  104.  
  105. If you opt to use indexing to accomplish record selection, train your operators
  106. well,  and  put  some  time and THOUGHT into your  indexing  scheme.   Try  and
  107. consider  worst-case  scenarios and find ways around them before  defining  and
  108. installing the datafile.
  109.  
  110. When backing up a datafile it is not necessary to backup the file FILEINDX.RAD.
  111. You  will  save disk space by not doing so.  If it is necessary to  access  the
  112. historic  datafile,  place  the  files on an empty disk,  and  start  the  BASE
  113. program.  The index will be automatically computed and written on the disk.
  114.  
  115. BINARY INDEXES:
  116.  
  117. As  stated  above,  the BINARY INDEXES are based upon the ORDER  of  the  file.
  118. There's  two ways, I suppose, to get your records into order.  One is to  enter
  119. them  that way in the first place.  That won't last long unless it's  a  static
  120. file.  New records happen, old ones croak, it gets out of order soon.
  121.  
  122. So  DATAMAGE  offers some VERY elaborate sorting capabilities.   Some  programs
  123. have  a "MAKE INDEX" option, DATAMAGE has a sort routine.  The product of  that
  124. routine is an order.  The order is the index.  And searching a BINARY index  is
  125. to  find a place in the current order, as opposed to examining the  records  to
  126. find a match for the search value.
  127.  
  128. The  BINARY INDEX feature of DATAMAGE allows for "shoot from the hip"  indexing
  129. of any file based on the user-assigned record numbers, the content of a counter
  130. field, or up to eight levels of disk data.  The BINARY INDEX feature is  almost
  131. totally  automatic  in that it will update an active BINARY  index  in  MEMORY.
  132. But, since DATAMAGE requires no associated disk file, it does not automatically
  133. update MARKERS kept for the purpose of recording BINARY indexes.
  134.  
  135. In larger files the time required to sort the records makes the maintenance  of
  136. a  disk  file  to  keep the order between  runs  attractive.   This  is  easily
  137. accomplished, please read MAIN.DOC under the F-10 heading or the on-screen help
  138. for the MARKER FILE function.
  139.  
  140. The  BINARY indexes offer a facility not found in the FILE indexes:   They  can
  141. find  a  record  that's  not there.  If your entries  into  the  BINARY  search
  142. function find no match you will go to the place in the file where they WOULD be
  143. in  the  current  order.   The BINARY SEARCH is so  often  used  simply  to  go
  144. somewhere in the BROWSE display that it does not enunciate a no-match.
  145.  
  146. After  doing  a BINARY search you go to the place in the BROWSE where  a  match
  147. would  be.  The "top" two sort criterion are on the BROWSE screen, and a  touch
  148. of  the return key displays the record.  It should be easy to determine if  you
  149. found a match.  If it beeped and displayed an error message on a no-match  this
  150. would,  no doubt, prove quite irritating when using the search to move  in  the
  151. BROWSE display to a place in the current order.
  152.  
  153.