home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 1B / DATAFILE_PDCD1B.iso / _pocketbk / pocketbook / 004 / isameg_zip / README.TXT < prev   
Text File  |  1994-03-23  |  4KB  |  113 lines

  1. Example of calling ISAM from OPL
  2. ================================
  3.  
  4. Files in this zip
  5. -----------------
  6. README.TXT      This documentation
  7. ISAM.DYL        Copy of ISAM.DYL from SDK
  8. LIST.OPL        Example Opl program (source)
  9. L_FILE.OPH      Required header file
  10. ISAM.OPG        Required header file
  11. LIST.OPO        Example Opl program (object)
  12. MAKEDATA.OPL    Can generate database with this
  13. MAKEDATA.OPO    Can generate database with this
  14. INTRO.TXT       Text version of chapter from SDK
  15. FUNC.TXT        Text version of chapter from SDK
  16.  
  17. To see the power of ISAM
  18. ------------------------
  19. Copy one of your favourite databases to M:\DAT\Data.dbf.
  20. Copy ISAM.DYL into the root of M:\
  21. Copy LIST.OPO into some \OPO\ directory and run it.
  22. To start with, it will say "Building index".
  23. Then it will show an ordered list of all the records in the database
  24. that start with "A".
  25. There's a simple editor at the bottom of the screen.
  26. Type characters into this and see the list of records displayed
  27. change.  Eg type "BRO" and the list shown will subset in turn, as you
  28. type, to show those starting with
  29.   B
  30.   BR
  31.   BRO
  32.  
  33. If you don't have a suitable database to hand
  34. ---------------------------------------------
  35. You can use the supplied program MAKEDATA to make one (with random
  36. entries - as many as you specify).
  37.  
  38. What's going on
  39. ---------------
  40. The "index" created by LIST is a file (called Data.btx in this case,
  41. in the root of M:\) that allows subsequent searches to take place,
  42. within the database, very quickly.
  43.  
  44. You can delete Data.btx after you've finished experimenting.
  45.  
  46. The power of ISAM
  47. -----------------
  48. Even though the database file gets significantly larger, it won't
  49. slow down the speed of searching by any noticeable amount (once the
  50. index file has been built).
  51.  
  52. More database theory
  53. --------------------
  54. I can't go into the whole theory of ISAM here - there are whole books
  55. written about it.  In case anyone's wondering, ISAM was invented
  56. totally independently of Psion.  ISAM is a section of Computer
  57. Science and general database theory in its own right.  But the actual
  58. ISAM.DYL that implements this code DOES come from Psion.  It's part
  59. of the C SDK and also part of the v2 Opl/G SDK.
  60.  
  61. If you want to use ISAM, you will have to learn a few of the basic
  62. principles of this general theory.  But to start off with, you can
  63. experiment with the supplied example.
  64.  
  65. The source code of LIST.OPO
  66. ---------------------------
  67. The LIST.OPL supplied is intended to be translated using S3aTRAN.
  68. The "include" files ISAM.OPG and L_FILE.OPH need to be found by
  69. S3aTRAN otherwise the translation will fail.
  70.  
  71. If you're desperate, you can change the code in LIST.OPL so that all
  72. the #define's disappear (eg you replace "FOPEN or FUPDATE" with the
  73. value $100, which you work out from reading L_FILE.OPH).  Also you
  74. change the C style comments into Opl style comments.  Then you can
  75. translate LIST.OPL on an S3a.  But frankly, if you need to program
  76. with ISAM, you ought to get yourself set up for S3aTRAN.
  77.  
  78. On the S3
  79. ---------
  80. The program LIST.OPL presupposes S3a Opl, eg by using keywords like
  81. enterSend and loadlib.  You can, however, change this so that it runs
  82. on the S3 or on the HC instead, by replacing these lines of code with
  83. their equivalents using OS or CALL.  The v2 Opl/G SDK has "macros" to
  84. help automate this kind of thing.
  85.  
  86. Brief note on LIST.OPL
  87. ----------------------
  88. This program illustrates ISAM usage only and should not be used as a 
  89. template for writing an application.
  90.  
  91. Where do you go from here
  92. -------------------------
  93. You'll need to read some of the SDK documentation on ISAM.
  94. I've included textualised versions of the two relevant chapters from
  95. the C SDK with this ZIP.  They're not very pretty to read, but if you
  96. persist, you can reconstruct what the original Word/DOS text looks
  97. like.
  98.  
  99. Even better is to read it straight out of a paper copy of the SDK.
  100.  
  101. Suggestions
  102. -----------
  103. Modify LIST.OPL so that
  104.    it puts the index in another place
  105.    it can find ISAM.DYL in another place
  106.    it indexes on another field, other than the first
  107.    it uses others of the ISAM methods
  108.    ...
  109.  
  110. These notes prepared by
  111. -----------------------
  112. David Wood, Psion Product Development, 23rd March 1994.
  113.