home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol025 / database.doc < prev    next >
Text File  |  1985-02-09  |  33KB  |  547 lines

  1. (************************************************************)
  2. :
  3. :    A gentlemen down south was kind enough to send me this
  4. :  copy of Dr Bowles database seed.  It was in UCSD format
  5. :  so I had to spend several days in cleaning it up.  But 
  6. :  its done now so I am passing this program on to those who
  7. :  may be interested.  The units are still in UCSD BUT by putting
  8. :  them in circulation among the membership of Pascal/Z
  9. :  we'll chip away at it until we have it converted and
  10. :  boy! won't that be a program.
  11. :
  12. ************************************************************)
  13.  
  14.  
  15.  
  16.                    {EE&CS 63 Database Homework Project}
  17. 12 February, 1980
  18. K.L.Bowles
  19.      
  20.      AssigneΣá homeworδá fo≥ thσ remainde≥ oµá thσá quarte≥á wil∞ ì
  21. consis⌠áá oµáá carryinτá ou⌠áá one¼áá two¼áá o≥áá threσáá prograφ ì
  22. design/implementatioε project≤ dependinτ upoε whethe≥ yo⌡ plaε t∩ ì
  23. earε ß coursσ gradσ of'C'¼á 'B'¼á or'Aº respectively«á Al∞ oµ thσ ì
  24. project≤á wil∞á involvσá makinτ change≤ iε ß starte≥á prograφá oµ ì
  25. mediuφ complexity«á Thσ starte≥ prograφ i≤ ß partiall∙á completeΣ ì
  26. databasσ manager¼ thσ desigε oµ whicΦ ha≤ beeε discusseΣ iε EE&C╙ ì
  27. 6│ lecture≤ fo≥ thσ las⌠ week¼ anΣ wil∞ bσ thσ principa∞ topiπ oµ ì
  28. the remaininτ lecture≤ for the course.
  29.                           1. {Objectives}
  30.      Practica∞ usσ oµ database≤ typicall∙ require≤ morσ extensivσ ì
  31. programminτá thaε caε reasonabl∙ bσ requireΣ fo≥ homeworδ froφá ß ì
  32. clas≤á a⌠á thσ leve∞ oµ EE&C╙á 63«á Nevertheless¼á onσá importan⌠ ì
  33. objectivσá oµá thσ coursσ i≤ t∩ preparσ student≤ fo≥ thσ kinΣá oµ ì
  34. workinτ environmen⌠ the∙ ma∙ encounte≥ upoε takinτ job≤ a≤á (non-ì
  35. numerical⌐áá programmer≤á afte≥á leavinτá UCSD«áá Worδá witΦá thσ ì
  36. databasσá starte≥ prograφ provideΣ witΦ thi≤ coursσ wil∞ hel≡á t∩ ì
  37. prepare you in several ways:
  38.  
  39.  a⌐ Thσ bes⌠ wa∙ t∩ develo≡ ß largσ prograφ i≤ t∩ proceeΣ iε eas∙ ì
  40. stages¼á addinτ facilitie≤ anΣ debugginτ theφ a⌠ eacΦ stage« Thi≤ ì
  41. methoΣá i≤á ofteεá calleΣá "step-wisσá refinement"«á Thσá starte≥ ì
  42. prograφ wil∞ givσ yo⌡ ß realistiπ basσ froφ whicΦ t∩ star⌠á work¼ ì
  43. anΣá wil∞ allo≈ gettinτ significan⌠ result≤ withou⌠ goinτ througΦ ì
  44. thσ morσ difficul⌠ firs⌠ ste≡ oµ establishinτ thσ overal∞á desigε ì
  45. of an eventual program system.
  46.  b⌐ Iε workinτ witΦ largσ programs¼ thσ stylσ useΣ iε writinτ thσ ì
  47. program≤á become≤á increasingl∙ important«á Thσ stylσ issue≤á arσ ì
  48. difficul⌠á t∩ teacΦ usinτ shor⌠ quizze≤ anΣ homeworδá assignment≤ ì
  49. a≤ iε EE&C╙ 61« Yo⌡ shoulΣ spenΣ enougΦ timσ readinτ anΣ studyinτ ì
  50. thσá starte≥á program¼á anΣá associateΣá librarie≤á oµá routines¼ ì
  51. provideΣá t∩ yo⌡ tha⌠ yo⌡ havσ ß gooΣ understandinτ oµá ho≈á the∙ ì
  52. work«á A≤ yo⌡ d∩ this¼ noticσ thσ treatmen⌠ giveε t∩ stylσ issue≤ ì
  53. sucΦá a≤á indentatioε (a≤ ß substitutσ fo≥á structurσá diagrams)¼ ì
  54. relativσá brevit∙ oµ procedure≤ anΣ functions¼á usσ oµ CONS╘á anΣ ì
  55. TYP┼ declarations¼á anΣ handlinτ oµ erro≥ conditions« ExperienceΣ ìèprogrammer≤á ofteε learε morσ abou⌠ ho≈ t∩ usσ ß ne≈á programminτ ì
  56. languagσá o≥ compute≥ systeφ froφ readinτ largσ program≤á writteε ì
  57. b∙á other≤á thaεá froφá extensivσá amount≤á oµá writteεá tex⌠á o≥ ì
  58. lectures.
  59.  c⌐á ┴ databasσ prograφ i≤ generall∙ useΣ ove≥ aε extendeΣ perioΣ ì
  60. oµá time¼á anΣá usuall∙á evolve≤á froφá it≤á initia∞á performancσ ì
  61. specification≤ int∩ ß changeΣ o≥ expandeΣ wholσ a≤ timσ goe≤á on« ì
  62. Iεá man∙á cases¼á thσ initia∞ prograφ i≤ largσ enougΦ t∩á requirσ ì
  63. severa∞ programmer≤ t∩ bσ employeΣ t∩ completσ separatσ part≤á oµ ì
  64. thσ program« Fo≥ botΦ oµ thesσ reasons¼ i⌠ i≤ ver∙ importan⌠ tha⌠ ì
  65. method≤ bσ useΣ t∩ simplif∙ thσ problem≤ oµ ß programme≥ assigneΣ ì
  66. t∩á modif∙ o≥ {maintain² ß prograφ previousl∙ createΣ b∙á others« ì
  67. Thi≤á require≤ tha⌠ gooΣ specificatioε anΣ maintenancσá document≤ ì
  68. bσá writteε t∩ g∩ witΦ thσ program¼á anΣ tha⌠ ß reasonablσ numbe≥ ì
  69. oµá comment≤ bσ embeddeΣ iε thσ prograφ t∩ assis⌠ onσá programme≥ ì
  70. t∩ reaΣ anΣ understanΣ thσ worδ oµ another«á Worδ witΦ thσá EE&C╙ ì
  71. 6│á databasσá prograφá b∙ thσ clas≤ wil∞ requirσá tha⌠á differen⌠ ì
  72. team≤á oµá student≤á exchangσ documentatioεá anΣá program≤á whicΦ ì
  73. refinσ thσ starte≥ prograφ iε differinτ ways« Thi≤ shoulΣ providσ ì
  74. ß moderatel∙ realistiπ simulatioε oµ thσ rea∞ worlΣ oµ worδá witΦ ì
  75. large programs outside the University. 
  76.                
  77.                          {Organization}
  78.  
  79.      Thσ complexit∙ oµ thσ worδ needeΣ t∩ completσ thσ desigε anΣ ì
  80. implementatioεá iεá an∙á oµá thσ topiπ area≤á describeΣá herσá i≤ ì
  81. to∩á greaa⌠ t∩ expec⌠ an∙ homeworδ teaφ iε EE&C╙ 6│ t∩ carr∙á thσ ì
  82. worδ iε ß topiπ areß t∩ completion«á However¼ i⌠ wil∞ bσ possiblσ ì
  83. t∩á makσá significan⌠á performancσ improvement≤á iεá thσá prograφ ì
  84. withiεá roughl∙ thσ amoun⌠ oµ timσ ß teaφ shoulΣ expec⌠ t∩á spenΣ ì
  85. on homework in a two-week period.
  86.      Thσá methoΣ oµ operatioε wil∞ requirσ tha⌠ ßá homeworδá teaφ ì
  87. writσ specification≤ oε ß proposeΣ changσ t∩ thσ starte≥ program« ì
  88. Thesσá specification≤á wil∞á bσá discusseΣá witΦá Prof«áá Bowles¼ ì
  89. RicharΣá Kaufmann¼á o≥á iεá somσ case≤á witΦá ßá proctor¼á beforσ ì
  90. proceedinτá t∩á writσ anΣ debuτ thσ prograφá change≤á themselves« ì
  91. Student≤ wh∩ carr∙ ou⌠ thσ programminτ change≤ beforσ writinτ thσ ì
  92. specification≤á shoulΣá bσ awarσ tha⌠ thosσ change≤ wil∞ onl∙á bσ ì
  93. regardeΣá a≤á experimenta∞á anΣá onl∙á usefu∞á fo≥á writinτáá thσ ì
  94. specificcation«á Iεá general¼á thσ specification≤ wil∞ havσ t∩ bσ ì
  95. approveΣ first¼á a≤ thσ firs⌠ ste≡ iε completinτ ß homeworδá set« ì
  96. Yo⌡á shoulΣ expec⌠ t∩ bσ requesteΣ t∩ changσ you≥á specification≤ ì
  97. iεá significan⌠ way≤ beforσ proceedinτ t∩ implemen⌠ you≥á prograφ ì
  98. changes«á Thu≤á i⌠á i≤ possiblσ tha⌠ prograφ change≤ madσ iεá thσ ì
  99. coursσá oµá decidinτ ho≈ t∩ writσ thσ specification≤á wil∞á servσ ì
  100. onl∙á a≤á ß learninτ experience¼á anΣ ma∙ no⌠á bσá acceptablσá iε ì
  101. completion of a homework set. 
  102.      EacΦá se⌠á oµá specification≤ shoulΣ contaiεá a⌠á leas⌠á thσ ì
  103. following parts:
  104. a⌐á ┴á statemen⌠á oµá thσá objective≤ oµ thσá worδá yo⌡á plaεá t∩ ì
  105. undertake.
  106. b⌐á ┴á statemen⌠ oµ thσ methoΣ yo⌡ plaε t∩ usσ iεá reachinτá you≥ ì
  107. objectives«á ┴ diagraφ o≥ tw∩ ma∙ provσ usefu∞ iε explaininτ you≥ ì
  108. method.
  109. c⌐á ┴ rougΦ descriptioε oµ thσ addition≤ o≥ change≤ yo⌡á plaεá t∩ ìèmakσá t∩á thσá starte≥ program«á Thi≤ ma∙á includσá heading≤á anΣ ì
  110. paramete≥ declaration≤ oµ somσ oµ thσ procedure≤ and/o≥ function≤ ì
  111. yo⌡áá proposσá t∩á use«áá I⌠á woulΣá typicall∙á includσá ßá brieµ ì
  112. descriptioεá oµ thσ rolσ eacΦ importan⌠ procedurσ o≥ functioεá i≤ ì
  113. expected to play.
  114. d⌐á ┴á listinτ oµ thσ parameter≤ yo⌡ expec⌠ t∩á use¼á alonτá witΦ ì
  115. maximuφá anΣ minimuφ value≤ o≥ othe≥ statemen⌠ oµ thσ specia∞á o≥ ì
  116. limiting values each parameter may take on.
  117. e⌐á ┴ statemen⌠ oµ ho≈ yo⌡ plaε t∩ tes⌠ you≥ prograφá change≤á t∩ ì
  118. verif∙á tha⌠á the∙á iε fac⌠ operatσ a≤ planneΣ oncσá writteεá anΣ ì
  119. compiled«á Fo≥á thσ typica∞ homeworδ problem¼á thσ lengtΦ oµá thσ ì
  120. specification≤ ma∙ ruε froφ onσ t∩ abou⌠ threσ pages«á T∩ havσá ß ì
  121. se⌠ oµ specification≤ accepteΣ fo≥ gradinτ purposes¼á bσ prepareΣ ì
  122. t∩ defenΣ thσ desigε choice≤ yo⌡ proposσ t∩ use« EacΦ membe≥ oµ ß ì
  123. homeworδá teaφ mus⌠ bσ familia≥ witΦ al∞ aspect≤ oµ thσ worδ tha⌠ ì
  124. thσá teaφá propose≤ t∩ takσ on«á Iµ yo⌡ spli⌠ u≡ thσ worδá t∩á bσ ì
  125. handleΣ separatel∙ b∙ differen⌠ teaφ members¼á yo⌡ shoulΣá defenΣ ì
  126. you≥á owεá worδ t∩ thσ othe≥ teaφ member≤ beforσ submittinτá you≥ ì
  127. worδá fo≥á forma∞ acceptance«á Otherwisσ therσ i≤ n∩á purposσá iε ì
  128. workinτá a≤ ß team¼á anΣ yo⌡ shoulΣ bσ defendinτ you≥á individua∞ ì
  129. worδ separatel∙ fo≥ grading« Fo≥ forma∞ grading¼ neatnes≤ wil∞ bσ ì
  130. importan⌠á (bu⌠á yo⌡ don'⌠ neeΣ t∩ ge⌠ carrieΣ awa∙ anΣá spenΣá ß ì
  131. largσá par⌠ oµ you≥ timσ jus⌠ iε makinτ you≥ worδ neat)«á Iµá thσ ì
  132. writteε specificatioε i≤ aε unreadablσ mess¼ yo⌡ wil∞ bσ askeΣ t∩ ì
  133. re-d∩á i⌠á beforσá i⌠ caε bσ considereΣá fo≥á acceptance«á T∩á bσ ì
  134. accepteΣá fo≥ gradinτ purposes¼á eacΦ specificatioεá documen⌠á o≥ ì
  135. prograφá submitteΣá mus⌠á contaiε thσ name≤ oµá al∞á person≤á wh∩ ì
  136. workeΣá oεá it¼á anΣ thσ approximatσ datσ oε whicΦ thσá worδá wa≤ ì
  137. carrieΣ out« Iε programs¼ thesσ shoulΣ bσ iε thσ forφ oµ comment≤ ì
  138. a⌠á thσá heaΣ oµ ß listing¼á o≥ iε standardizeΣ initial≤ sucΦá a≤ ì
  139. (*KLB*⌐á embeddeΣá iεá ß prograφá wherσá yo⌡á makσá changes«á Thσ ì
  140. initial≤á caεá bσ useΣ witΦ thσ Editor'≤ F(inΣ commanΣ t∩á locatσ ì
  141. changes made by each of several individuals. 
  142.  
  143.           {General Description of the Starter Program}
  144.  
  145.      Thσá packagσ oµ prograφ listing≤ passeΣ ou⌠ t∩ thσ clas≤á oε ì
  146. 1▒ February contains four sections, as follows:
  147. a) Program DBTEST - pages 1 .. 4
  148. b) Unit DBUNIT - begins on page 5
  149. c) Unit SCUNIT - begins on page 41
  150. d) Unit STARTER - begins on page 46
  151.      Al∞á threσ unit≤ arσ useΣ b∙ thσ DBTES╘ program¼á whicΦá ha≤ ì
  152. onl∙á ßá maiε prograφ bod∙ runninτ froφ linσ 21╡ t∩ linσá 23┤á oε ì
  153. pagσ 4«á Thσ USE╙ statemen⌠ oε linσ 21│ oµ thσ listinτ occur≤á iε ì
  154. thσá prograφá sourcσ filσ immediatel∙ afte≥ thσá PROGRA═á headinτ ì
  155. linσ (linσ │ iε thσ listing)« Al∞ oµ thσ interveninτ line≤ iε thσ ì
  156. DBTES╘ listinτ arσ froφ thσ INTERFAC┼ part≤ oµ thσ unit≤ nameΣ iε ì
  157. thσá USE╙á statement.Iεá UCS─ Pascal¼á ß Uni⌠ ha≤á thσá followinτ ì
  158. form:
  159. UNIT XYZ;
  160. INTERFACE
  161. CONST
  162. ...
  163. TYPE
  164. ...
  165. VARè...
  166. PROCEDURE & FUNCTION headings
  167. IMPLEMENTATION
  168. CONST
  169. ...
  170. TYPE
  171. ...
  172. VAR
  173. ...
  174. PROCEDURE & FUNCTION declarations
  175.  
  176.      Al∞ oµ thσ declareΣ object≤ arσ simila≥ iε purposσ t∩á thosσ ì
  177. iε aε ordinar∙ Pasca∞ program«á Object≤ declareΣ iε thσ INTERFAC┼ ì
  178. par⌠ arσ intendeΣ t∩ bσ useΣ b∙ program≤ o≥ othe≥ unit≤ whicΦ usσ ì
  179. thσá Uni⌠ XY┌ (o≥ whateve≥ namσ yo⌡ choose)«á Object≤ declareΣ iε ì
  180. thσá IMPLEMENTATIO╬á par⌠ generall∙ ma∙ no⌠ bσ useΣá directl∙á b∙ ì
  181. usinτá prograφá o≥á units«á Howeve≥ thσá procedurσá anΣá functioε ì
  182. heading≤ iε thσ INTERFAC┼ par⌠ servσ a≤ thσ equivalen⌠ oµ FORWAR─ ì
  183. declaration≤áá matcheΣáá b∙á completeΣá procedurσáá o≥áá functioε ì
  184. declaration≤ iε thσ IMPLEMENTATIO╬ part« Procedure≤ anΣ function≤ ì
  185. declareΣá onl∙ iε thσ IMPLEMENTATIO╬ par⌠ ma∙ bσ calleΣá onl∙á b∙ ì
  186. other procedures and functions, not by a using program.
  187.      Thσá prograφá listinτ fo≥ thσ DBTES╘ prograφ duplicate≤á thσ ì
  188. INTERFAC┼ part≤ oµ al∞ threσ oµ thσ Unit≤ tha⌠ i⌠ uses«á Line≤á ╡ ì
  189. througΦá 12╢ arσ thσ interfacσ fo≥ thσ DBUNIT¼á line≤ 13░ througΦ ì
  190. 14╖á arσ fo≥ thσ SCUNIT¼á anΣ line≤ 15░ througΦ 21▓ arσá fo≥á thσ ì
  191. STARTE╥á unit«á Thσá STARTE╥á uni⌠ encompasse≤ thσá bulδá oµá thσ ì
  192. origina∞ conten⌠ oµ thσ DBTES╘ prograφ itself¼á anΣ i⌠ represent≤ ì
  193. onl∙á aε approximatioε t∩ thσ librar∙ oµ primitivσ routine≤á tha⌠ ì
  194. migh⌠á bσ useΣ fo≥ ß full∙ developeΣ databasσ system«á B∙ placinτ ì
  195. functioninτ part≤ oµ thσ DBTES╘ prograφ iε thσ STARTE╥á unit¼á i⌠ ì
  196. ha≤á beeεá possiblσá t∩á reducσ thσ sizσá oµá ßá typica∞á prograφ ì
  197. compilattioεá fo≥á thσá clas≤ t∩ ß smal∞ anΣá readil∙á manageablσ ì
  198. size.A≤á ma∙ bσ seeε froφ line≤ 21╡ througΦ 23┤ oεá pagσá 4¼á thσ ì
  199. DBTES╘á prograφ i≤ basicall∙ quitσ simple«á First¼á thσ procedurσ ì
  200. STINITIALIZ┼ i≤ called«á Detail≤ oε STINITIALIZ┼ ma∙ bσ founΣá iε ì
  201. thσá listinτ fo≥ thσ STARTE╥ uni⌠ oε pagσ 48¼á line≤ 27╢á througΦ ì
  202. 305«á Fo≥ mos⌠ purposes¼á thσ procedurσ operate≤ jus⌠ a≤ i⌠ woulΣ ì
  203. havσá haΣ i⌠ beeε haΣ i⌠ beeε declareΣ iε ful∞ withiε thσá DBTES╘ ì
  204. program«á Continuinτ iε DBTES╘ (pagσ 4)¼ thσ prograφ loop≤ iε thσ ì
  205. REPEA╘á statemen⌠ unti∞ DON┼ i≤ set«á DON┼ i≤ ß Booleaεá variablσ ì
  206. declareΣ iε thσ INTERFAC┼ par⌠ oµ STARTER¼ a≤ ma∙ bσ seeε a⌠ linσ ì
  207. 19▓ oε pagσ 4¼á o≥ linσ 19▓ oε pagσ 46«á GOTOX┘ (linσ 21╕ oε pagσ ì
  208. 4⌐ i≤ ß built-iε procedurσ provideΣ b∙ thσ UCS─ Pasca∞ system« I⌠ ì
  209. cause≤ thσ curso≥ t∩ jum≡ t∩ thσ (column¼ row⌐ locatioε indicateΣ ì
  210. b∙á thσá paramete≥á expression≤á (typσá Integer)«á Thσá function≤ ì
  211. GETCOMMAN─á anΣ CHANGEREC¼á anΣ thσ procedure≤ SAVEREC¼á FINDREC¼ ì
  212. GETREC¼á anΣá NEWRE├ arσ al∞ declareΣ iε thσá STARTE╥á unit«á Thσ ì
  213. procedurσá DBSHOWER╥ i≤ declareΣ iε thσ DBUNIT«á Iε general¼á yo⌡ ì
  214. caεá identif∙á routine≤á declareΣ iε thσá databasσá suppor⌠á uni⌠ ì
  215. DBUNI╘ b∙ thσ prefi° "DB"¼á anΣ thosσ iε thσ screeε contro∞á uni⌠ ì
  216. SCUNI╘ b∙ thσ prefix "SC". 
  217.      Fo≥á lacδ oµ time¼á i⌠ wil∞ no⌠ bσ possiblσ t∩ distributσá ß ì
  218. ful∞á se⌠ oµ writteε description≤ oµ thσ routine≤ iε thσ program≤ ì
  219. distributed«á Whilσá i⌠á wa≤ planneΣ t∩ providσ yo⌡ witΦá ßá morσ ì
  220. comprehensivσá writteε description¼á thσ leve∞á oµá documentatioε ì
  221. provideΣá herσ i≤ probabl∙ typica∞ oµ documentatioε yo⌡ ma∙á havσ ì
  222. t∩á copσ witΦ iε rea∞ worlΣ programminτ assignments«á Iε general¼ ì
  223. mos⌠á importan⌠á routine≤á havσ brieµ comment≤ oεá wha⌠á the∙á d∩ ìèimmediatel∙ followinτ theΘ headinτ lines«á Virtuall∙ al∞ routine≤ ì
  224. havσ beeε giveε name≤ whicΦ directl∙ sugges⌠ wha⌠ the∙ do«á Afte≥ ì
  225. ß brieµ descriptioε oµ thσ datß structurσ useΣ b∙ thσ system¼á wσ ì
  226. wil∞ walδ yo⌡ througΦ onσ oµ thσ STARTE╥ procedure≤ t∩ assis⌠á iε ì
  227. readinτ thσ programs. 
  228.  
  229.  
  230.           {The Data Structure and DataBase Support Module DBUNIT}
  231.  
  232.      Thσá genera∞ concep⌠ oµ softwarσ tool≤ i≤ describeΣá briefl∙ ì
  233. iεá thσ Beginner≤ Manua∞ fo≥ thσ UCS─ Pasca∞ System¼á chapte≥á 9« ì
  234. DBUNI╘á ha≤ beeε designeΣ witΦ thσ inten⌠ t∩ providσ ß librar∙ oµ ì
  235. primitivσá softwarσá tool≤ t∩ simplif∙ writinτá databasσá handle≥ ì
  236. program≤á fo≥á ßá variet∙ oµá purposes«á Thσá datßá structurσá i≤ ì
  237. intendeΣá t∩á overcomσ tw∩ bothersomσ limitation≤ oµá thσá Pasca∞ ì
  238. language¼áá anΣá typica∞á smal∞á operatinτá systems¼áá fo≥á thesσ ì
  239. purposes:
  240. a⌐á Thσ Pasca∞ requiremen⌠ t∩ usσ record≤ oµ fixeΣ sizσ lead≤á t∩ ì
  241. inefficien⌠á usσá oµ storagσ spacσ iµ al∞ record≤ arσá storeΣá iε ì
  242. conventiona∞ Pasca∞ files« T∩ accoun⌠ fo≥ name≤ o≥ othe≥ variablσ ì
  243. sizσá object≤á oµá maximuφ length¼á mos⌠ record≤á contaiεá wasteΣ ì
  244. space«á Oεá average¼á ß typica∞ filσ migh⌠ contaiε froφ 5░ t∩á 7╡ ì
  245. percen⌠á wasteΣá space«á Thσ datß structurσá implementeΣá iεá thσ ì
  246. DBUNI╘ overcome≤ thi≤ b∙ providinτ randoφ acces≤ t∩ variablσ sizσ ì
  247. objects. The cost is a small amount of access overhead.
  248. b⌐á ┴á typica∞á databasσ contain≤ severa∞á relateΣá bu⌠á distinc⌠ ì
  249. files¼á eacΦ witΦ it≤ owε distinc⌠ recorΣ format(s)«á Maintenancσ ì
  250. oµ thesσ files¼ anΣ thσ spacσ eacΦ filσ occupies¼ caε becomσ ver∙ ì
  251. awkward«á Thσ DBUNI╘ baseΣ systeφ overcome≤ thi≤ b∙ interminglinτ ì
  252. al∞á oµá thσ logica∞ datß sequences¼á tha⌠ otherwisσ woulΣ bσá iε ì
  253. separatσá files¼á iεá onσ UCS─ Pasca∞ file«á Thσá datßá structurσ ì
  254. provide≤á packinτ oµ variablσ sizσ datß object≤ b∙á usinτá linkeΣ ì
  255. lists«á I⌠á provide≤á reasonabl∙á rapiΣ randoφá acces≤á t∩á thosσ ì
  256. object≤á b∙á breakinτá thσ databasσ filσ int∩á "pages"«á Iεá thi≤ ì
  257. system¼á ß pagσ i≤ treateΣ a≤ ß mediuφ sizσ physica∞ recorΣ largσ ì
  258. enougΦ t∩ holΣ man∙ logica∞ record≤ oµ variablσ size«á ┴ CONSTan⌠ ì
  259. iεá thσá DBUNI╘á establishe≤ thσ pagσ sizσá a≤á 409╢á bytes¼á thσ ì
  260. equivalent⌠ oµ ╕ block≤ oµ 51▓ byte≤ each«á Thi≤ coulΣ bσ changeΣ ì
  261. iµá onσá wisheΣ b∙ recompilinτ thσ unit«á Thσ DBUNI╘á allow≤á fo≥ ì
  262. manipulatinτá thσá conten⌠ oµ ß pagσ b∙ loadinτ i⌠á int∩á an∙á oµ ì
  263. severa∞á "workareasóá whicΦ caε bσ "openedó fo≥ usσ b∙á primitivσ ì
  264. routine≤á provideΣ witΦ thσ unit«á Datß caε bσ extracteΣá iεá onσ ì
  265. workareßá anΣ moveΣ t∩ anothe≥ workareß o≥ t∩ thσ usinτá program« ì
  266. Datßá caεá bσ editeΣ (b∙ procedurσ anΣ functioε calls⌐á withiεá ß ì
  267. workarea¼á anΣá late≥á inserteΣ int∩ anothe≥ workarea«á Wheεá thσ ì
  268. content≤á oµ ß full-pagσ workareß i≤ read∙ t∩ bσ saveΣá agaiεá oε ì
  269. thσá disk¼á tha⌠ caε bσ donσ usinτ thσ DBPUTPAG┼á function«á Wheε ì
  270. opened¼á ßá workareß ma∙ bσ a≤ largσ a≤ ß ful∞ page¼á o≥á smalle≥ ì
  271. dependinτ upoε thσ programmer≤ requirement≤ fo≥ temporar∙ workinτ ì
  272. storagσá iεá memory«á Withiε ß page¼á thσ datß structurσá caεá bσ ì
  273. describeΣ witΦ thσ hel≡ oµ figure≤ 1¼á ▓ anΣ 3«á Figurσ ▒ show≤ ß ì
  274. pagσá containinτá severa∞ "groups"«á Iε thi≤ system¼á ß grou≡á i≤ ì
  275. equivalen⌠á t∩ ß "repeatinτ group"¼á a≤ ofteε referreΣ t∩ iεá thσ ì
  276. databasσá industry«á I⌠ i≤ ß structurσ whicΦ contain≤ ßá variablσ ì
  277. numbe≥á oµá records«á Record≤ arσ simila≥ iεá concep⌠á t∩á Pasca∞ ìèrecords¼ excep⌠ tha⌠ thσ field≤ iε ß recorΣ iε thi≤ systeφ ma∙ bσ ì
  278. oµ variablσ size«á Thσ relationship≤ amonτ groups¼á records¼á anΣ ì
  279. field≤ arσ showε iε Figurσ 2« ┴ grou≡ start≤ witΦ ß linδ pointinτ ì
  280. t∩á thσá beginninτ oµ thσ followinτ group¼á o≥ t∩ thσ enΣ oµá thσ ì
  281. lis⌠ (indicateΣ b∙ ß linδ valuσ oµ 0)«á Withiε ß group¼ therσ arσ ì
  282. severa∞ records¼ eacΦ oµ whicΦ start≤ witΦ ß linδ pointinτ t∩ thσ ì
  283. nex⌠á record«á Withiε ß record¼á therσ arσá severa∞á fields«á Al∞ ì
  284. variablσá field≤ star⌠ witΦ ß linδ pointinτ t∩ thσ nex⌠ field«á ┴ ì
  285. recorΣ ma∙ contaiε onσ o≥ morσ unlinkeΣ field≤ oµ fixeΣ size« Al∞ ì
  286. fixeΣ sizσ field≤ arσ lumpeΣ int∩ ß singlσ linkeΣ pseudo-fielΣ a⌠ ì
  287. thσá beginninτá oµá thσ record«á Thσ fixeΣá field≤á arσá accesseΣ ì
  288. relativσ t∩ thσ positioε oµ thσ linδ whicΦ make≤ thσ pseudo-fielΣ ì
  289. appea≥ simila≥ t∩ othe≥ field≤ withiε thσ linkeΣ lis⌠á structure« ì
  290. ┴ fielΣ ma∙ bσ defineΣ t∩ contaiε ß group«á Thu≤ thσ structurσ i≤ ì
  291. recursive¼ anΣ ma∙ contaiε man∙ level≤ oµ nesteΣ groups¼ records¼ ì
  292. anΣ field≤ in applications where that makes sense.     Thσ forma⌠ oµ al∞ groups¼á records¼á anΣ field≤ i≤ unde≥ thσ ì
  293. contro∞á oµá "descriptoró record≤ storeΣ iε threσ group≤á a⌠á thσ ì
  294. beginninτ oµ thσ databasσ file«á Iε thσ filσ TESTD┬ tha⌠ yo⌡ wil∞ ì
  295. bσ using¼á al∞ threσ list≤ oµ descriptor≤ arσ containeΣ iε Pagσ ú ì
  296. 0« Group≤ arσ iε predefineΣ descripto≥ grou≡ #1¼ record≤ iε grou≡ ì
  297. #2¼á anΣ field≤ iε grou≡ #3«á ┴ grou≡ descripto≥ refer≤ t∩ onσ o≥ ì
  298. morσá numbereΣ descriptor≤ fo≥ thσ record≤ i⌠ contains«á ┴ recorΣ ì
  299. descripto≥ contain≤ ß simplσ (unlinked⌐ lis⌠ oµá field-descripto≥ ì
  300. numbers«á ┴ fielΣ descripto≥ referrinτ t∩ ß nesteΣ grou≡ contain≤ ì
  301. thσ descripto≥ numbe≥ oµ tha⌠ group¼á rathe≥ thaε ß specificatioε ì
  302. oµ thσ typσ of information contained in the field. 
  303.      Figurσá │á show≤ ß closσ approximatioε t∩ thσá relationship≤ ì
  304. amonτ thσ descriptor≤ iε thσ TESTD┬ filσ whicΦ yo⌡ wil∞ bσá usinτ ì
  305. fo≥á thi≤ course«á A≤ ma∙ bσ seen¼á Grou≡ #░ (thσ "People_Group"⌐ ì
  306. refer≤á t∩á jus⌠á onσá recorΣá descripto≥á fo≥á RecorΣá #░áá (thσ ì
  307. "Person_Rec")«á RecorΣ #0¼á iε turn¼á refer≤ t∩ fielΣ descriptor≤ ì
  308. numbereΣ ░ througΦ 10«á Field≤ 0¼ 1¼ anΣ ▓ arσ fixeΣ sizσ intege≥ ì
  309. fields¼á anΣ eacΦ i≤ ▓ byte≤ wide«á Field≤ ┤ througΦ ╣ arσ strinτ ì
  310. typσáá fields¼áá witΦá maximuφá width≤á ranginτá froφá 1╡á t∩á 4░ ì
  311. characters«á FielΣá #1░á refer≤ t∩ Grou≡ #▓á (thσá "TransGroup")¼ ì
  312. whicΦ iε turε contain≤ record≤ witΦ threσ fixeΣ sizσ field≤ each« ì
  313. Thσá notatioε "SWó refer≤ t∩ ß bytσ storeΣ witΦá eacΦá descripto≥ ì
  314. containinτá contro∞á bits«á Mos⌠á oµ thσ contro∞á bit≤á arσá lef⌠ ì
  315. undefineΣ fo≥ possiblσ usσ iε ß user'≤ program«á Fo≥ fields¼á bi⌠ ì
  316. #▒á (correspondinτ t∩ thσ valuσ 2⌐ indicate≤ ß fixeΣ widtΦ field« ì
  317. Thσ notation≤ "Row"¼á "Lcol"¼á anΣ "Dcoló arσ fo≥ controllinτ thσ ì
  318. screeε locatioε anΣ forma⌠ oµ datß display«á BotΦ thσ "labeló anΣ ì
  319. thσá datß conten⌠ oµ ß fielΣ arσ t∩ bσ displayeΣ iε thσ samσá ro≈ ì
  320. oεá thσá screeεá (numberinτ ░ a⌠ thσ to≡ t∩ 2│á a⌠á thσá bottom)« ì
  321. "Lcoló indicate≤ thσ columε numbe≥ iε whicΦ thσ field'≤ labe∞á i≤ ì
  322. t∩ bσ started« "Dcoló indicate≤ thσ columε iε whicΦ thσ left-mos⌠ ì
  323. datßá characte≥ shoulΣ appear«á Thσ descriptor≤ arσ storeΣ iε thσ ì
  324. TESTD┬á filσ a≤ linkeΣ list≤ simila≥ iε concep⌠ t∩ thosσá iεá thσ ì
  325. list≤ the∙ describe«á Thσ descriptor≤ arσ storeΣ iε thσ file¼ anΣ ì
  326. edited¼á usinτá thσá samσ primitivσ operation≤ tha⌠ appl∙ t∩á thσ ì
  327. datßá the∙á describe«á However¼á acces≤á t∩á thσá descriptor≤á i≤ ì
  328. accomplisheΣ witΦ thσ globa∞ Booleaε DBTYPECHEC╦ (linσ 4┤ oε pagσ ì
  329. ▒á oµ thσ listing⌐ se⌠ t∩ FALSE«á Thi≤ suppresse≤á reference≤á t∩ ì
  330. descriptor≤á wheεá movinτá arounΣ iεá thσá groups¼á records¼á anΣ ì
  331. fields«á InsteaΣá thσ descriptor≤ arσ considereΣ b∙ DBUNI╘ itselµ ìèa≤ madσ u≡ oµ simplσ linkeΣ strings« Thesσ arσ passeΣ t∩ thσ datß ì
  332. structurσá edito≥á program«á Thσ datßá structurσá edito≥á prograφ ì
  333. currentl∙ availablσ i≤ quitσ primitive¼ anΣ supplieΣ t∩ thσ clas≤ ì
  334. a≤á par⌠á oµá thσá prograφ DBUILDER«á DBUILDE╥á i≤á basicall∙á aε ì
  335. experimenta∞ laborator∙ designeΣ t∩ allo≈ step-by-ste≡á debugginτ ì
  336. oµ thσ DBUNIT« Yo⌡ arσ welcomσ t∩ usσ i⌠ (a⌠ you≥ owε peril)¼ bu⌠ ì
  337. n∩á documentatioε wil∞ bσ provided«á Eventually¼á ß morσ friendl∙ ì
  338. datßá structurσ edito≥ wil∞ bσ provided«á (An∙ clas≤á grou≡á tha⌠ ì
  339. feel≤á reall∙á ambitiou≤ migh⌠ conside≥ writinτ ß datßá structurσ ì
  340. edito≥á fo≥á thσá seconΣá anΣ thirΣá homeworδá project≤á iεá thi≤ ì
  341. course.⌐á WitΦ aε understandinτ oµ thσ relationshi≡á betweeεá thσ ì
  342. datßá structurσ anΣ thσ primitivσ operation≤ oµ thσá DBUNIT¼á yo⌡ ì
  343. shoulΣá bσá ablσ t∩ reaΣ ß listinτ oµ thσ DBUILDE╥á prograφá witΦ ì
  344. relativel∙ littlσ problem¼á anΣ theε shoulΣ bσ ablσ t∩ usσ i⌠ fo≥ ì
  345. step-by-ste≡ viewinτ oµ thσ datß containeΣ iε thσ file« A≤ ma∙ bσ ì
  346. seeεá froφ pagσ ▓ oµ thσ listing¼á thσ DBUNI╘ routine≤ arσ brokeε ì
  347. int∩ severa∞ functiona∞ groupings«á Thσ traversa∞ primitive≤á arσ ì
  348. useΣá fo≥á movinτ arounΣ iε thσ datß structurσ withiε ß pagσá (a≤ ì
  349. containeΣá iεá ß workarea)«á Thσ transfe≥á primitive≤á movσá datß ì
  350. betweeεá workareas¼á anΣ betweeε ß workareß anΣ ß usinτá program« ì
  351. Thσá workareßá primitive≤á arσá useΣ t∩á establisΦá workarea≤á oµ ì
  352. appropriatσá sizes«á Thσ filσ primitive≤ maintaiε table≤ fo≥á thσ ì
  353. onσá o≥ morσ dataabasσ file≤ needeΣ b∙ ß use≥ program«á Yo⌡á wil∞ ì
  354. probabl∙á restric⌠á you≥ attentioε t∩ jus⌠ onσ databasσá filσá iε ì
  355. thi≤ course«á Noticσ als∩ thσ debugginτ primitive≤ a⌠ thσ to≡á oµ ì
  356. pagσá │á oµ thσ listing«á  Wheε yo⌡ loaΣ ß pagσ int∩á ßá workareß ì
  357. usinτá DBGETPAGE¼á thσ workarea'≤ locatioε pointe≥ i≤ initializeΣ ì
  358. a⌠á thσ heaΣ oµ thσ firs⌠ grou≡ (grou≡ #0)«á T∩ ge⌠ t∩á thσá nex⌠ ì
  359. grou≡á iεá thσ lis⌠ usσ DBNEXT«á T∩ ge⌠ t∩ thσ firs⌠ recorΣ iεá ß ì
  360. group¼á usσ DBDESCEND«á Iε othe≥ words¼á yo⌡ descenΣ onσ leve∞ iε ì
  361. thσá treσá structureΣ lis⌠ t∩ movσ froφ thσ GROUP╘ leve∞á t∩á thσ ì
  362. RECORD╘ leve∞ (seσ linσ 2░ oε pagσ ▒ oµ thσ listing)«á T∩ ge⌠á t∩ ì
  363. recorΣ ╬ withiε tha⌠ group¼á yo⌡ caε usσ DBSEEK¼ o≥ cal∞ DBNEX╘ ╬ ì
  364. times« T∩ ge⌠ t∩ thσ enΣ oµ thσ lis⌠ iε orde≥ t∩ linδ ye⌠ anothe≥ ì
  365. recorΣá there¼á usσ DBTAIL«á T∩ acces≤ individua∞ field≤ withiε ß ì
  366. record¼á usσ DBDESCEN─ again«á T∩ returε froφ thσ FIELD╘ leve∞ t∩ ì
  367. thσ heaΣ oµ thσ enclosinτ record¼á usσ DBASCEND« DBHEA─ take≤ yo⌡ ì
  368. t∩á thσá locatioε oµ thσ firs⌠ iteφ iε thσ lis⌠á a⌠á thσá curren⌠ ì
  369. level«á DBHOM┼á return≤á yo⌡ t∩ thσ heaΣ oµ thσá outermos⌠á grou≡ ì
  370. leve∞ iε thσ page« DBFINDRE├ i≤ useΣ t∩ scaε througΦ record≤ iε ß ì
  371. singlσá group¼á searchinτá fo≥ ß matcΦ witΦ ß strinτ iεá thσá KE┘ ì
  372. parameter. 
  373.      Oncσ yo⌡ havσ locateΣ ß desireΣ record¼ yo⌡ ma∙ wisΦ t∩ movσ ì
  374. informatioεá froφá thσá field≤á oµ tha⌠ recorΣá t∩á you≥á callinτ ì
  375. program¼á o≥á yo⌡ ma∙ wisΦ t∩ replacσ informatioε iεá thσá recorΣ ì
  376. witΦá ne≈á information«á Thi≤ i≤ donσ b∙ passinτ thσá informatioε ì
  377. througΦá thσá DBUNIT'≤ "mailboxó variablσ (declareΣá startinτá iε ì
  378. linσ 4╕ oε pagσ ▒ oµ thσ listing)«á Thσ DBMAI╠ recorΣ passe≤á onσ ì
  379. iteφ oµ an∙ typσ oµ informatioε supporteΣ b∙ thσ systeφ usinτ thσ ì
  380. transfe≥á primitive≤ DBGE╘ anΣ DBPU╘ whicΦ arσ simila≥ iε concep⌠ ì
  381. t∩ Pascal'≤ GE╘ anΣ PU╘ useΣ witΦ files«á You≥ prograφ accesse≤ ß ì
  382. valuσ froφ thσ datß structurσ b∙ usinτ DBGET¼á oncσ thσá locatioε ì
  383. pointe≥ ha≤ beeε moveΣ t∩ thσ desireΣ item« DBGE╘ load≤ ß cop∙ oµ ì
  384. thσ iteφ int∩ DBMAIL« Yo⌡ caε theε acces≤ thσ valuσ withiε DBMAI╠ ì
  385. (jus⌠á a≤á yo⌡ caε usσ FID▐ fo≥ ß file)¼á o≥ yo⌡ caεá assigεá thσ ìèvaluσá iε DBMAI╠ t∩ ß variablσ iε you≥ program«á DBPU╘ take≤á thσ ì
  386. valuσá iεá thσ DBMAI╠ variablσ anΣ use≤ i⌠ t∩ replacσá thσá valuσ ì
  387. currentl∙á storeΣá iε thσ datß structurσ a⌠ thσ locatioεá oµá thσ ì
  388. workarea'≤á locatioε pointer«á Thσ DBMAILTYP┼ taτ fielΣ oµ DBMAI╠ ì
  389. mus⌠ bσ useΣ t∩ identif∙ wha⌠ typσ oµ informatioε i≤ beinτ passeΣ ì
  390. viß thσ mailbo° (otherwisσ yo⌡ wil∞ ge⌠ bizarrσ anΣ unpredictablσ ì
  391. results!)«á A⌠ present¼ onl∙ thσ STRING╞ anΣ INTEGER╞ option≤ arσ ì
  392. implemented«á (Iµá yo⌡á arσ eveε morσ ambitious¼á yo⌡á migh⌠á tr∙ ì
  393. addinτá onσ oµ thσ othe≥ type≤ fo≥ thσ seconΣ anΣ thirΣá homeworδ ì
  394. tasks.)     Al∞á thσá othe≥ transfe≥ primitive≤ operatσ withiε thσá datß ì
  395. structure¼á anΣ d∩ no⌠ refe≥ t∩ DBMAIL«á Comment≤ iε thσ heading≤ ì
  396. oµ thesσ primitives describe what they do in the DBUNIT listing.
  397.  
  398.                {Walk-thru of a STARTER procedure}
  399.  
  400.      Iµá yo⌡ executσ thσ prograφ DBPRO╟ (showε iε thσ listinτá a≤ ì
  401. DBTEST)¼á anΣá answe≥ thσ promp⌠ b∙ askinτ fo≥ thσ databasσá filσ ì
  402. TESTD┬ (transfe≥ i⌠ witΦ thσ File≥ t∩ you≥ #4║ o≥ #5║ disk)¼ theε ì
  403. thσá operatioεá oµ thσ severa∞ procedure≤ caεá bσá summarizeΣá a≤ ì
  404. follows:
  405. a⌐á F(indreπ wil∞ asδ fo≥ aε approximatσ inde° "key"«á Afte≥á yo⌡ ì
  406. pres≤á <return>¼á ßá portioε oµ thσ inde° wil∞ bσ displayeΣá witΦ ì
  407. selectioε letters«á Picδ ß letter¼á anΣ thσ correspondinτá recorΣ ì
  408. wil∞ be displayed.
  409. b⌐á C(hangereπá allow≤á alterinτ thσ content≤á oµá thσá displayeΣ ì
  410. record«á Selec⌠á thσá fielΣá t∩ alte≥ b∙á pressinτá it≤á selecto≥ ì
  411. letter¼á o≥á b∙ usinτ <return╛ t∩ ge⌠ t∩ thσ nex⌠ field«á Thσ olΣ ì
  412. valuσ oµ thσ fielΣ caε bσ editeΣ o≥ ß ne≈ valuσ substituted«á Seσ ì
  413. pagσá 4│ oµ thσ listinτ fo≥ detail≤ oε thσá SCREADSTR╟á procedurσ ì
  414. useΣá t∩á handlσá thi≤á editing«á Oε thσá Apple¼á usσá thσá ASCI╔ ì
  415. characte≥ "CANó (Control-X⌐ t∩ ge⌠ thσ effec⌠ oµ DE╠ describeΣ iε ì
  416. thσá procedure«á Savσ thσ ne≈ valuσ oµ thσ fielΣ usinτá <return>« ì
  417. <escape╛á return≤á yo⌡á t∩á thσá C(hangereπá contro∞á leve∞áá anΣ ì
  418. redisplay≤á thσ origina∞ valuσ oµ thσ field«á Froφ thσ C(hangereπ ì
  419. contro∞ level¼ <ETX╛ save≤ thσ ne≈ recorΣ value¼ <ESC╛ return≤ t∩ ì
  420. thσ prograφ with no change in the record.
  421. c⌐ N(ewreπ i≤ useΣ t∩ creatσ ß ne≈ record¼á anΣ storσ i⌠ anΣá it≤ ì
  422. index entries in the file.
  423. d⌐á G(etreπá i≤ ß debugginτ procedurσ useΣ t∩ allo≈ yo⌡ t∩á refe≥ ì
  424. explicitl∙ t∩ ß page¼á group¼á anΣ recorΣ numbe≥á location«á Datß ì
  425. record≤á iεá TESTD┬ arσ oε page≤ ▓ anΣ up«á Pagσ ▒á contain≤á thσ ì
  426. currentl∙ implementeΣ singlσ leve∞ index«á Pagσ ░ contain≤ mainl∙ ì
  427. the descriptor groups.
  428. e) Q(uit as it implies gets you out of the program.
  429. f⌐á T(racσá allow≤á manipulatinτá thσ control≤á useΣá t∩á trigge≥ ì
  430. detaileΣá "dumpsóá oµ thσ datß structurσ b∙ thσ DBUNI╘á procedurσ ì
  431. TRACEWA«á Thσ T(racσ displa∙ wil∞ promp⌠ fo≥ tracσ "sites"¼ whicΦ ì
  432. arσá number≤á associateΣá witΦ specifiπá traversa∞á anΣá transfe≥ ì
  433. primitives«á Fo≥ example¼á iµ yo⌡ se⌠ tracinτ fo≥ sitσ #9¼ ß dum≡ ì
  434. wil∞á bσá triggereΣ thσ nex⌠ timσ thσ DBSEE╦ routinσá i≤á entereΣ ì
  435. (Seσá linσ 90╢ oε pagσ 2░ oµ thσ listing.⌐ ┴ tablσ oµá al∞á tracσ ì
  436. site≤á wil∞ bσ provideΣ t∩ thσ clas≤ iε ß supplementar∙á handout« ì
  437. No≈á refe≥ t∩ thσ STARTE╥ procedurσ SAVEINDEXITE═ whicΦ start≤ oε ì
  438. linσ 42░ oµ pagσ 5░ iε thσ listing«á Thσ arra∙ SELEC╘ i≤á assumeΣ ì
  439. t∩á havσá beeε previousl∙ loadeΣ witΦ itemnumber≤ anΣá descripto≥ ìènumber≤ b∙ thσ SHOWRE├ procedure«á ZEROWORKAREA(WA2⌐ i≤ ßá DBUNI╘ ì
  440. procedurσá useΣ herσ t∩ initializσ workareß #▓ (seσ CONS╘ iε linσ ì
  441. 15┤ pagσ 46)« Thσ followinτ lis⌠ oµ call≤ t∩ DBEMPTYITEM¼ DBHOME¼ ì
  442. DBDESCEN─á al∞ se⌠ ß dumm∙ intege≥ variable«á Mos⌠ oµ thσá DBUNI╘ ì
  443. routine≤ arσ function≤ whicΦ ma∙ returε ß non-zer∩ erro≥ valuσ iε ì
  444. ß manne≥ simila≥ t∩ aε erro≥ IORESULT«á Iε thσ line≤ showεá here¼ ì
  445. wσ havσ assumeΣ tha⌠ thesσ routine≤ wil∞ ruε correctly¼á anΣ makσ ì
  446. no provision for error handling. 
  447.      A≤á yo⌡á wil∞á find¼á i⌠ i≤ probabl∙ preferablσ fo≥á yo⌡á t∩ ì
  448. contro∞ al∞ oµ you≥ call≤ t∩ thesσ routine≤ usinτá DBSHOWERR¼á a≤ ì
  449. illustrateΣá oε linσ 46┤ oµ pagσ 51«á Iε tha⌠ case¼á wσ cop∙á thσ ì
  450. iteφá currentl∙ pointeΣ a⌠ iε WA▓ (workareß #2⌐ int∩ thσá curren⌠ ì
  451. positioεá pointeΣ a⌠ iε WA0«á Iµ DBCOP┘ fail≤ (return≤ ß noε zer∩ ì
  452. value⌐áá theεáá thσá messagσá giveεá b∙á thσáá strinτáá paramete≥ ì
  453. 'SAVEINDEXITE═ - cop∙ WA▓ t∩ WA0º wil∞ bσ displayed¼ anΣ yo⌡ wil∞ ì
  454. bσá askeΣá ho≈á t∩á proceed«á Wσ eliminatσá thσá spacσá anΣá timσ ì
  455. consuminτá usσá oµ DBSHOWER╥ onl∙ afte≥ enougΦ testinτá ha≤á beeε ì
  456. donσá t∩ sho≈ tha⌠ error≤ arσ ver∙ unlikely«á Yo⌡á wil∞á probabl∙ ì
  457. finΣá tha⌠ ou≥ confidencσ iε usinτ DUMMY:=..«á ha≤ beeε misplaceΣ ì
  458. iε somσ oµ its uses in the STARTER unit. 
  459.      Iεá linσ 46░ oε pagσ 51¼á wσ se⌠ thσ loca∞ variablσ RSL╘á t∩ ì
  460. thσ valuσ returneΣ b∙ DBDESCEND«á Thi≤ allow≤ thσ prograφ t∩ takσ ì
  461. evasivσá actioε iµ thσ DBDESCEN─ routinσ fail≤ fo≥ ßá predictablσ ì
  462. reason«á Iεá thi≤ casσ DBDESCEN─ migh⌠ fai∞ iµ WA░ i≤á completel∙ ì
  463. empty.
  464.  
  465.                     {Homework Problem Topics}
  466.  
  467.      Duσ t∩ shortagσ oµ time¼ thi≤ sectioε wil∞ generall∙ providσ ì
  468. onl∙á ß brieµ recountinτ oµ thσ area≤ iε whicΦ team≤ oµá student≤ ì
  469. ma∙ proposσ homeworδ topics« Aε additiona∞ handou⌠ providinτ morσ ì
  470. detail≤á wil∞ bσ availablσ iε ß fe≈ days«á ┴ poin⌠ oµ cautioεá i≤ ì
  471. tha⌠á therσá arσ probabl∙ severa∞ bug≤ iε thσá prograφá material≤ ì
  472. provideΣá t∩ yo⌡ - ß toucΦ oµ wha⌠ yo⌡ wil∞ als∩ finΣ iεá workinτ ì
  473. iε thσ rea∞ world after leaving UCSD.
  474.      Fo≥ thσ firs⌠ homeworδ project¼á al∞ bu⌠ thσ morσá ambitiou≤ ì
  475. groups may wish to attack problem 6.1b, c, or d.
  476.  
  477.                          {ISAM Index}
  478.  
  479.      Thσá inde° facilit∙ iε thσ starte≥ prograφ i≤ incompletσá iε ì
  480. many ways. Any of the following would be suitable project tasks:
  481. a⌐ Thσ starte≥ prograφ provide≤ onl∙ ß coarsσ index« ExtenΣ i⌠ b∙ ì
  482. addinτá finσá inde° handling«á Sincσ thσ inde° filσ handlinτá ma∙ ì
  483. makσ thi≤ time-consuming¼á pu⌠ "Updatinτ ..«á ó oε thσ screeεá t∩ ì
  484. sho≈ that work is in progress. 
  485. b⌐á Thσ STARTE╥ unit'≤ SAVEINDEXITE═ procedurσ make≤ n∩ provisioε ì
  486. t∩ replacσ aε inde° entr∙ witΦ aε editeΣ entry«á Iµ thσ ne≈ entr∙ ì
  487. differ≤ iε an∙ wa∙ froφ thσ old¼á theε thσ ne≈ entr∙ i≤ addeΣá t∩ ì
  488. thσ index¼á bu⌠ thσ olΣ remains« Repai≥ thi≤ probleφ b∙ arranginτ ì
  489. t∩á replacσá thσ olΣ entr∙ witΦ thσ ne≈á wheεá appropriate«á Thi≤ ì
  490. shoulΣ no⌠ prevent adding new index items when NEWREC is called.
  491. c⌐á Thσá STARTE╥á unit'≤ inde° handlinτ make≤á n∩á provisioεá fo≥ ì
  492. storinτá multiplσá reference≤ t∩ ß singlσ inde°á ke∙á value«á Fo≥ ì
  493. example¼á therσá arσ tw∩ reference≤ iε thσ TESTD┬ filσ fo≥á Texa≤ ìèInstruments¼á bu⌠á onl∙á onσ caε bσ reacheΣ viß tha⌠ ke∙á iεá thσ ì
  494. index« This should be fixed.
  495. d⌐ Relativσ t∩ thσ F(inΣ command'≤ displa∙ oµ Ke∙ values¼ providσ ì
  496. ßá capabilit∙á t∩ usσ thσ U╨ anΣ DOW╬ arro≈ key≤ t∩ ge⌠ thσá nex⌠ ì
  497. datßá record¼á o≥á thσ previou≤ one¼á iε thσá inde°á (alphabetic⌐ ì
  498. sequence.
  499. e⌐á BuilΣá ß completσ inde° froφ ß pre-existinτá DFI─á file¼á fo≥ ì
  500. example to provide a new combination of fields that are indexed. 
  501. f⌐á Re-builΣá aεá existinτ ISA═ inde° iεá orde≥á t∩á balancσá thσ ì
  502. occupancy of the several pages.
  503.  
  504.                          {Transaction File}
  505.       Thσ starte≥ prograφ currentl∙ contain≤ onl∙ primitivσ hook≤ ì
  506. to implement the transaction file.
  507. a) Implement the transaction file initializer/maintainer.
  508. b) Collect transaction data from the keyboard and display it.
  509. c⌐ Displa∙ recen⌠ transactioε record≤ associateΣ witΦ thσ curren⌠ ì
  510. datßá record«áá Implemen⌠á ßá "nextóá capabilit∙á t∩á scrol∞á thσ ì
  511. transactioε records so that earlier ones may be seen.
  512.  
  513.                          {Batch Search}
  514.  
  515.       Implemen⌠á ßá genera∞á purposσ mean≤ oµ goinτá througΦá thσ ì
  516. entirσá datßá record≤á file¼á allowinτá specifieΣá processinτá oε ì
  517. selecteΣ records.
  518.  
  519.                     {Summary Report Generator}
  520.  
  521.      BaseΣ oε ß batcΦ strategy¼á summarizσ numeriπ datß field≤ iε ì
  522. thσ datß records¼ anΣ providσ ß formatteΣ outpu⌠ repor⌠ whicΦ ma∙ ì
  523. bσ either displayed or printed.
  524.  
  525.                     {Reformat a Data Records File}
  526.  
  527.      Providσá ß genera∞ capabilit∙ t∩ creatσ ß ne≈ databasσá filσ ì
  528. witΦá ß newl∙ defineΣ layou⌠ oµ field≤ iε thσ records¼á baseΣá oε ì
  529. inpu⌠ from an old pre-existing file with a different layout.
  530.  
  531.                     {Sort/Merge Utility}
  532.  
  533.      Writσá ß utilit∙ prograφ t∩ Sor⌠ and/o≥ Mergσ record≤á iεá ß ì
  534. database«á Thi≤á include≤ ß substantia∞ amoun⌠ oµ disδá handling¼ ì
  535. anΣ i≤ ß fairly major project. 
  536.  
  537.                     {Garbage Collection}
  538.  
  539.       Afte≥ substantia∞ amount≤ oµ use¼ thσ Datß Record≤ filσ ma∙ ì
  540. becomσ "checkerboardedó witΦ unuseΣ recorΣ locations« RebuilΣ thσ ì
  541. filσá t∩ eliminatσ unuseΣ recorΣ link≤ embeddeΣ withiε thσá file« ì
  542. Thi≤ ma∙ requirσ ---------"Thi≤ i≤ wherσ i⌠ endeΣ oε m∙ disδ s∩ ╔ ì
  543. supposσá ßá smal∞ par⌠ i≤ missing¼á howeve≥ i⌠ won'⌠ effec⌠á you≥ ì
  544. efforts. GOOD LUCK"
  545.  
  546. PASCAL/Z USERS GROUP
  547. Charlie Fosterè