Focal Point
[CLOSED] Trying to run FTP script from a FEX

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1617084295

October 27, 2010, 01:53 PM
BrianFromDenso
[CLOSED] Trying to run FTP script from a FEX
Hi, first of all, sorry for the n00b question.

I am trying to use -DOS to run a *.BAT file that contains a small FTP script. The .bat file will run by itself, so that is OK. The FEX has just this:

-DOS C:\SCRIPTS\HCM864CLR.BAT

When I run it, I get a No HTML Output with the following details:

C:\ibi\srv76\wfs\edatemp\ts000016>ftp -s:HCM864CLR.bat
Error opening script file HCM864CLR.bat.
Transfers files to and from a computer running an FTP server service
(sometimes called a daemon). Ftp can be used interactively.
FTP [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-A] [-x:sendbuffer] [-r:recvbuffer] [-b:asyncbuffers] [-w:windowsize] [host]
-v Suppresses display of remote server responses.
-n Suppresses auto-login upon initial connection.
-i Turns off interactive prompting during multiple file
transfers.
-d Enables debugging.
-g Disables filename globbing (see GLOB command).
-s:filename Specifies a text file containing FTP commands; the
commands will automatically run after FTP starts.
-a Use any local interface when binding data connection.
-A login as anonymous.
-x:send sockbuf Overrides the default SO_SNDBUF size of 8192.
-r:recv sockbuf Overrides the default SO_RCVBUF size of 8192.
-b:async count Overrides the default async count of 3
-w:buffer size Overrides the default transfer buffer size of 65535.
host Specifies the host name or IP address of the remote
host to connect to.
Notes:
- mget and mput commands take y/n/q for yes/no/quit.
- Use Control-C to abort commands.
C:\ibi\srv76\wfs\edatemp\ts000016>OPEN SALES
'OPEN' is not recognized as an internal or external command,
operable program or batch file.
...

At this point, it reads through the .bat file and says each command in the FTP script is not recognized as an internal or external command, so it is finding and reading the file. Do I have to specify that this is an FTP script somehow before the -DOS command? Any help will be greatly appreciated. Thanks,

Brian

This message has been edited. Last edited by: Kerry,


We are on WebFocus 8.0.0.8M running on Win server 2008, and retrieving most data from our AS/400.
October 27, 2010, 02:35 PM
jfr99
Hi Brian,

Here's an example of what I use. This builds the ftp script in the fex and then runs the script.

-*
-** CREATE FTP SCRIPT - xyz_ftpscr.txt
-*
FILEDEF FTPSCR DISK xyz_ftpscr.txt
-RUN
-WRITE FTPSCR open xyz_box
-WRITE FTPSCR xyz_userid
-WRITE FTPSCR xyz_pswd
-WRITE FTPSCR put xyz_file.txt
-WRITE FTPSCR quit
-CLOSE
-*
-** RUN FTP SCRIPT - xyz_ftpscr.txt
-*
DOS ftp -i -s:xyz_ftpscr.txt
-RUN

Hope this helps.
Jim


WebFocus 8.201M, Windows, App Studio
October 27, 2010, 03:19 PM
Tony A
Brian,

It wold appear that you have a circular reference to the HCM864CLR.bat file.

The command ftp -s:HCM864CLR.bat would mean run the ftp command using the file HCM864CLR.bat as the input to ftp. which would just try and feed "ftp -s:HCM864CLR.bat" to the ftp command processor.

In reality what you should be doing is have two files, the HCM864CLR.bat file containing the command -

ftp -s:HCM864CLR.ftp

And a file HCM864CLR.ftp containing your FTP commands -

open domain.com
userid
password
cd [directory that you want at the ftp location]
lcd [directory that you want at the local location] ----> bear in mind that this will be running on the reporting server and NOT your local PC
get filename.extn
put filename.extn
quit

That should give you an idea of what you need to do. If you have trouble then just enter into FTP via a DOS prompt and make a note of what comands you have to enter to achieve the result that you require. Then place those commands (taking account of the note above) into the HCM864CLR.ftp file.

Also check out the use of SYSTEM instead of just using DOS or CMD or !. SYSTEM will allow you to capture the return code from your DOS command and test it for redirecting processing to error traps etc. It will also wait for the command to return control to the WF process. The normal CMD will just execute the command and not wait around for the response.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10