IB Statements/rename

From CometWiki

Jump to: navigation, search

RENAME statement

Syntax: RENAME filename-1 [,DIR=directory-1] ,filename-2 [,DIR=directory-2] [,EXCP=statement-label | NOEXCP]

Discussion: The RENAME statement renames a Comet file.

Filename-1 and directory-1 are the name and Comet directory name respectively of the original file. Filename-2 and directory-2 are the name and Comet directory name respectively of the renamed file.

Filename-1, directory-1, filename-2, and directory-2 are string values. Each may be a string constant, string variable, string expression, or string function.

Note: Directory-1 and directory-2 must be located on the same DOS disk, even though they may be on different DOS directories or subdirectories.


The above example renames the file TESTFILE located on Comet directory DSK. Its new name will be ARCHIVE and it will be located on Comet directory SSI (assuming that Comet directories DSK and SSI are located on the same DOS disk). If an exception occurs, the program branches to statement label 9999.

Example 2: RENAME FILE1$,,FILE2$

This example renames a file using string variables. The file name stored in the string variable FILE1$ is renamed to the value stored in string variable FILE2$. Since no directory names are specified, the directory associated with FILE1$ will be used for FILE2$.

Personal tools