Movfile
Movfile
moves a file.
The function returns a status 0 on success or a negative code.
The function can be executed locally and remotelly.
To move a file, it must exist beforehand. If a file does not exist, the function returns a negative code.
Syntax
RETURN_VALUE=Movfile(SOURCE_PATH, DESTINATION_PATH)
RETURN_VALUE
is an integer variable that contains the information returned by the call.SOURCE_PATH
is a string variable that contains the path for the file you want to move.DESTINATION_PATH
is a string variable that contains the path to where you want to move the file.
Example
Local runtime
# Procedure to move a log file
Subprog MOVE_LOG_FILE(LOGFILE_NAME, ERR_CODE)
Const Char LOGFILE_NAME()
Local Char SOURCE_PATH(GDIMFIC)
Local Char DESTINATION_PATH(GDIMFIC)
Variable Integer ERR_CODE
SOURCE_PATH = filepath("tmp","oraspace"+num$(adxuid(2)),"log",nomap)
DESTINATION_PATH = filpath("TRA","oraspace"+num$(adxuid(2)),"log",nomap)
# Move the file
ERR_CODE = movFile(SOURCE_PATH, DESTINATION_PATH)
End ERR_CODE
Remote runtime
# Procedure to move a log file
Subprog MOVE_LOG_FILE(LOGFILE_NAME, ERR_CODE)
Const Char LOGFILE_NAME()
Local Char SOURCE_PATH(GDIMFIC)
Local Char DESTINATION_PATH(GDIMFIC)
Variable Integer ERR_CODE
MACHINE = adxmac(0)
SOURCE_PATH = MACHINE+"@"+filepath("tmp","oraspace"+num$(adxuid(2)),"log",nomap)
DESTINATION_PATH = MACHINE+"@"+filpath("TRA","oraspace"+num$(adxuid(2)),"log",nomap)
# Move the file
ERR_CODE = movFile(SOURCE_PATH, DESTINATION_PATH)
End ERR_CODE
Return values
Value | Explanation |
---|---|
0 | Operation succeeded. |
-20 | File does not exist. |
-27 | Access denied. |
-164 | [V]CST_AERRPROT Protocol error. |
Notes
Movfile tests the SOURCE_PATH
internally to check if its execution occurs locally or remotely.