FTP with RPG

pts.
Tags:
AS/400 FTP
RPG
RPG/400
Send Distribution
SNDDST
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.

Answer Wiki

Thanks. We'll let you know when a new response is added.

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.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following