Introduction

Language Structure

IB Statements

File System

Comet 32 Runtime

Index

(RenameFile)

Mnemonic: (RenameFile=filename-1,filename-2,flags)
Discussion: This mnemonic renames a Windows file.

This mnemonic may be used by foreground programs only.

Filename-1 is the name of the original file. Filename-2 is the name of the renamed file. Both file names are in Windows format, UNC format, or a directory alias.

Flags is the sum of the specified decimal values from the following chart:

Flag Description
1 Perform function at CometAnywhere remote system
2 If not CometAnywhere, then substitute local for remote

If the program is running on a local Comet system (not on a CometAnywhere client system), this flag substitutes the local drive/path name for a remote path/drive name.

After this mnemonic is issued, your program can issue an INPUT on LUN (0) to retrieve the error information. For example:

  LENGTH 2 & LOCAL AX$,DX$
  LENGTH 254 & LOCAL RESULT$
  ResultFmt: FORMAT AX$;DX$;RESULT$
  .
  .
  Print (RenameFile=File1$,File2$,Flags)
  Input (0,ResultFmt)
The first field, AX$, contains the function error code, and the second field, DX$, contains the suberror code (aka the Windows file error code). Both of these fields are in Intel 2's complement format, and should be processed as follows:
  AX$ = SUB(AX$,2,1) + SUB(AX$,1,1)   ! Flip the bytes around
  DX$ = SUB(DX$,2,1) + SUB(DX$,1,1)   ! Flip the bytes around
  FuncError = HexDec(AX$)             ! Function error code (decimal)
  FileError = HexDec(DX$)             ! File error code (decimal)

  ! For unexpected values, convert to 2's complement signed integer
  If (FuncError > 32767) FuncError = FuncError-65536
  If (FileError > 32767) FileError = FileError-65536
Here is a list of the function error codes in decimal form:

Error
(FuncError)
Description
0 Function not supported
1 Success
2 CometAnywhere required
3 Source file error (see suberrors)
4 Aborted by user
5 Function in progress

Here is a list of the suberror codes (common Windows file errors) in decimal form:

Suberror
(FileError)
Description
0 Success
2 File not found
3 Path not found
5 Access denied
12 Invalid access
15 Invalid drive
16 An error has occurred in the current directory
18 No more files
32 Sharing violation
33 Lock violation
80 File exists
161 Bad pathname

History: This mnemonic was added in Comet Build 299 and REL Version 01.07.