Home page  
Help >
ddlCopyData() - copy the records in a collection
Version 7.11
ddlCopyData() - copy the records in a collection ddlCopyData() - copy the records in a collection

ddlCopyData() is used to copy the records in a collection to another table; or to make a copy in the same table.

Prototype:
   void ddlCopyData(
      CONTROL *ctl,
      char *OptnStr,
      char *ArgList);          /* command argument list */
Permitted values in OptnStr:
   /Cn - copy only n records;
   /S  - Do not create structures for the newly created records;

Form of ArgList:
<srcCx> <srcTableName> <destCx> <destTableName>
<srcCx> [<srcTableName>] <destCx> <destTableName> <destListItem1> <destListItem2> ...
<srcCx> represents the source collection;
<srcTableName> represents the source Table name;
         If <srcTableName> is omitted, the global collection is used;
<destCx> represents the target collection;
<destTableName> represents the target Table name;
<destListItemN> when one or more field name list items are present, only the specified fields are copied
<destListItemN> :: =
<destFieldNameN> OR
<destFieldNameN> = <srcFieldNameN> OR
<destFieldNameN> = <literal>
     <literal> :: = ' <literalString> '
<destFieldNameN> = %Variable
<destFieldNameN> = null

Description:
When copying from one table to another, only the fields that are common to both tables are copied. To copy data between fields that do not have the same name, it is necessary to create an alias for one or the other.

For each record copied to the target table, the respective record number is placed into the target collection. The target collection is not cleared by the ddlCopyData() command.

In the second form of the command, only the specified fields are copied; provided that they are common to both the source and target tables.

When copying from a virtual table, the second form of the command must be used.

Values returned in Control Structure:
Control.Ans1 Number of records read from the source table
Control.Ans2 Number of records written to the target table

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.