RENAME


ANSI

 

The RENAME instruction changes the name of a file on the disk. The instruction uses the following format:

 

 

[label]

RENAME

{source},{dest}

 

Where:

label

Optional. A Program Execution Label.

source

Required. A previously defined Character String Variable or Literal containing the current name of the file.

dest

Required. A previously defined Character String Variable or Literal containing the new name of the file.

Flags Affected: NONE

Note the following:

  1. Both a {source} and {dest} file name must be specified. The first operand is the source file name and the second operand is the new destination file name. If a character string variable is specified for either, only the Logical String is used.

  2. RENAME must be able to have exclusive access to the file being renamed, i.e., it must not be open in this or any another PL/B program or process. Otherwise, an I/O error occurs.

  3. If the specified file cannot be found, an I/O error occurs.

  4. The new file name must not conflict with any operating system rules regarding file names or any other file name already in use. Otherwise, an I/O error occurs.

  5. File paths are supported, including moving the source file to a different destination subdirectory. However, it is not possible to move files across different drives or to use global/wildcard file naming conventions (i.e., using asterisks `*' or question marks `?').

  6. Under PLBCMP, if a file name starts with a '$' character, it is scanned to the first non-alpha non-numeric character. The environment table is then searched for this entry. If a matching entry is found, the string associated with the entry is substituted within the file name. An entire file name may be substituted in this manner, or all or a portion of a file path may be specified in this manner.

  7. If the {source} has a vertical bar (|) and an IP number or host name appended, the operation is redirected to the SUNDM data manager.

  8. The RENAME instruction is not supported when using SQLIO.

  9. A Datapoint style filename of `filename/ext:drv' is converted to a Sunbelt format as follows:

 

 

See Also: Example Code, ERASE, Disk I/O Instructions

 



PL/B Language Reference READLAST, READLASTLK REPOSIT