That's good, but I already have that portion (even creates the script "on-the-fly" to ensure file names are unique with date/time as part of the name).
Where the problem comes in is that the file being sent needs to go to a secured, FTP access denied shared drive. My approach is to FTP the file into a non-secured folder and have the execution of a .bat file to copy it onto the secured folder. I want to kick off the bat file from the same job doing the FTP. (Sarbanes Oxley making life more complex than it needs to be again!)
You'll need to create a 'script' file with your FTP commands in it. You can just create a file with all the commands or if you need to do different transfers you can write a program to build the file for you. In either case you will need something along the following lines :-
put local_file remote_file
get remote_file local_file
Where userid = userid on remote machine, password = password on remote machine, remote_directory = directory or library on remote machine, local_library = library on local machine, local_file = file name on local machine and remote_file = file name on remote machine.
This is basically the same order as you would do things in a manual FTP session. You may also need other commands like BIN, ASCII, etc depending on what you're going to transfer and where you're transferring to.
Once you have your script file in place, you will need to be able to execute it. Best to create a small CL program with the following :-
/* Override FTP input to your script file */
OVRDBF FILE(INPUT) TOFILE(YourLibrary/YourScript)
/* Override FTP output to a log file - if you don't do this messages go to the screen interactively or to the qsysopr message queue from batch */
OVRDBF FILE(OUTPUT) TOFILE(YourLibrary/LogFile)
/* Start FTP with a hostname or FTP address */
/* Remove the overrides */
This should get you up and running with scripted FTP.