Rename a file.
int rename (const char * oldname, const char * newname);
Required Header |
<io.h> |
Return Value
This function returns 0 if the operation was successful. -1 indicates an error.
Parameters
oldname
The dataset or dataset(member) to rename
newname
The new dataset name or (member) to rename to
Remarks
The rename function first checks if the file exists then (in the case of MVS datasets) does one of two rename functions: In the case of a dataset rename, it uncatalogs the file, renames the vtoc entry and recatalogs the file. In the case of a member rename, it opens the dataset and STOWs a 'C'hanged directory entry.
The oldname parameter must specify the 'style' of file (_style default, //DDN:, //DSN: or //HFS:) however the newname parameter can consist of only the information required to rename a file. In the case of a member, only the "(member)" part is required, with datasets only the new dataset name is required. In the case of HFS files, they can be moved from one directory to another so a complete path should be used.A dataset and member cannot be both renamed in the same function call since any newname dataset text is ignored when renaming a member. A member cannot be renamed to a dataset, and a dataset cannot be renamed to a member. HFS files and datasets cannot be converted to one another by this function.
Only a dataset which does not span multiple volumes can be renamed by the JCC Library.