Command COPY STRUCTURE EXTENDED Foundation
Copies a list of field definitions to a new file.
COPY STRUCTURE EXTENDED TO <cFilename>
The command COPY STRUCTURE EXTENDED generates a structure extended file with four fields containing the field definitions of the fields in the current work area. For each field in the current work area, a data record is added to <cFilename>. The structure of the file <cFilename> is shown in the following table:
Field name | Field type | Field length | Decimal places |
---|---|---|---|
FIELD_NAME | Character | 10 | 0 |
FIELD_TYPE | Character | 1 | 0 |
FIELD_LEN | Numeric | 5 | 0 |
FIELD_DEC | Numeric | 4 | 0 |
The command COPY STRUCTURE EXTENDED is similar to the function DbStruct(), which returns the list of field specifications in a two-dimensional array. The command COPY STRUCTURE EXTENDED instead writes this information to a file. It is also used to define or change the field structure of database files at runtime of an Xbase++ application. The corresponding file can be created using the command CREATE FROM.
The functional equivalent of COPY STRUCTURE EXTENDED is the function DbCopyExtStruct().
// In the example, the file structure of a customer file
// is modified using a structure extended file. A new
// field is added for the fax number of a customer.
PROCEDURE Main
USE Customer VIA "DBFNTX" NEW // carry over structure
COPY STRUCTURE EXTENDED TO Struct
USE Struct // enter new
APPEND BLANK // field definition
REPLACE Field_Name WITH "FAXNO", ;
Field_Type WITH "C" , ;
Field_Len WITH 15 , ;
Field_Dec WITH 0
USE
// save copy of
RENAME Customer.dbf TO Temp.dbf // - DBF file
RENAME Customer.dbt TO Temp.dbt // - Memo file
CREATE Customer FROM Struct // create new file
USE Customer
APPEND FROM Temp // copy records
// from saved copy
CLOSE // rename saved files
RENAME Temp.dbf TO Customer.bak // - DBF file
RENAME Temp.dbt TO Customer.tbk // - Memo file
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.