I am using a control job that reads parameters form a parameter.ini file. The server job is to get a zip file, unzip to a folder, copy certain files to another folder, and write those records to a table. My trouble is getting the zip file from an ftp site. I have created a .bat file which the control job reads.
the copy.bat text is:
open 10.10.10.10
user
username
password
lcd D:\tote\holfolder\holzip
mget *18*.zip
y
y
y
quit
If I run this code at a dos prompt and type:
D:\ftp -n -s:copy.bat
it will go to the ftp site and put the zip file in the holzip folder.
In my control job at the CALL DSExecute I have
CALL DSExecute(sFTP_COPY_Parm,"ftp -n -s:copy.bat " , "Job Control")
Where the sFTP_COPY_Parm = D:\ and the copy.bat file is located on the d drive.
The error I receive is 'D:\ftp -n' is not a recognized command.
Any idea on the syntax needed to open an ftp and extract the file using DSExecute would be very helpful.
Thanks!!!
Getting data from an ftp address
Moderators: chulett, rschirm, roy
Getting data from an ftp address
SWKYDERBY
Re: Getting data from an ftp address
Put your ftp command in a batch file and use the full path to this batch file to execute it via DSExecute.
Also use the full path to copy.bat
Ogmios
Also use the full path to copy.bat
Ogmios
In theory there's no difference between theory and practice. In practice there is.
Check the syntax for the DSExecute command. You need four parameters, only one of which is the command to execute.
First parameter is the O/S, in your case "DOS". Second is the command(s) to execute. Third is an array to hold any screen output from the command and lastly the parameter that holds the status of the command that was executed.
First parameter is the O/S, in your case "DOS". Second is the command(s) to execute. Third is an array to hold any screen output from the command and lastly the parameter that holds the status of the command that was executed.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Thanks for the replies. Here is the piece of coding that I using to try and connect to an ftp site along with the .bat file. I made a couple of changes and the job get hung.
Any suggestions!!!
*Copy bay file to a local drive
Call DSLogInfo("Copying files by calling batch script via DSExecute command...", "Job Control")
Call DSLogInfo("Executing script to copy files from source data dir to copy to dir ", "Job Control")
Call DSExecute("NT",sFTP_COPY_Parm:"copy_Hol.bat ", msgs, rtncd)
Call DSLogInfo("Executing command - ":sFTP_COPY_Parm:"copy_Hol.bat ", "Job Control")
Call DSLogInfo("msgs is ":msgs, "Job Control")
Call DSLogInfo("rtncd is ":rtncd, "Job Control")
sFTP_COPY_Parm: is set D:\
Copy_Hol.bat file
ftp -n
open 10.10.10.10
user
username
password
lcd D:\Tote_Raw\Hollywood\Hol_zip
get *18*.zip
y
y
y
quit
Any suggestions!!!
*Copy bay file to a local drive
Call DSLogInfo("Copying files by calling batch script via DSExecute command...", "Job Control")
Call DSLogInfo("Executing script to copy files from source data dir to copy to dir ", "Job Control")
Call DSExecute("NT",sFTP_COPY_Parm:"copy_Hol.bat ", msgs, rtncd)
Call DSLogInfo("Executing command - ":sFTP_COPY_Parm:"copy_Hol.bat ", "Job Control")
Call DSLogInfo("msgs is ":msgs, "Job Control")
Call DSLogInfo("rtncd is ":rtncd, "Job Control")
sFTP_COPY_Parm: is set D:\
Copy_Hol.bat file
ftp -n
open 10.10.10.10
user
username
password
lcd D:\Tote_Raw\Hollywood\Hol_zip
get *18*.zip
y
y
y
quit
SWKYDERBY
Hi,
I feel the problem is in following command.
Call DSExecute("NT",sFTP_COPY_Parm:"copy_Hol.bat ", msgs, rtncd)
have you tried passing a different parameter for the second argument, namely sFTP_COPY_Parm:"copy_Hol.bat ".
Try to pass something like "dir > c:\testfile" in second argument to DSExecute.
Then see if you get the output of this command in a file.
This will help you in finding if you are passing the argument correctly.
Ketfos
I feel the problem is in following command.
Call DSExecute("NT",sFTP_COPY_Parm:"copy_Hol.bat ", msgs, rtncd)
have you tried passing a different parameter for the second argument, namely sFTP_COPY_Parm:"copy_Hol.bat ".
Try to pass something like "dir > c:\testfile" in second argument to DSExecute.
Then see if you get the output of this command in a file.
This will help you in finding if you are passing the argument correctly.
Ketfos
I haven't used the DSExecute to do this, but we do something similiar with the command stage and ftp in our jobs, using almost the same syntax
Don't know if this helps in any way.
Code: Select all
ftp -s:d:\ldrfiles\ftp_scripts\lind