home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol155 / dbox.art < prev    next >
Encoding:
Text File  |  1984-04-29  |  3.7 KB  |  148 lines

  1.      The  arrival of dBASE 2.4 was a welcome event 
  2. at  our  office.  We run a  variety  of  different 
  3. databases  and  2.4 enabled  us  to  significantly 
  4. improve our programs.
  5.  
  6.      In one area,  however, 2.4 produced some real 
  7. problems. We use a number of dual data bases where 
  8. we transition between them in various parts of the 
  9. program.  Under  2.3 we would run into a `TOO MANY 
  10. FILES`  error  every  so  often  and  awaited  2.4 
  11. eagerly to solve that problem.  As it turned  out, 
  12. 2.4  is  more  insistent upon  a  proper  `RETURN` 
  13. statement  than  2.3  and it forced  us  to  think 
  14. through the problem.
  15.  
  16.      We  did not necessarily want to return to the 
  17. module that called the module we were running,  so 
  18. we  created an `invisible box.` This box  contains 
  19. the `forever loop` for the program and is used for 
  20. all transfers between the data bases.
  21.  
  22.      With the box we can go from any point in  the 
  23. program  modules  for a data base to any point  in 
  24. the  program modules of any other  data  base.  As 
  25. long  as  we have no more than two data  bases  on 
  26. line  at a time,  we can use the box to transition 
  27. between any number of data bases.  Before we enter 
  28. the box in a transition between data bases we also 
  29. save  the common variable.  When we enter the  new 
  30. data  base  from  the box we do a `FIND`  for  the 
  31. common variable to bring up the proper record.
  32.  
  33.      There is,  of course,  a time penalty,  but a 
  34. rather  minor one in terms of what the box does.   
  35.  
  36.  
  37. * dBOX.BOX by Steve Leon (201) 886-1658
  38. * dBOX is a program to switch between data bases 
  39. * designed for dBASE 2.4 
  40.  
  41. * prior to entry the initilization program has
  42. * poked the drive number into memory via the
  43. * command `POKE 063,(64+@(dr,`AB`))`
  44.  
  45. * set up forever loop for program
  46. STORE t TO keepitup
  47. DO WHILE keepitup
  48.  
  49. * set up alternateive routes
  50. * the initialization program stores 0 to box
  51. * moveit is used in this data base to find the 
  52. * proper file in the other data base via a
  53. * `SAVE`, `RESTORE` and `FIND`
  54. * first is used to bring on a fixed screen 
  55. * matrix for the module
  56.  
  57. DO CASE 
  58.  
  59. CASE box = 0   
  60.         STORE f TO moveit
  61.         STORE t TO first
  62.     STORE chr(peek (063)) TO dr
  63.     USE &dr.:cpb INDEX &dr.:file
  64.         DO main.cpb
  65.  
  66. CASE box = 1
  67.     RELEASE ALL
  68.         STORE t TO keepitup
  69.     STORE chr(peek (063)) TO dr
  70.     USE &dr.:cpb INDEX &dr.:file
  71.         STORE t TO moveit
  72.         STORE t TO first
  73.     DO main.cpb
  74.  
  75. CASE box = 2  
  76.     RELEASE ALL
  77.         STORE t TO keepitup
  78.     STORE chr(peek (063)) TO dr
  79.     USE &dr.:cpb1 INDEX &dr.:file1
  80.         STORE t TO moveit
  81.         STORE t TO first
  82.     DO main.ind
  83.  
  84. CASE box = 3
  85.      RELEASE ALL
  86.         STORE t TO keepitup
  87.     STORE chr(peek (063)) TO dr
  88.     USE &dr.:cpb INDEX &dr.:file 
  89.         STORE t TO moveit
  90.         STORE t TO first
  91.     DO search.cpb
  92. CASE box = 4
  93.     RELEASE ALL
  94.         STORE t TO keepitup
  95.     STORE chr(peek (063)) TO dr
  96.     USE &dr.:cpb1 INDEX &dr.:file1
  97.         STORE t TO moveit
  98.         STORE t TO first 
  99.     DO search.ind
  100.  
  101. CASE box = 5
  102.         STORE f TO moveit
  103.         STORE t TO keepitup
  104.         DO search.cpb
  105.  
  106. CASE box = 6
  107.         STORE f TO moveit
  108.         STORE t TO keepitup
  109.         DO search.ind
  110.  
  111. CASE box = 7
  112.         STORE f TO keepitup
  113.  
  114. ENDCASE
  115. ENDDO
  116. * when we quit eliminate sign-off message
  117. ERASE
  118. SET CONSOLE OFF
  119. QUIT
  120.  
  121.      The  transition from the various  modules  to 
  122. the BOX is:
  123.  
  124. To quit:
  125.      CASE command = `Q`
  126.      * prevent sign-off message
  127.      STORE t TO keepitup
  128.      STORE 7 TO box
  129.      RETURN
  130.  
  131. To transition to other data base:
  132.      CASE command = `I`
  133.      STORE !(fl:no) TO linker
  134.      SAVE to move
  135.      STORE 2 TO box 
  136.      RETURN
  137.  
  138.      There  are other transitions in the  program, 
  139. but  the above should be sufficient to enable  you 
  140. to  write  your own `box.` If you come up  with  a 
  141. better  way,  or  have  some  thoughts,  we  would 
  142. appreciate them.
  143.  
  144.  
  145.  
  146.  
  147.  
  148.