CBL_RENAME_FILE
The CBL_RENAME_FILE library routine renames a file.
Note - This routine is supported for compatibility. In order to take advantage of every rename feature provided by isCOBOL, refer to RENAME.
Syntax:
 CALL "CBL_RENAME_FILE" USING oldName 
                              newName
                       GIVING returnCode
Parameters:
oldName
PIC X(n)
Specifies the name of the file that you want to rename. If no path is given, then the current directory is assumed.
 
The name can be partially or entirely changed through configuration properties if iscobol.file.env_naming (boolean) is set to true.
If the name is a relative path and iscobol.file.prefix is set, then the first FILE-PREFIX path is used to locate the file. The ISF protocol is not supported, it will invalidate the file path, if used.
newName
PIC X(n)
Specifies the new name for the file. If no path is given, then the current directory is assumed.
 
The name can be partially or entirely changed through configuration properties if iscobol.file.env_naming (boolean) is set to true.
If the name is a relative path and iscobol.file.prefix is set, then the first FILE-PREFIX path is used to locate the file. The ISF protocol is not supported, it will invalidate the file path, if used.
Return code:
returnCode can be any numeric data item and provides additional information:
0
Operation successful.
14605
Not found.
14613
Is directory
Examples:
Example - Rename file to append the date it was generated
*> define curr-date as pic x(6)
*> new-name and old-name as pic x(n)
accept curr-date from date
initialize new-name
string "c:\app1\reps\cust-report-"
       curr-date
       ".lst"
  into new-name
end-string
move "c:\app1\reps\cust-report.lst" to old-name
call "cbl_rename_file" using old-name new-name
if return-code not = 0
   display message "Rename operation failed"
end-if