ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

FTP Trap failed GET

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • FTP Trap failed GET

    I'm a novice at best with FTP and need to know how to trap an FTP error.

    My code is;
    G Orders.xml (REPLACE
    DELETE Orders.xml


    This code works just fine most of the time.
    We're having a situation that an Orders.xml will show up after the Get fails from the file not being there and the DELETE occasionally is deleting an unprocessed file. OOPS!!!

    I need to NOT DELETE if the G(et) fails

    Here's a failure example;

    > G Orders.xml (REPLACE
    229 Entering Extended Passive Mode (|||43422|)
    550 File not found
    Enter an FTP subcommand.
    > DELETE Orders.xml
    550 File not found
    Enter an FTP subcommand.

    I'm hoping that an IF can be used to condition the Delete, but if how to do this is out there, it's hidden from GOOGLE!!!!!

    Thanks everyone for your time,
    Gary

  • #2
    Re: FTP Trap failed GET

    FTP is a simple file transfer mechanism, used to transfer files around, it's not a programming language. As such, it has no IF statement.
    If you wish to check for a file not found condition, you'd need to do it in 2 parts. The first part would be the get, then your program could read the output from the transfer session and check if it worked before initiating the delete.

    Comment


    • #3
      Re: FTP Trap failed GET

      Scott Klement has an open source project FTPAPI http://www.scottklement.com/ftpapi/

      It will allow you to do the error checking you want.

      Comment

      Working...
      X