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

Re: another bug in FTPAPI



Sender: Scott Klement <sk@xxxxxxxxxxxxxxxx>


Originally, OpnFile() was a very simple routine! Over time, many little changes have been made to it to fix specific things here and there, and the result is a very ugly, sloppy routine that I don't like at all! It should be broken into many simpler routines instead of the big ugly mess that it is now!


But, I agree with you, it should be wkEBCDICF_cp not wwCP.

Also, I think if the user specifies a codepage via FTP_codePage() or FTP_codepg() -- in other words, if wkUsrXLate=*ON, we should be changing existing files to that codepage using CHGATR.

Though, rather than code pages, we should be using CCSIDs throughout!

Also, OpnFile() should be using FTP_codePage() rather than FTP_codepg(). I don't remember why that was left unchanged, though... there may have been a reason?

---
Scott Klement  http://www.scottklement.com



On Mon, 22 May 2006, Christian wrote:

Sender: Christian <chrisv5@xxxxxx>

Hello Scott,

I found another bug in FTPAPI, mainly concerning ASCII GETs with custom code pages. I found that when I do a GET from the FTP server and specify my own code pages (usually 819 -> 819), the files get translated correctly (actually, not at all), but the files in the IFS end up with a (wrong) code page of 37. The bug is in OpnFile():

B02 c                   if        wkUsrXLate = *Off
   c                   callp     ftp_codepg(DFT_RMT_CP: wwCP)
   c                   eval      wkUsrXlate = *Off
E02 c                   endif
E01 c                   endif

    * codepage of new stream files:
B01 c                   if        wkBinary = *On
   c                   eval      wwNewCP = wkASCIIF_cp
X01 c                   else
   c                   eval      wwNewCP = wwCP
E01 c                   endif

The line before the last in this piece of code should read

c eval wwNewCP = wkEBCDICF_cp

In the case of non-custom code pages it'll be wwCP anyway (set a few lines above in the ftp_codepg; which is deprecated, btw *wink*).

This bug does not matter if you process it from a PC later on, or you do a CPYFRMSTF with STMFCODPAG(*PCASCII), etc. But it is bad if you do an open() or a CPYFRMSTMF with STMFCODPAG(*STMF), or something similar.

Regards,
Christian
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------