$FUNCNAME$
  DBCREATE()
$CATEGORY$
  DATABASE
$SUMMARY$
   Create a database file from a database structure array
$LANG_RU$
             ,
$SYNTAX$
     DBCREATE(<cDatabase>, <aStruct>,[<cDriver>]) --> NIL
$LANG_RU$
     DBCREATE(<  >, <>) --> NIL
$ARGUMENTS$
     <cDatabase> is the name of the new database file, with an optional
     drive and directory, specified as a character string.  If specified
     without an extension, .dbf is assumed.

     <aStruct> is an array that contains the structure of <cDatabase> as
     a series of subarrays, one per field.  Each subarray contains the
     definition of each field's attributes and has the following structure:

     <PRE>Field Definition Subarray
     ------------------------------------------------------------------------
     Position     Metasymbol     dbstruct.ch
     ------------------------------------------------------------------------
     1            cName          DBS_NAME
     2            cType          DBS_TYPE
     3            nLength        DBS_LEN
     4            nDecimals      DBS_DEC
     ------------------------------------------------------------------------
     </PRE>

     <cDriver> specifies the replaceable database driver (RDD) to use to
     process the current work area.  <cDriver> is the name of the RDD
     specified as a character expression.  If you specify <cDriver> as a
     literal value, you must enclose it in quotes.

$LANG_RU$
     <  > -     ,  
                .
          ,    
      (.dbf).

     <> -  ,     
        <  >     - 
        .    
           :

     <PRE>  .
     ---------------------------------------------------------------------
                    dbstruct.ch
     ---------------------------------------------------------------------
       1            cName            DBS_NAME
       2            cType            DBS_TYPE
       3            nLength          DBS_LEN
       4            nDecimals        DBS_DEC
     ---------------------------------------------------------------------
     </PRE>
$RETURNS$
     DBCREATE() always returns NIL.
$LANG_RU$
     DBCREATE()   NIL.
$DESCRIPTION$
     DBCREATE() is a database function that creates a database file from an
     array containing the structure of the file.  You may create the array
     programmatically or by using DBSTRUCT().  DBCREATE() is similar to the
     CREATE FROM command which creates a new database file structure from a
     structure extended file.  Use CREATE or COPY STRUCTURE EXTENDED commands
     to create a structure extended file.

     Before using DBCREATE(), you must first create the <aStruct> array and
     fill it with the field definition arrays according to the structure in
     Field Definition Subarray table (above).  There are some specific rules
     for creating a field definition array, including:

       Specify all field attributes with a value of the proper data
	type for the attribute.  The decimals attribute must be specified--
	even for non-numeric fields.  If the field does not have a decimals
	attribute, specify zero.

       Specify the type attribute using the first letter of the data
	type as a minimum.  Use longer and more descriptive terms for
	readability.  For example, both "C" and "Character" can be specified
	as the type attribute for character fields.

       In xClipper, character fields contain up to 64,000
	characters.  Unlike the CREATE FROM command, DBCREATE() does not use
	the decimals attribute to specify the high-order part of the field
	length.  Specify the field length directly, regardless of its
	magnitude.

     To make references to the various elements of the field definition
     subarray more readable, the header file called dbstruct.ch is supplied.
     It contains the #defines to assign a name to the array position for each
     field attribute.  It is located in \include.
$LANG_RU$
     DBCREATE() -     ,   
          ,  
       .      
        DBSTRUCT().

     DBCREATE()   CREATE FROM,   
              .
            
         CREATE,  COPY STRUCTURE EXTENDED.

        DBCREATE()   
     <>    ,   
         5-7.     
        :

               
       . ,      ,
             .    
       ,      ,
           0.

         ,    
         .        
         . ,    
          "C",  "Character".

       xClipper       64 . 
          CREATE FROM,  DBCREATE()  
       ,       
           .

      ,       
        ,     
     dbstruct.ch,         
     ,   .     
     \include.
$EXAMPLES$
       This example creates an empty array and then adds field
	definition subarrays using the AADD() function before creating
	People.dbf.  You might use this technique to add field definitions to
	your structure array dynamically:

	aDbf := {}
	AADD(aDbf, { "Name", "C", 25, 0 })
	AADD(aDbf, { "Address", "C", 1024, 0 })
	AADD(aDbf, { "Phone", "N", 13, 0 })
	//
	DBCREATE("People", aDbf)

       This example performs the same types of actions but declares
	the structure array as a two-dimensional array, and then uses
	subscript addressing to specify the field definitions.  It will be
	created using the DBFMDX RDD:

	#include "dbstruct.ch"
	//
	LOCAL aDbf[1][4]
	aDbf[1][ DBS_NAME ] := "Name"
	aDbf[1][ DBS_TYPE ] := "Character"
	aDbf[1][ DBS_LEN ]  := 25
	aDbf[1][ DBS_DEC ]  := 0
	//
	DBCREATE("Name", aDbf, "DBFMDX")
$LANG_RU$
            AADD()    
              . 
           People.dbf.    
       ,        
        :

       aDbf := {}
       AADD(aDbf, { "Name", "C", 25, 0 })
       AADD(aDbf, { "Address", "C", 1024, 0 })
       AADD(aDbf, { "Phone", "N", 13, 0 })
       //
       DBCREATE("People", aDbf)

            ,   
         ,       
         :

       #include "dbstruct.ch"
       //
       LOCAL aDbf[1][4]
       aDbf[1][DBS_NAME] := "Name"
       aDbf[1][DBS_TYPE] := "Character"
       aDbf[1][DBS_LEN] := 25
       aDbf[1][DBS_DEC] := 0
       //
       DBCREATE("Name", aDbf)
$SEEALSO$
  AFIELDS(),DBSTRUCT()
$END$
