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

Re: another bug in FTPAPI



Sender: Christian <chrisv5@xxxxxx>

Hello Scott,

I fully agree with you on everything. Actually, my small fix does not solve the entire problem. If the file already exists and has a wrong code page / CCSID (which happens all too often, at least here in Austria where people got told again and again by IBM to set their NetServer CCSID to 850), the wrong CCSID will be kept. One would need to check wwExists, differeing CCSIDs, etc. and two one of two things: either delete the existing file (the simple solution) or change the CCSID of the file with Qp0lSetAttr (the more elegant way, but requiring more code lines). Oh well, you mentioned that already in your reply, sorry. Anyway, I am willing to implement either, if you tell me your preference.

Speaking of "old and sloppy code"... I have found you pretty often (if not always) append the x'00' to strings yourself (and have to remove it at other times) and pass %addr(string) to the various IFS APIs. I guess that is due to historical reasons, when there was no Options(*String)? Another thing which could be "fixed" probably.

I would not mind to do some fixing to various procedures, if you tell me which and your general preferences. I would do that as sort of "pay back" for the tremendous help I got from your FTPAPI (btw, I am also in need of the SSL changes; will wait patiently, though).

Another question: do you still deem it necessary to maintain compatibility to V4R4 (you seem to question it yourself on your web site), or should we move to free form and some neater coding styles, e.g. qualified DS, in new code?

Oh yes, while we are talking... you mentioned replacing code pages with CCSIDs. Well, I always wanted to ask someone... what's the subtle differences between them? I have to say that I am new to iSeries programming... CCSIDs seem to be very unique to IBM. However, I do not really tackle the difference between code page 819 and CCSID 819? Pardon my ignorance in advance.

Regards,
Christian


Scott Klement wrote:
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
-----------------------------------------------------------------------


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