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

RE: Help: Transfer file error using FTPAPI



> Your assumptions are correct. The file is created on the fly by FTPAPI;
> I know I can create the file before the get, but I would like to avoid
> it.
> What I assumed is that there is some kind of parameter in the FTPAPI,
> that I could change or set to avoid the fixed 1024 length.
> Could you give me any other hint to solve the problem ???

You could go into the source for FTPAPI and change that default.  But what value would fit all situations?

Not sure what your objection is to using CRTPF; would you mind sharing?  But that is what will happen if you don't do it explicitly... and as you’ve seen, assumptions must be made by the API if it is to take the action.

I've mentioned before: FTP doesn't have a "record" concept.  (For that matter, few systems have that concept inherently.  Mainframe and the i family, of course, but what else?  But I digress.)  If you wanted to implement an auto-build-right-size in the API, you'd have to buffer up all the data until you ascertained the maximum record length (which I presume would mean, read to the end).  Then create the file with the determined characteristics, then dump the buffer to it.  That could be done, but I expect it's wildly unusual, and for what benefit?

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
All programmers are playwrights and all computers are lousy actors. 


> 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
> -----------------------------------------------------------------------
> 
> -----------------------------------------------------------------------
> 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
-----------------------------------------------------------------------