Is an FTP finished?

85 pts.
Tags:
RPG
If a file is being FTP'ed into a file in the IFS of the iSeries, how can I tell from a CL program when the transfer is complete?

Answer Wiki

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

If you use the DSPLNK command for the IFS path, you can specify OUTPUT(*PRINT) which will generate a listing of all the files in the folder.

If you copy the spool file (QSYSPRT) to a database file, your CL program can then read through the listing to determine whether or not the file has arrived.

I’ve used this method on many an occasion.

All the best

Jonathan

Discuss This Question: 8  Replies

 
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
  • Dasi4jpm
    Jonathan, Thanks for your suggestion and it will be helpful to me. However, it slightly misses the point of my question. If a large file is being sent via FTP, how do I know if the entire file has been transferred? For example, if I try to copy the FTP target file, and the transfer is still taking place, will I be locked out from doing the copy?
    85 pointsBadges:
    report
  • Baardbasma
    I dont think you can. One way to avoid this problem is that the sending system put files with an extension eg. "xxxxxx.wrk" and when the file is completely transfered it renames the file to "xxxxxx.rdy". At your side you only read files that has the ".rdy" extension. By doing it this way you should be confident that you only receives files that are completely transfered.
    0 pointsBadges:
    report
  • ITAddict
    I read this somewhere and put it in my outlook notes. I don't recall the details. FTP - batch technique OVRDBF INPUT OVRDBF OUTPUT Scan OUTPUT for word 'successful'
    875 pointsBadges:
    report
  • Recuyer
    if you can change hte ftp script that put the file (ifs or not), you can just add a APPEND to a file (ISERIE) wich as a trigger on it. A record with field like this : FILE DATE TIME STATUS PATH (if IFS) In the trigger : If STATUS = OK, the Call CL associated withe the FILE... In this way you can easy manage a history of file transfer... Just an idea.
    0 pointsBadges:
    report
  • RickMe
    Are you receiving this file or sending this file? If you are sending you can check for FTP message 226, which indicates that the transfer is complete. Before starting the FTP session, override file OUTPUT to a file member on your system (usually libname/QFTPSRC(membername)). This will cause the output of the FTP session to be written to this member. Then after the FTP session is over, read the member, and message 226 indicates that the transfer is complete.
    110 pointsBadges:
    report
  • Dasi4jpm
    Sorry that I didn't clarify that my program is at the receiving end of the FTP transmission. My program will process the file by doing a MOV and then a CPYFRMSTMF. What I am looking for is an easy test in CL to determine that the FTP transmission to the file has completed before I do the copy. I have just tried to use the CHKOUT CL commnad and that seems to issue an escape message if the FTP is still taking place. This seems to be what I need. Is anyone familar with the CHKOUT who can verify this usage?
    85 pointsBadges:
    report
  • Dushan
    I've seen a simpler method (i.e. without having to use CHKOUT). Request a blank file (signal file) to be sent when transfer is complete and monitor for the signal file. If you see the signal file, it means the sender acknowledges the fact that everything has been transferred as required.
    0 pointsBadges:
    report
  • TomLiotta
    My first guess would be to call the Retrieve Object References (QP0LROR) API to see if any FTP job still has a reference to the file. CHKOUT might succeed or fail depending on various circumstances at different points in the transfer. And you'll want to make sure that you issue a CHKIN if CHKOUT succeeds. Tom
    125,585 pointsBadges:
    report

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