Serge,
From the Help in Clarion v6.2
[small][tt]
RENAME(file,new file)
RENAME Renames a FILE.
file The label of a FILE to rename, or a string constant or variable containing a file specification.
new file A string constant or variable containing a file specification. If the file specification does not contain a drive and path, the current drive and directory are assumed. If only the path is specified, the filename and extension of the original file are used for the new file. Files cannot be renamed to a new drive.
The RENAME statement changes the file specification to the specification for the new file in the directory. The file to rename must be closed, or the "File Already Open" error is posted. If the file specification of the new file is identical to the original file, the RENAME statement is ignored. If any error is posted, the file is not renamed.
Since some file drivers use multiple physical disk files for one logical FILE structure, the default filename and extension assumptions are dependent on the file driver.
Errors Posted: 02 File Not Found
03 Path Not Found
05 Access Denied
52 File Already Open
Example:
RENAME(Text,'text.bak') !Make it the backup
RENAME(Master,'\newdir') !Move it to another directory
RENAME('C:\AUTOEXEC.BAT','C:\AUTOEXEC.SAV') !Make it the backup
[/tt][/small]
If the RENAME() & COPY() in CW2 only works with File Labels, then define a dummy DOS driver file like :
DosFileName STRING(12),STATIC
DosFile FILE,DRIVER('DOS'),PRE(DOS),NAME(DosFileName)
Record RECORD
END
END
and ...
DosFileName = 'F2005.tps'
RENAME(DosFile, 'FINANCE.tps')
The same thing can work for your TOPSPEED file, i.e.
TPSFileName STRING(12),STATIC
TPSFile FILE,DRIVER('TOPSPEED'),PRE(TPS),NAME(TPSFileName)
Record RECORD
<your columns here>
END
END
So, if you want to use F2005.tps, set TPSFileName = 'F2005.tps' before Opening the file. Similarily it will work for any Topspeed file providing they have the same file structure.
HTH