




*********************************************************************


                   Interactive CodeBase for DOS 
                             (CID)

                           Help File


*********************************************************************







This demo program gives you the opportunity to try out most of the
CodeBase 5.0 functions interactively.  Many of the functions will
be familiar to you if you do some xBASE programming.


This demo is designed to let you call the CodeBase 5.0 functions exactly
as if you had written a C program.  As such you may do any combination
of function calls and watch the return codes appear.  With any open ended
program of this sort, it is best to do a couple of structured examples
before experimenting.


Listed below are a couple of sequences that you can use to get started
using Interactive CodeBase 5.0 for DOS.


You may wish to read this information, and then print it out before
actually running CID.  This information is stored in INTERACT.HLP.



CREATING A DATABASE
===================

C4CODE | safety = FALSE.  This flag determines whether to over write an
                          existing file with a new one.  It is generally
                          a good idea to set this to FALSE when creating
                          a database.

D4DATA | d4create()
                          This function actually creates the data base and
                          index files. When selected, d4create() prompts
                          you for the directory and name of the database
                          to create.  You may enter in any directory (or
                          press <ENTER> for the default current directory)
                          and choose any name and extension for the 
                          database.

                          Use DEMO2.DBF as the database name, and create
                          the following fields:

                                NAME      TYPE   LEN   DEC
                                =======================
                                NAME       C      20    0
                                AGE        N      3     0
                                BIRTH      D      8     0
                                GPA        N      3     1

             NAME         This is the name of the field. This field name 
                          should be unique for this data file.  The same 
                          name can occur in different databases.
             TYPE         xBASE supports five different types of fields:  
                          They are:
                               C  Character
                               D  Date
                               L  Logical (TRUE or FALSE)
                               M  Memo
                               N  Numeric
             LEN          This determines the number of spaces to reserve
                          for the new field (including decimal places, if
                          applicable). Date fields have a length of 8.
                          Memo fields are defined with a length of 10.
                          Logical fields have a length of 1.
             DEC          If the field is a numeric that is to have decimal
                          places, you must specify them in this entry area.
                          If you are not using a numeric field, this should
                          be set to 0.


                          The logical order of the database can be modified
                          by using indexes.  Each order is stored as a
                          'tag'.   Tags can be specified when the database
                          is created using the d4create(), or afterwards
                          using the i4create().

                          Create the index using the d4create() and specify
                          the following items:

                          NAME     KEY EXPR  FILTER       UNIQUE DESCENDING
                          =================================================
                          NAMETAG  NAME     .NOT.DELETED()  0      0
                          AGETAG   AGE                      0      1

             NAME         The name here is the title with which you 
                          reference the particular sort order.  Each tag 
                          for a database must have a unique name.
             KEY EXPR     This is what the tag is sorted by.  This may be
                          any field or combination of fields.  Most dBASE
                          expressions work in the key expression.  Examples 
                          could be:
                          LAST_NAME+FIRST_NAME or SUBSTR(NAME,1,3) or
                          NAME+STR(AGE,3,0)
             FILTER       If only a portion of the database are to be in the
                          index, specify a filter using most logical
                          dBASE expressions. Some examples are:
                          AGE > 18 or NAME > "A".AND.SUBSTR(NAME,1,3)<>"SMI"
                          or MONTH(BIRTH) = 12
             UNIQUE       If duplicate records are allowed in the index, set
                          the unique flag to 0 (FALSE).
             DESCENDING   Indexes are generally ordered from A...Z 0...9,
                          however, if the DESCENDING flag is set, the order
                          is reversed 9...0, Z...A and so on. This is useful
                          for dates.



ADDING NEW RECORDS
==================

D4DATA | d4append_blank()
                          This function creates a new record and appends it
                          to the bottom of the database. The fields are
                          filled with spaces (hence the _blank in the
                          function call).

F4FIELD | f4assign()
                          This function puts data into a field.  You must
                          specify the database, the field, and the 
                          information you wish to store.  Since xBASE 
                          stores all data in a character form, you may use 
                          this function for all data types.  

                          Using date fields, however, you must enter the
                          date in the CCYYMMDD format. (eg.19910101 is 
                          January 1, 1991).

                          f4assign() overwrites any existing data in the
                          field.  If you wish to create multiple records,
                          use d4append_blank() before each set of data is
                          modified.

                          Add three records using the following information:

                               NAME    AGE    BIRTH    GPA
                               =============================
                               PETER   20     19720202  3.8
                               ANDREW  15     19770404  4.0
                               JAMES   30     19620101  2.1

CLOSING THE DATABASE
====================
D4DATA | d4close()       You may close a database by executing this
                         function. If more than one database is open, you 
                         can close them all using d4close_all(). CID 
                         automatically closes all the databases when QUIT 
                         is executed.


OPENING AN EXISTING DATABASE
============================
C4CODE | auto_open = FALSE
                         Set this flag if you do not wish to open an 
                         existing index file automatically with the d4open().


D4DATA | d4open()
                         d4open() opens a database that already has been
                         created.  The database need not have been created
                         using CID, but may be also created using dBASE IV,
                         FoxPro, Clipper, or dBASE III. If the 
                         C4CODE:auto_open flag is TRUE, d4open() 
                         automatically opens any associated production index
                         file.
                         
                         Production index files are created using d4create()
                         or by creating an index file with dBASE IV or 
                         FoxPro.


I4INDEX | i4open()       i4open() opens an index file associated with
                         a database.

D4DATA | d4tag_select()  Since an index file can contain several orderings
                         it is necessary to specify which ordering to
                         use for functions that use the logical ordering,
                         such as d4skip(), d4top(), d4bottom() and d4seek().
                         d4tag_select() is used for just this purpose.

                         Open the DEMO2.DBF file and the DEMO2 index file.




USING THE BROWSER
==================
                         Once a database has been opened or created, you can
                         browse the data by selecting the BROWSER option of
                         the main menu. Listed below are some of the things
                         you can do using the browser:

        Modify a field   Press <ENTER> while the field is highlighted, type 
                         in your new information and press <ENTER>.  The 
                         browser automatically calls f4assign() for you.

        Select a tag     Press <ESC> to return to the top level menu and
        ordering         choose d4tag_select.  Selecting BROWSE again causes
                         the browse window to be re-drawn with the ordering.

        Insert a new     Press the Insert key and a new record is added.
        record           The browser automatically calls d4append_blank()
                         for you.

        Mark a record    Press the Delete key and the current record is
        for deletion     marked for deletion. Deleted records have the 
                         leftmost field area filled in with an asterisk (*).
