Command COPY STRUCTURE Foundation

Copies the structure of the file in the current work area to a new file.

Syntax
COPY STRUCTURE [FIELDS <cFieldname,...>] ;
            TO <cFilename>
Parameters
<cFieldname,...>
The option FIELDS specifies a comma-separated list of field names to copy into the file <cFilename>. The field names can be specified as literals or as character expressions in parentheses. If this option is not included, all field names are copied into the file <cFilename>.
<cFilename>
<cFilename> specifies the name of the file to create. The name must contain the drive and path if they are necessary. It can be specified either as a literal file name or as a character expression in parentheses. When the file name is specified without a file extension, the default extension predetermined by the current database engine (DBE) is used. The default file extension for the DBFDBE is ".DBF".
Description

The command COPY STRUCTURE creates files using the field specifications of the current work area. If the file <cFilename> exists, it is overwritten without warning. The command is frequently used to create temporary files for data input or to store data subsets during some processes.

The functional equivalent of COPY STRUCTURE is the function DbCopyStruct().

Examples
COPY STRUCTURE
// The example illustrates a typical use for the command 
// COPY STRUCTURE. A temporary DBF file is created to 
// store a subset of records. Operations are then 
// performed using the subset and the temporary file is 
// finally deleted. 
PROCEDURE Main 

   USE Customer VIA "DBFNTX" NEW 
   COPY STRUCTURE TO Temp          // generate temporary file 
   USE Temp 

   APPEND FROM Customer FOR "NEW YORK" $ Upper(CITY) 

   Browse()                        // operations on the subset 
   USE 

   ERASE Temp.dbf                  // delete temporary file 
RETURN 
Feedback

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.