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

re: Trim local file to recordlength on ftp_get()



Before sending the file, you could create a flat file record length of the physical file + 2.

Read the physical as a flat file, and append a hex code '0D0A' (crlf) to the end of each record and write the record to the new flat file.

Then send the new file, it will have the CRLF in it.


-------- Original Message --------
> From: M.Effenberg@xxxxxxxxxxxx
> Sent: Friday, October 19, 2007 7:15 AM
> To: HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
> Subject: Trim local file to recordlength on ftp_get()
> 
> Hi Scott, Hi all,
> i have a problem with long files i get from one customer.
> 
> All my filetransfers are based on physical files with members into which I 
> download the files I get (so no IFS here).
> 
> The problem with this is, that these physical files have a fixed 
> recordlenght.
> Usually we agree upon a fixed recordlength with our customers and then 
> make our local files on the as400 that long.
> 
> Now this customer has no CRLFs in their files and I sometimes get up to 
> 50k text in one line.
> Since my file on the as400 is just 512 byte long, ftp_get() gets me just 
> one line of text with 512byte.
> The rest of the file vanishes :)
> 
> I now tried binary mode, but then I receive 512 bytes of ascii...
> 
> Is there a way to start a new record when a record in my local file is 
> full?
> I thought about ftp_getraw() with my own write() function, that makes new 
> records if one record in my physical file is full, 
> but I just can't believe that I'm the only one with this problem :)
> Or maybe I'm doing something wrong here.
> 
> thanks in advance for pointing me in the right direction.
> 
> best regards,
> - Martin
> -----------------------------------------------------------------------
> 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
-----------------------------------------------------------------------