0 pts.
 FTP with RPG
I have a file which should be ftped to another server.I have the ftp script.Can you suggest 1.code to automatically ftp the file to another server 2.also to send email alerts using snddst if ftp fails.

Software/Hardware used:
ASKED: November 26, 2008  9:46 AM
UPDATED: November 26, 2008  1:45 PM

Answer Wiki:
Hi, 1. To run the FTP job :- <b> /* Override FTP to use your script file */ OVRDBF FILE(INPUT) TOFILE(YOURLIB/YOURFILE) MBR(YOURMEMBER) /* Override FTP to output to a database file */ OVRDBF FILE(OUTPUT) TOFILE(QTEMP/FTPLOG) /* Run the FTP process */ FTP RMTSYS(HostName_OR_IPAddress) /* Remove the file overrides */ DLTOVR *ALL </b> 2. To check the transfer you will need to write a program to check the results of the FTP transfer in QTEMP/FTPLOG. Here's an overview of the type of result messages from FTP :- Message . . . . : 250 Now using naming format "0". Cause . . . . . : This message is a reply from the FTP server. The server reply consists of a three-digit number, referred to as the reply code, followed by some message text. If VERBOSE mode is off, the reply code may not be displayed. There should be at least one server reply for each FTP command that is sent to it by the client. The three digits of the reply code have a special significance. The first digit denotes whether the response is good, bad, or incomplete. There are five values for the first digit: 1yz - Positive Preliminary: The requested action is being initiated, another reply should follow. 2yz - Positive Completion: The requested action was successfully completed. A new request may be initiated. 3yz - Positive Intermediate: The command was accepted, but the requested action is being held, pending receipt of further information. 4yz - Transient Negative Completion: The command was not accepted and the requested action did not take place, but the error condition is temporary and the action may be requested again. 5yz - Permanent Negative Completion: The command was not accepted and the requested action did not take place. Technical description . . . . . . . . : The above definitions of reply codes are from RFC 959, which defines the File Transfer Protocol. For more additional information, please consult RFC 959 and RFC 1123. So you just need to check the first character of the results for the values 1 - 5. Regards, Martin Gilbert.
Last Wiki Answer Submitted:  November 26, 2008  10:37 am  by  Gilly400   23,625 pts.
All Answer Wiki Contributors:  Gilly400   23,625 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _