|
I have a socket server program that accepts ascii data from a client.
After receiving a complete, varying length string, I write it out to the IFS using a prototyped call to the '_C_IFS_fputs' API.
Everything works fine except that if within my string, a percent sign (%) exists (ascii hex 25), when written to the IFS a carriage return (hex 0D) is added preceding the percent sign. I have two percent signs in the string and both are preceded by the carriage return. (This is causing data to be prematurely terminated by applications that read from the IFS.)
I've reviewed the source data with a hex editor to ensure that the carriage return isn't in the source data (and tested this on more than one input file). There are no carriage returns except for those that are where they are supposed to be. I've even reviewed the data in the wdsci debugger using the memory monitor and rendering to ensure the value to be written to the ifs doesn't contain the rouge carriage return (and it doesn't).
At the moment my source data (testing only) is coming from my pc. That implies code page 1252. My IFS folders show ccsid 437 (pc ascii) but the files themselves default to ccsid 37 (unless after the write I do a chgatr to change it to 437 or 819 - and I've tried both).
I suspect that my RPG program being in EBCDIC (ccsid system value is 37) is somehow causing this behavior. Or is it the API doing the write to the IFS?
If so how do I write the data with the proper ccsid or do I need to 'translate' the data somehow before writing it to the IFS?
Or is there something else that might be suspect?
Any ideas greatly appreciated.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.