Home page  
Help >
DDL COPY DATA Command
Version 7.11
DDL COPY DATA Command COPY for Data Records

These are direct Data-to-Data copies. In the syntax below "c" means collection, and "tname" means table name.

Form1: Table-to-Table
COPY DATA [FROM] c1 tname1 [TO] c2 tname2

Form2: Global to Table
COPY DATA [FROM] c1 [TO] c2 tname

Notation standards Options Answers

Options:
C -Count option. Limit #of records copied to the count.
E -If an error occurs, do not abort the procedure
S -Suppress automatic Structure with the copy
X -Suppress the command response
Y -Do not alter the command answer cells

Answers:
Ctl.Ans1 =Number of records read
Ctl.Ans2 =Number of records written
Ctl.Ans3 =Zero

Notes:
FROM and TO are optional and are allowed for readability. The source of the copy is always the first argument and the target is always the second argu-
ment.

If the target collection was CLEARed prior to the COPY DATA then after the copy is complete the subset residing in c2 is the one best expressed as "find the records that were just copied into my target table." The results are ORed into the target collection so you can do multiple copies and the target collection gets them all.

In Form 1 the two collections can be the same, or the two table names can be the same, but the FROM pair cannot be the same as the TO pair.

In Form 2, c1 contains the results of a RELATE done prior to the COPY DATA.

As in all forms of file transfer (e.g., LOAD, UNLOAD, and COPY DATA) the rule for data transfer is "where names match, data moves." So the data names in the source table(s) are matched with the data names in the target table to determine what fields are copied to the target.

COPY DATA does not copy MEMO fields. If the target contains a MEMO field it is set to null (no data).

Copyright © 2019 , WhamTech, Inc.  All rights reserved. This document is provided for information purposes only and the contents hereof are subject to change without notice. Names may be trademarks of their respective owners.