Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved


Chapter 3 Tools : COPY_DEFN

COPY_DEFN
Copies the definition of one or more objects from a source location to a destination location. (C)
Invocation
CALL COPY_DEFN(objecttype, instancename, library, environment, srclocation, destlocation, parentonly)
 
Populating the @DEFNS Table
Before invoking COPY_DEFN, you must populate the @DEFNS table.
If you do not populate the table, it is populated automatically with newname=name, newlibrary=library, and overwrite=N.
Use rules statements to populate the @DEFNS table, before calling COPY_DEFN.
Parameters of @DEFNS
The parameters of the @DEFNS table are as follows:
 
Fields of @DEFNS
The fields of the @DEFNS table are as follows:
 
The type of the object (for example, rule or screen). If the object is a table, use the subtype name, such as TDS_TABLE or SCR_TABLE, or execute the OBTAINSUBTYPE(objtype, objname, lib, env, srcloc) rule to determine the subtype name, where the following are the arguments:
objtype – The general type of the object (for example, TABLE).
objname – The name of the object.
lib – The library, if the object is a rule.
env – The environment (default is 3270).
srcloc – The node where the object exists.
Usage Notes
COPYDEFN is an interactive version of this tool used on the workbench.
You must specify values for srclocation and destlocation.
Specify a value for parentonly if the object is composed of one or more other objects, for example, a report is composed of report tables.
The original statistics for the object or object set (for example, CREATED, AUTHOR, UNIT, and SEGMENT) are also copied to the new library.
If you are copying to a remote node, your user ID must be identical on both nodes or security complications could occur.

Exceptions
 
Raised if anything goes wrong with the copy operation. The exception should be handled by the calling rule.
Example
The following rule copies the definition of the screen NEW_EMPLOYEES and its child objects from NODE1 to NODE2:

 
RULE EDITOR ===> SCROLL: P
COPY_DEFN_1;
_
_ ---------------------------------------------------------------------------
_ ------------------------------------------------------------+--------------
_ @DEFNS.NAME = 'NEW_EMPLOYEES'; | 1
_ @DEFNS.NEWNAME = 'NEW_EMPLOYEES'; | 2
_ @DEFNS.TYPE = 'SCREEN'; | 3
_ @DEFNS.LIBRARY = ''; | 4
_ @DEFNS.NEWLIBRARY = ''; | 5
_ @DEFNS.VERSIONED = 'N'; | 6
_ @DEFNS.OVERWRITE = 'Y'; | 7
_ INSERT @DEFNS('SCREEN', 'NEW_EMPLOYEES'); | 8
_ CALL COPY_DEFN('SCREEN', 'NEW_EMPLOYEES', '', '', 'NODE1', | 9
_ 'NODE2', 'N'); |
_ ---------------------------------------------------------------------------

 

Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved