REPLACE Statement

Modifies record, group, and item definitions in an existing access descriptor.

Type: Optional statement
Applies to: access descriptor
Interaction: UPDATE statement

Syntax

REPLACE | REPL index-number
<GROUP=new-group-name ITEM=new-item-name
LEVEL=level-number
DBFORMAT=database-format
FORMAT=SAS-format SEARCH=search-name
KEY=Y | N | U DBCONTENT=database-content>
;

|
<RECORD=new-record-name
SEGMENT=segment-name
SEGLNG=segment-length>
;
REPLACE | REPL item-name
<LEVEL=level-number DBFORMAT=database-format
FORMAT=SAS-format SEARCH=search-name
KEY=Y | N | U DBCONTENT=database-content>
;

|
<SEGMENT=segment-name SEGLNG=segment-length>;

Details

The REPLACE statement replaces or modifies existing records, groups, and items in existing access descriptors. Any item that can be entered on RECORD, GROUP=, and ITEM= statements can be modified, except the OCCURS option.
Unlike the INSERT and DELETE statements, each data item to be modified needs a separate REPLACE statement, although any number of REPLACE statements can occur in any order with INSERT and DELETE statements within an UPDATE statement
The following are examples of replacement statements:
replace shipped dbc=mmddyy6.;      /* modifies dbcontent */
replace 5 se=' '                   /* drops search field parameter */
replace 'old-record-name' record='new-record-name'; 
   sg='new-ims-segname';           /* replaces record    */
replace 2 item='cust-item';        /* renames item        */

Comparisons

The only required item in the REPLACE statement is the index number, name, or quoted string used to identify it. However, the optional arguments are recommended for data definition. Except for the following optional arguments, the arguments follow the same editing rules as they would in Create mode or in an update insert situation.
  • KEY=N removes an item as a designated key field.
  • Specifying blanks on a SEARCH or DBCONTENT parameter removes their value, effectively dropping the parameters.
  • The FORMAT parameter currently cannot be reset to its default value.