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

Re: CCSID Changes during ftp_get



Hi Duane,

Yes, it would be nice if FTPAPI could set the CCSID of the local file to 
the same CCSID as the file it's downloading.  That would be awesome! 
Unfortunately, FTPAPI has no way to find out what that CCSID should be. 
  The FTP protocol does not have a mechanism to report the CCSID of the 
remote file, therefore FTPAPI has no way to know what that CCSID is, and 
consequently it can't set it to the same CCSID on the local side.

Please understand that CCSID is an IBM-only concept.  It's not used 
outside of IBM systems.  FTP was not designed purely for OS/400, it was 
designed as a general purpose tool for all systems.  And since the other 
(inferior, IMHO) operating systems have no notion of CCSID, it's not 
part of the FTP protocol.

Your best bet is to set the CCSID after the download.  The CHGATR CL 
command can do this.
     CHGATR OBJ('/path/to/myfile.txt') ATR(*CCSID) VALUE(37)

Alternately, pre-create the local file with the correct CCSID, if you do 
that, FTPAPI should keep the CCSID you specified.

Also... this isn't really related to the problem, but FWIW...  1252 is 
Windows Latin-1 ASCII, it's not Unicode.


Christen, Duane wrote:
>    Scott, et all.
> 
>    I am using the FTP api, version 2.2, to pull files from one IBM i to
>    another, the CCSID of the original file is 37 (and the data is in
>    CCSID 37), but when ftp_Get pulls the file, it's CCSID is set to 437
>    but the data is still in CCSID 37. I set the ftp_BinaryMode to *ON
>    before the get and the job log reflects the binary setting.
> 
>    Am I missing something on the get?
>    Should I be using binary mode in the transfer?
> 
>    This has been working for years but because we have a new vendor that
>    is sending files in uni-code (CCSID 1252) we had to change the file
>    open to include the O_TEXTDATA flag so that the open would convert
>    those files which come through a web service to CCSID 37, these are
>    working fine. Because the FTPed files have a CCSID setting of 437, but
>    the actual data is in CCSID 37, fun occurs.
> 
>    Thanks
>    Duane
> 
> 
> 
>    --
> 
>    [shim.gif]
> 
>    [shim.gif]
> 
>    [shim.gif]
> 
>    [shim.gif]
> 
>    [My_PAETEC_signature_r1_c1.gif]
> 
>    [My_PAETEC_signature_r1_c2.gif]
> 
>    [1]Visit PAETEC.COM 
> 
>    [shim.gif]
> 
>    Duane Christen
>    Senior Software Engineer
>    (319) 790-7162
>    [2]Duane.Christen@xxxxxxxxxx
> 
>    [shim.gif]
> 
>    [My_PAETEC_signature_r3_c1.gif]
> 
>    [shim.gif]
> 
> References
> 
>    1. http://www.paetec.com/
>    2. mailto:Duane.Christen@xxxxxxxxxx
> 
> 
> 
> ------------------------------------------------------------------------
> 
> -----------------------------------------------------------------------
> 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
-----------------------------------------------------------------------