# RENAME..INDEX Rename Keys in Keyed File

> Source: https://manual.pvxplus.com/directives/rename-index

## Format

**RENAME** *filename$* **INDEX** {*keynumber*| *keyname$*} **TO** {*newkeyname$*} \[,**ERR**=*stmtref*\]

***Where:***

|  |  |
| --- | --- |
| *filename$* | Name of the file from where the key will be renamed. String expression. |
| *keyname$* | Name of the key to rename (if assigned). String expression. |
| *keynumber* | Key number (KNO value) to rename. |
| *newkeyname$* | New key name. |
| *stmtref* | Program line number or statement label to which to transfer control. |
| **TO** | Mandatory keyword, not case sensitive. |

## Description

The **RENAME..INDEX** directive allows you to rename, or name, keys. When you need to modify existing names or add key names to an older Keyed file, use the **RENAME..INDEX** directive to change the names.

## See Also

[ADD INDEX Add Key to Keyed File](https://manual.pvxplus.com/directives/add-index)  
[DROP INDEX Drop Key from Keyed File](https://manual.pvxplus.com/directives/drop-index)

## Example

```
rename "cstfile" index 1 to "Customer_no"
rename "cstfile" index "#2" to "Customer_Name"
```
