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

RE: Help: Transfer file error using FTPAPI



Hi, Martina:

> Yes, I do transfer data from the pc to AS400, and the program in on
> AS400 and gets data from PC.
> I do use binary mode to transfer data and the file is a text file.
> 
> What happens is that I get the entire file size (all the lines of the
> text file), but every line is truncated at 1024 bytes.
> 
> I understand that it may sound strange, but that is what actually
> happens.
> 
> Do you have any hint for me on what I do wrong ...???

OK, so the below assumes you are transferring the file to LIBRARY/FILE(MEMBER) (perhaps with different syntax), and not to the IFS.

I assume also that the file does not exist before the transfer; it's being created by FTPAPI "on the fly."

Finally, I assume your PC file has CR/LF at line end.  If not then ignore the comment about ASCII mode.

Since FTP is a stream protocol, FTPAPI has to guess at record lengths when the file doesn't exist.  Apparently it creates a 1024-byte file.  (I don't have ready access to the source to check that at the moment.)  What I would do instead, is to use CL command 'CRTPF' to create the file before the transfer, with the attributes that you want.  

And then I would use ASCII mode instead of binary if you have CRLF in the input.  That way, if your spacing between CRLF is not consistent, the API will correctly handle end of line. 

The drawback to ASCII mode (if it's a drawback) is that there will be no CRLF copied into the target file.

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
We are born naked, wet and hungry.  Then things get worse. 
> 
> 
> 
> Cordialmente
> ______________________________________________
> Martina Alagna
> ArtMatica Italia srl
> 
> uff.  06.4060.667
> cell. 348-0341087 e-mail m.alagna@xxxxxxxxxxxx http://www.artmatica.it
> P "Rispetta il tuo ambiente, pensa prima di stampare questa e-mail"
> " Please consider your environmental responsibility before printing
> this e-mail
> 
> 
> 
> -----Messaggio originale-----
> Da: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-
> bounces@xxxxxxxxxxxxxxxxxxxxxx] Per conto di Dennis Lovelady
> Inviato: domenica 1 luglio 2012 14:35
> A: 'HTTPAPI and FTPAPI Projects'
> Oggetto: RE: Help: Transfer file error using FTPAPI
> 
> > I use the get FTPAPI to transfer files from pc to as400; everything
> > goes fine besides for the file record length: I get a file record
> > length smaller on the AS400  than the original length on the PC.
> >
> >
> >
> > The record length on the PC is 1639 bytes, on the AS400 the GET
> > transfers only 1024 bytes.
> >
> >
> >
> > What should I do to transfer the whole 1639 bytes record length ???
> 
> 
> Are you transferring binary data?  Are you transferring in binary mode?
> 
> May we have just a little more detail about the transfer itself, please?
> 
> And just to be sure . . . when I read this, it sounded like you were
> initiating this from the PC.  That would mean you're not using FTPAPI
> since it works as a client, not a server.  So, my question: This is a
> program on the AS/400 that uses FTPAPI to pull data from the PC, right?
> 
> Dennis Lovelady
> http://www.linkedin.com/in/dennislovelady
> --
> "The radical of one century is the conservative of the next.  The
> radical invents the views.  When he has worn them out the conservative
> adopts them."
>         -- Mark Twain
> 
> 
> 
> -----------------------------------------------------------------------
> 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
> -----------------------------------------------------------------------

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