Format {COLLECTION } {FIELD } REPLACE {RECORD } [qualifier] ... element-name ,... {FILE_ELEMENT type-name} {GENERIC type-name } [AUDIT IS /*text*/]
1 – Parameters
1.1 – type-name
Specifies the type of the file or generic element you are replacing.
1.2 – element-name
Specifies the element you are replacing. You can substitute an asterisk (*) wildcard character for this parameter unless you are working in the CDD$METADATA collection, where all wildcards are not allowed.
1.3 – text
Adds information to the history list entry. Valid delimiters are /* */ or double quotation marks (" "). You can use Japanese to document comments in the AUDIT clause for a field. To do this, use the SET CHARACTER_SET command, and set the character_set of the session to DEC_KANJI.
2 – Qualifiers
2.1 /BRANCH
Format options: /BRANCH=branchname /NOBRANCH (default) Specifies whether CDO creates a version on a new branch line or on an existing line of descent. The BRANCH option you specify in the REPLACE command overrides any BRANCH option you specified in the RESERVE command.
2.2 /CLOSURE
Format options: /CLOSURE=keyword /NOCLOSURE (default) Specifies whether CDO replaces additional elements. A CLOSURE operation fails if any element is a child of an element outside the area defined by the CLOSURE keyword. The /CLOSURE qualifier takes one of the following keywords: CLOSURE Keyword Behavior TO_BOTH Replaces the element specified and all parents and children. TO_BOTTOM Replaces the element specified and all children. TO_TOP Replaces the element specified and all parents. If you specify TO_BOTH or TO_TOP, CDO ignores parents of the top collection.
2.3 /LOG
Format options: /LOG /NOLOG (default) Specifies whether CDO displays text identifying each element as the element is replaced.
3 – Description
The REPLACE command checks in a version of an element that you previously checked out with the RESERVE command. You must have a context set to issue the REPLACE command. The REPLACE command converts the ghost copy reserved to your context into a new version stored in a base partition. This new version is accessible to anyone whose context is set to that base partition. To create subsequent versions of a controlled element, use the RESERVE and REPLACE commands, rather than the DEFINE command. An error occurs if you issue the /BRANCH qualifier with a branch name already in use. If you issue the REPLACE command with branch information specified in the element name, do not include a /CLOSURE qualifier. The /CLOSURE qualifier will add this branch name to the name of every element you replace. If you are issuing the REPLACE command in a distributed environment, you must issue the REMOVE command after issuing the RESERVE command. If you decide to discard the changes you have made to your working copy, use the UNRESERVE command to cancel your reservation and destroy your copy. If you decide to merge a branch line that you have created back into the main line of descent, use the MERGE command.
4 – Examples
1.CDO> RESERVE FIELD /CLOSURE=TO_TOP FIRST_NAME CDO> CHANGE FIELD FIRST_NAME cont> DESCRIPTION IS "SPELL OUT THOSE INITIALS!" In this example, the REPLACE command replaces the FIRST_NAME field element and all parents to the top of the collection hierarchy. 2.CDO> RESERVE FIELD /CLOSURE=TO_TOP /BRANCH=AUDITOR PRODUCT_NUMBER CDO> CHANGE FIELD PRODUCT_NUMBER(1:AUDITOR:1) cont> AUDIT IS "THESE VERSIONS SUBMITTED FOR AUDIT". CDO> REPLACE FIELD PRODUCT_NUMBER(1:AUDITOR:1) CDO> REPLACE RECORD /CLOSURE=TO_TOP PRODUCTS In this example, the initial REPLACE command replaces the branch version of the PRODUCT_NUMBER field element; a second REPLACE command replaces those elements on the path from PRODUCT to the top collection. 3.CDO> RESERVE FIELD /CLOSURE=TO_TOP PRODUCT_NUMBER(1:AUDITOR:1) CDO> CHANGE FIELD PRODUCT_NUMBER(1:AUDITOR:2) cont> AUDIT IS "SEVEN OBSOLETE PRODUCT NUMBERS". CDO> REPLACE FIELD PRODUCT_NUMBER(1:AUDITOR:2) CDO> REPLACE RECORD /CLOSURE=TO_TOP PRODUCTS In this example, the REPLACE command replaces the new second version in the AUDITOR branch line. 4.CDO> REPLACE FIELD /BRANCH=QA PRODUCT_NUMBER(1:AUDITOR:2) By substituting this command for REPLACE FIELD PRODUCT_ NUMBER(1:AUDITOR:2) in the previous example, you can change the branch name from AUDITOR to QA. 5.CDO> REPLACE FIELD /BRANCH PRODUCT_NUMBER(1:AUDITOR:2) By substituting this command for REPLACE FIELD PRODUCT_ NUMBER(1:AUDITOR:2) in the third example, you can reverse the creation of the branch line and replace PRODUCT_NUMBER on the main line.