Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>copy</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
COPY


Syntax:     COPY TO <file>/(<expC1>) [<scope>] [FIELDS <field list>]
            [FOR <condition>] [WHILE <condition>]
            [SDF/DELIMITED/DELIMITED WITH <delimiter>/(<expC2>)]

Purpose:    To copy all or part of the current database file to a new
            file.

Arguments:  <file> is the name of the new file.  If no type clause
            is specified, (.dbf) is the default file type and no
            extension is necessary.  If there is a type clause
            specified, the file extension is assumed to be (.txt) unless
            specified.

Options:    Fields: The FIELDS clause specifies the list of fields
            to copy to the target database file.  The default is all
            fields.

            Scope: The <scope> is the portion of the current
            database file to COPY.  The default is ALL.

            Condition: The FOR clause specifies the conditional set
            of records to COPY within the given scope.  The WHILE clause
            specifies the set of records meeting the condition from the
            current record until the condition fails.

            SDF: The SDF clause specifies the output file type as a
            System Data Format ASCII file.  Records are fixed length,
            each separated by a carriage return/line feed pair.  Fields
            are fixed length and there is no field separator.  Character
            fields are padded with trailing blanks, numeric fields are
            padded with leading blanks, date fields are written in the
            form YYYYMMDD, and logical fields are written in the form
            T/F.  The end-of-file mark is Ctrl-Z (1A hex.)

            Delimited: The DELIMITED clause specifies the output
            file type as a DELIMITED ASCII file.  Records are variable
            length, each separated by a carriage return/line feed pair.
            Fields are variable length and separated by commas.
            Character fields are bounded by delimiters (the double quote
            mark is the default unless you specify a different character
            using the WITH clause).  Leading and trailing spaces for
            numeric and character fields are truncated, date fields are
            written in the form YYYYMMDD, and logical fields are written
            in the form T/F.  Ctrl-Z (1A hex) is the end-of-file mark.

            Note: DELIMITED WITH BLANK, DIF, SYLK, and WKS file type
            options are not supported in addition to the TYPE keyword.

Usage:      All records contained in the active database file are copied
            unless limited by a scope or FOR/WHILE clause.  Records
            marked for deletion will be copied unless DELETED is ON or a
            FILTER has been SET.

Network:    When you COPY in a network environment, Clipper opens the
            target database file EXCLUSIVE.

Library:    CLIPPER.LIB


----------------------------------- Examples -------------------------------

   This example demonstrates COPYing to another database file:

   USE Sales
   ? LASTREC()                && Result: 84

   COPY TO Temp
   USE Temp
   ? LASTREC()                && Result: 84

   The following examples use Testdata.dbf which has four fields, one
   for each data type:  Char, Num, Date, Logical.  For purposes of the
   following examples, Testdata contains the following data:

   USE Testdata
   ? Char, Num, Date, Logical

   Result:

   Character    12.00 08/01/87 .T.


   This example COPYs TO an SDF file:

   COPY NEXT 1 TO Temp SDF
   TYPE Temp.txt

   Result:

   Character      12.0019870801T

   This example COPYs TO a DELIMITED file:

   COPY NEXT 1 TO Temp DELIMITED
   TYPE Temp.txt

   Result:

   "Character",12.00,19870801,T


   This example COPYs TO a DELIMITED WITH a different delimiter:

   COPY NEXT 1 TO Temp DELIMITED WITH '
   TYPE Temp.txt

   Result:

   'Character',12.00,19870801,T



See Also: APPEND FROM COPY FILE COPY STRUCTURE SET DELETED

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson