i have a variable that holds the file name and the location of that file, i need to move that file from one location to another.How can it be done using informix 4gl
LET cmd = "mv ", old_location, "/", file_name, " ", new_location
RUN cmd
This assumes that old_location, file_name and new_location are all VARCHAR variables and not CHAR variables. If they are CHAR, you need to strip trailing blanks before concatenating:
(You could omit the last CLIPPED.) This also assumes there are no spaces in the file names or locations. You have to work a bit harder if spaces can be present; you have to work considerably harder if you need to deal with quotes or newlines (etc) in the file names.
The RUN command will be used:
This assumes that
old_location
,file_name
andnew_location
are all VARCHAR variables and not CHAR variables. If they are CHAR, you need to strip trailing blanks before concatenating:(You could omit the last CLIPPED.) This also assumes there are no spaces in the file names or locations. You have to work a bit harder if spaces can be present; you have to work considerably harder if you need to deal with quotes or newlines (etc) in the file names.