I have a set of scripts, functions and operations performing price updates to my database. It is run on a timer every 20 seconds. The function below runs OK for the first few times it is called and then it just stops. It would seem I am having memory or storage problems when I use this ftp batch script.
If I run it manually I get an error message that is attached.
Any idea how I can fix this?
Thanks
'-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FUNCTION ftpbatchscript AS C (Address as C, User as C, Password as C, Source_File as C, Destination_File as C , unused_Modal =.t., unused_Title="" )
'Description:Similar to A5 function, but no dialogs are used so it can run unattended. Always runs modal. just return value.
'the difference with a5 function is so this can run modally and silently in xbasic, with no need to respond to dialogs.
'unused_Title parameter is not used because there are no dialogs. retained for parameter compatibility.
'always run modal=.t. so there is no need to deal with FTPstatus parameter.
'filename is case sensitive
dim datefield as c=dtos(date())
dim fns as c = "/prices/"+alltrim(datefield)+"//"+datefield+"_hour"+left(time(),2)+".csv"
dim fnd as c = a5.get_path()+"\prices\"+"checkprices.csv"
Dim ftpscript as C
Dim vReturn as C
ftpscript = <<%code%
connect|[url]
onerror|error|Could not connect
login|[user]|[pw]
onerror|error|Could not log in
get|[sourcefile]|[destfile]
onerror|error|Could not transfer file
quit
%code%
ftpscript = stritran(ftpscript,"[url]",address)
ftpscript = stritran(ftpscript,"[user]",user)
ftpscript = stritran(ftpscript,"[pw]",password)
ftpscript = stritran(ftpscript,"[sourcefile]",source_file)
ftpscript = stritran(ftpscript,"[destfile]",destination_file)
vReturn = ftp_script_run_silent(ftpscript, .t.)
ftp_get_filex = vReturn
END FUNCTION
If I run it manually I get an error message that is attached.
Any idea how I can fix this?
Thanks
'-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FUNCTION ftpbatchscript AS C (Address as C, User as C, Password as C, Source_File as C, Destination_File as C , unused_Modal =.t., unused_Title="" )
'Description:Similar to A5 function, but no dialogs are used so it can run unattended. Always runs modal. just return value.
'the difference with a5 function is so this can run modally and silently in xbasic, with no need to respond to dialogs.
'unused_Title parameter is not used because there are no dialogs. retained for parameter compatibility.
'always run modal=.t. so there is no need to deal with FTPstatus parameter.
'filename is case sensitive
dim datefield as c=dtos(date())
dim fns as c = "/prices/"+alltrim(datefield)+"//"+datefield+"_hour"+left(time(),2)+".csv"
dim fnd as c = a5.get_path()+"\prices\"+"checkprices.csv"
Dim ftpscript as C
Dim vReturn as C
ftpscript = <<%code%
connect|[url]
onerror|error|Could not connect
login|[user]|[pw]
onerror|error|Could not log in
get|[sourcefile]|[destfile]
onerror|error|Could not transfer file
quit
%code%
ftpscript = stritran(ftpscript,"[url]",address)
ftpscript = stritran(ftpscript,"[user]",user)
ftpscript = stritran(ftpscript,"[pw]",password)
ftpscript = stritran(ftpscript,"[sourcefile]",source_file)
ftpscript = stritran(ftpscript,"[destfile]",destination_file)
vReturn = ftp_script_run_silent(ftpscript, .t.)
ftp_get_filex = vReturn
END FUNCTION
Comment