home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / progmisc / codebase.zip / INTERACT.HLP < prev    next >
Text File  |  1993-01-04  |  10KB  |  228 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6. *********************************************************************
  7.  
  8.  
  9.                    Interactive CodeBase for DOS 
  10.                              (CID)
  11.  
  12.                            Help File
  13.  
  14.  
  15. *********************************************************************
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23. This demo program gives you the opportunity to try out most of the
  24. CodeBase 5.0 functions interactively.  Many of the functions will
  25. be familiar to you if you do some xBASE programming.
  26.  
  27.  
  28. This demo is designed to let you call the CodeBase 5.0 functions exactly
  29. as if you had written a C program.  As such you may do any combination
  30. of function calls and watch the return codes appear.  With any open ended
  31. program of this sort, it is best to do a couple of structured examples
  32. before experimenting.
  33.  
  34.  
  35. Listed below are a couple of sequences that you can use to get started
  36. using Interactive CodeBase 5.0 for DOS.
  37.  
  38.  
  39. You may wish to read this information, and then print it out before
  40. actually running CID.  This information is stored in INTERACT.HLP.
  41.  
  42.  
  43.  
  44. CREATING A DATABASE
  45. ===================
  46.  
  47. C4CODE | safety = FALSE.  This flag determines whether to over write an
  48.                           existing file with a new one.  It is generally
  49.                           a good idea to set this to FALSE when creating
  50.                           a database.
  51.  
  52. D4DATA | d4create()
  53.                           This function actually creates the data base and
  54.                           index files. When selected, d4create() prompts
  55.                           you for the directory and name of the database
  56.                           to create.  You may enter in any directory (or
  57.                           press <ENTER> for the default current directory)
  58.                           and choose any name and extension for the 
  59.                           database.
  60.  
  61.                           Use DEMO2.DBF as the database name, and create
  62.                           the following fields:
  63.  
  64.                                 NAME      TYPE   LEN   DEC
  65.                                 =======================
  66.                                 NAME       C      20    0
  67.                                 AGE        N      3     0
  68.                                 BIRTH      D      8     0
  69.                                 GPA        N      3     1
  70.  
  71.              NAME         This is the name of the field. This field name 
  72.                           should be unique for this data file.  The same 
  73.                           name can occur in different databases.
  74.              TYPE         xBASE supports five different types of fields:  
  75.                           They are:
  76.                                C  Character
  77.                                D  Date
  78.                                L  Logical (TRUE or FALSE)
  79.                                M  Memo
  80.                                N  Numeric
  81.              LEN          This determines the number of spaces to reserve
  82.                           for the new field (including decimal places, if
  83.                           applicable). Date fields have a length of 8.
  84.                           Memo fields are defined with a length of 10.
  85.                           Logical fields have a length of 1.
  86.              DEC          If the field is a numeric that is to have decimal
  87.                           places, you must specify them in this entry area.
  88.                           If you are not using a numeric field, this should
  89.                           be set to 0.
  90.  
  91.  
  92.                           The logical order of the database can be modified
  93.                           by using indexes.  Each order is stored as a
  94.                           'tag'.   Tags can be specified when the database
  95.                           is created using the d4create(), or afterwards
  96.                           using the i4create().
  97.  
  98.                           Create the index using the d4create() and specify
  99.                           the following items:
  100.  
  101.                           NAME     KEY EXPR  FILTER       UNIQUE DESCENDING
  102.                           =================================================
  103.                           NAMETAG  NAME     .NOT.DELETED()  0      0
  104.                           AGETAG   AGE                      0      1
  105.  
  106.              NAME         The name here is the title with which you 
  107.                           reference the particular sort order.  Each tag 
  108.                           for a database must have a unique name.
  109.              KEY EXPR     This is what the tag is sorted by.  This may be
  110.                           any field or combination of fields.  Most dBASE
  111.                           expressions work in the key expression.  Examples 
  112.                           could be:
  113.                           LAST_NAME+FIRST_NAME or SUBSTR(NAME,1,3) or
  114.                           NAME+STR(AGE,3,0)
  115.              FILTER       If only a portion of the database are to be in the
  116.                           index, specify a filter using most logical
  117.                           dBASE expressions. Some examples are:
  118.                           AGE > 18 or NAME > "A".AND.SUBSTR(NAME,1,3)<>"SMI"
  119.                           or MONTH(BIRTH) = 12
  120.              UNIQUE       If duplicate records are allowed in the index, set
  121.                           the unique flag to 0 (FALSE).
  122.              DESCENDING   Indexes are generally ordered from A...Z 0...9,
  123.                           however, if the DESCENDING flag is set, the order
  124.                           is reversed 9...0, Z...A and so on. This is useful
  125.                           for dates.
  126.  
  127.  
  128.  
  129. ADDING NEW RECORDS
  130. ==================
  131.  
  132. D4DATA | d4append_blank()
  133.                           This function creates a new record and appends it
  134.                           to the bottom of the database. The fields are
  135.                           filled with spaces (hence the _blank in the
  136.                           function call).
  137.  
  138. F4FIELD | f4assign()
  139.                           This function puts data into a field.  You must
  140.                           specify the database, the field, and the 
  141.                           information you wish to store.  Since xBASE 
  142.                           stores all data in a character form, you may use 
  143.                           this function for all data types.  
  144.  
  145.                           Using date fields, however, you must enter the
  146.                           date in the CCYYMMDD format. (eg.19910101 is 
  147.                           January 1, 1991).
  148.  
  149.                           f4assign() overwrites any existing data in the
  150.                           field.  If you wish to create multiple records,
  151.                           use d4append_blank() before each set of data is
  152.                           modified.
  153.  
  154.                           Add three records using the following information:
  155.  
  156.                                NAME    AGE    BIRTH    GPA
  157.                                =============================
  158.                                PETER   20     19720202  3.8
  159.                                ANDREW  15     19770404  4.0
  160.                                JAMES   30     19620101  2.1
  161.  
  162. CLOSING THE DATABASE
  163. ====================
  164. D4DATA | d4close()       You may close a database by executing this
  165.                          function. If more than one database is open, you 
  166.                          can close them all using d4close_all(). CID 
  167.                          automatically closes all the databases when QUIT 
  168.                          is executed.
  169.  
  170.  
  171. OPENING AN EXISTING DATABASE
  172. ============================
  173. C4CODE | auto_open = FALSE
  174.                          Set this flag if you do not wish to open an 
  175.                          existing index file automatically with the d4open().
  176.  
  177.  
  178. D4DATA | d4open()
  179.                          d4open() opens a database that already has been
  180.                          created.  The database need not have been created
  181.                          using CID, but may be also created using dBASE IV,
  182.                          FoxPro, Clipper, or dBASE III. If the 
  183.                          C4CODE:auto_open flag is TRUE, d4open() 
  184.                          automatically opens any associated production index
  185.                          file.
  186.                          
  187.                          Production index files are created using d4create()
  188.                          or by creating an index file with dBASE IV or 
  189.                          FoxPro.
  190.  
  191.  
  192. I4INDEX | i4open()       i4open() opens an index file associated with
  193.                          a database.
  194.  
  195. D4DATA | d4tag_select()  Since an index file can contain several orderings
  196.                          it is necessary to specify which ordering to
  197.                          use for functions that use the logical ordering,
  198.                          such as d4skip(), d4top(), d4bottom() and d4seek().
  199.                          d4tag_select() is used for just this purpose.
  200.  
  201.                          Open the DEMO2.DBF file and the DEMO2 index file.
  202.  
  203.  
  204.  
  205.  
  206. USING THE BROWSER
  207. ==================
  208.                          Once a database has been opened or created, you can
  209.                          browse the data by selecting the BROWSER option of
  210.                          the main menu. Listed below are some of the things
  211.                          you can do using the browser:
  212.  
  213.         Modify a field   Press <ENTER> while the field is highlighted, type 
  214.                          in your new information and press <ENTER>.  The 
  215.                          browser automatically calls f4assign() for you.
  216.  
  217.         Select a tag     Press <ESC> to return to the top level menu and
  218.         ordering         choose d4tag_select.  Selecting BROWSE again causes
  219.                          the browse window to be re-drawn with the ordering.
  220.  
  221.         Insert a new     Press the Insert key and a new record is added.
  222.         record           The browser automatically calls d4append_blank()
  223.                          for you.
  224.  
  225.         Mark a record    Press the Delete key and the current record is
  226.         for deletion     marked for deletion. Deleted records have the 
  227.                          leftmost field area filled in with an asterisk (*).
  228.