z/OS Using REXX and z/OS UNIX System Services
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


v_rename

z/OS Using REXX and z/OS UNIX System Services
SA23-2283-00

Read syntax diagramSkip visual syntax diagram
>>-v_rename--vntoken--oldname--vntoken2--newname---------------><

Function

v_rename invokes the v_rename callable service to rename a file or directory to a new name.

Parameters

vntoken
A variable name that contains the vnode token for the directory that contains the filename oldname.
oldname
The existing name for the file or directory.
vntoken2
A variable name that contains the vnode token for the directory that is to contain the filename newname.
newname
The new name for the file or directory.

Usage notes

  1. The v_rename service changes the name of a file or directory from oldname to newname. When renaming completes successfully, the change and modification times for the parent directories of oldname and newname are updated.
  2. The calling process needs write permission for the directory containing oldname and the directory containing newname. If oldname and newname are the names of directories, the caller does not need write permission for the directories themselves.
  3. Renaming files: If oldname and newname are links referring to the same file, v_rename returns successfully and does not perform any other action.

    If oldname is the name of a file, newname must also name a file, not a directory. If newname is an existing file, it is unlinked. Then the file specified as oldname is given newname. The pathname newname always stays in existence; at the beginning of the operation, newname refers to its original file, and at the end, it refers to the file that used to be oldname.

  4. Renaming directories: If oldname is the name of a directory, newname must also name a directory, not a file. If newname is an existing directory, it must be empty, containing no files or subdirectories. If it is empty, it is removed. newname cannot be a directory under oldname; that is, the old directory cannot be part of the pathname prefix of the new one.

Example

In the following example, assume that olddir, oldfile, newdir, and newfile were assigned values earlier in the exec:
"v_rename olddir (oldfile) newdir (newfile)"

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014