The COPY field description statement copies an existing record description (a template record) into the description of a new field (a COPY field).
1 – Syntax Rules
o You must assign a field name to a COPY field. This field name can be up to 31 characters from the set A-Z, 0-9, _, and $. The first character must be a letter from A-Z, and the last character can not be _ or $. You can use alphabetic 8-bit characters in field names. o The path name can be a full or a relative path name, and it must be the path name of an existing CDD record description. You can specify an absolute version number with the path name. o The COPY field description statement must terminate with a period.
2 – Usage Notes
o The copy operation takes place when the new record is compiled, not when it is copied into a program. When you modify a template record, you should recompile any record definitions that contain COPY field descriptions copying the modified template record. o The COPY field description statement copies a complete record, a template record, into a single field. o The COPY field description statement copies the description of the template record as the description of the COPY field. If the first subordinate field of the template record is a BIT field, the first subordinate field of the COPY field begins on the first bit immediately following the preceding field. Otherwise, the COPY field begins on the first byte immediately following the preceding field. You can modify this starting position with the ALIGNED clause o If you specify an absolute version number in the path name parameter, CDDL copies the version of the template record with that version number each time you compile the record description containing the COPY field. If you do not specify a version number, CDDL copies the highest version of the template record each time you compile the record description. o In the COPY field, the field name you assign replaces the field name copied from the field description statement of the template record. o When the CDDL compiler compiles a record definition containing a COPY field description, it automatically makes an entry documenting the copy operation in the history list of the template record, whether or not you use the /AUDIT qualifier.
3 – Example
CDD$TOP.CORPORATE.ADDRESS_RECORD defines the standard format for addresses. You can copy this field description into any new record requiring an address field. ADDRESS COPY FROM CDD$TOP.CORPORATE.ADDRESS_RECORD.