[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with FTP_GET, FTP_BINARY when downloading mixed file types



Hi Pieter,

I'm doing a similar type of program with FTPAPI to get PTFs from IBM.  I 
ask for a list of files in the directory, and the ones that end in .txt 
are downloaded in ASCII mode, the the others (which are CD images) are 
downloaded in binary mode.

Works without a problem for me.

In order to take this any further, I need to reproduce the problem. 
Please send me a complete, working program that reproduces the problem. 
  This should be a program that I can load/run on my system, so I can 
see the actual problem and debug the code.

Thanks


On 5/25/2010 11:06 AM, Henrico, Pieter wrote:
>
>     Hi
>
>
>
>     I have used the FTPAPI to write an application that basically does the
>     following:
>
>
>
>     1. Link to a remote server
>
>     2. Pull down a list of all files using a specified filename selection
>     (eg File*.*)
>
>     3. Start working through the list:
>
>
>
>     a. ASCII Data
>
>     - If the file is a .TXT file, set the mode to ASCII
>
>     - Download the file directly into the library
>     (/QSYS.LIB/LIBRARY.LIB/FILENAME.FILE/FILENAME.MBR)
>
>     - Submit a post-processing job over the downloaded file
>
>
>
>     b. BINARY DATA
>
>     - If the file is a zip file, set the mode to BINARY
>
>     - Download the file into the IFS (/tmp/zip/filename.zip)
>
>     - Unzip the downloaded file to a temporary space in the IFS
>
>     - For each file inside the ZIP file:
>
>     --- Create an empty PF inside the library
>
>     --- Use CPYTOIMPF to get the data into the PF inside the library
>
>     --- Submit the post-processing job over the file PF inside the library
>
>
>
>     c. If the previous steps were fine, delete the file on the remote FTP
>     server
>
>     d. Loop again
>
>
>
>     The problem is that if the program ONLY pulls down .txt files, or ONLY
>     .zip files, the process works correctly.  However, the moment that the
>     program has to download both .ZIP and .TXT files, things tend to
>     break.  The files are downloaded, but the ZIP files are corrupt, and
>     do not want to unzip (the text files are fine).  If the program only
>     downloads ZIP files, the unzip function work correctly.
>
>
>
>     I have done a low-level debug on the process, and I can see that the
>     FTP server does respond with a code 200 (Type set to I) when doing the
>     ZIP files.  However, the binary transfer is clearly not working
>     correctly.  I also thought that the problem might be actually related
>     to the FTP server itself, and has done these steps manually using
>     normal FTP, but then the unzip function works correctly (currently on
>     V6R1 for the OS).
>
>
>
>     Does anybody have a similar experience, and any idea on how to resolve
>     this?
>
>
>
>     Thanks
>
>
>
>     Pieter
>
>
>
>
>
>
>     The information contained in this email is confidential and may
>     contain proprietary information. It is meant solely for the intended
>     recipient. Access to this email by anyone else is unauthorised. If you
>     are not the intended recipient, any disclosure, copying, distribution
>     or any action taken or omitted in reliance on this, is prohibited and
>     may be unlawful. No liability or responsibility is accepted if
>     information or data is, for whatever reason corrupted or does not
>     reach its intended recipient. No warranty is given that this email is
>     free of viruses. The views expressed in this email are, unless
>     otherwise stated, those of the author and not those of HYPHEN
>     Technology (Pty) Ltd or its management. HYPHEN Technology (Pty) Ltd
>     reserves the right to monitor, intercept and block emails addressed to
>     its users or take any other action in accordance with its email use
>     policy.
>
>
>
>
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------