COPY STRUCTURE EXTENDED Copy field definitions to a .dbf file ------------------------------------------------------------------------------ Syntax COPY STRUCTURE EXTENDED TO <xcExtendedDatabase> Arguments TO <xcExtendedDatabase> is the name of the target structure extended database file. This argument can be specified either as a literal database file name or as a character expression enclosed in parentheses. Description COPY STRUCTURE EXTENDED creates a database file whose contents is the structure of the current database file with a record for the definition of each field. The structure extended database file has the following structure: Structure of an Extended File ------------------------------------------------------------------------ Field Name Type Length Decimals ------------------------------------------------------------------------ 1 Field_name Character 10 2 Field_type Character 1 3 Field_len Numeric 3 0 4 Field_dec Numeric 4 0 ------------------------------------------------------------------------ Used in application programs, COPY STRUCTURE EXTENDED permits you to create or modify the structure of a database file programmatically. To create a new database file from the structure extended file, use CREATE FROM. If you need an empty structure extended file, use CREATE. Notes . Character field lengths greater than 255: In Clipper, the maximum character field length is 64K. For compatibility reasons, field lengths greater than 255 are represented as a combination of the Field_dec and Field_len fields. After COPYing STRUCTURE EXTENDED, you can use the following formula to determine the length of any character field: nFieldLen := IF(Field_type = "C" .AND. ; Field_dec != 0, Field_dec * 256 + ; Field_len, Field_len) Examples . This example creates Struc.dbf from Sales.dbf as a structure extended file and then lists the contents of Struc.dbf to illustrate the typical layout of field definitions: USE Sales NEW COPY STRUCTURE EXTENDED TO Struc USE Struc NEW LIST Field_name, Field_type, Field_len, Field_dec Result: 1 BRANCH C 3 0 2 SALESMAN C 4 0 3 CUSTOMER C 4 0 4 PRODUCT C 25 0 5 AMOUNT N 8 2 6 NOTES C 0 125 // Field length is 32,000 characters Files Library is CLIPPER.LIB.
See Also: COPY STRUCTURE CREATE CREATE FROM FIELDNAME() TYPE()
Pingback: DB Commands | Viva Clipper !
Pingback: C5 Commands | Viva Clipper !