× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 1/7/2011 3:40 PM, Mike Wills wrote:
I am using Scott's documentation to create IFS files.

As usual... it's all my fault. :(


D buffer S 256A
...snip...
if (write(fd:%addr(buffer):%size(buffer))< %size(buffer));

%size(buffer) will evaluate to 256. Always.

So if your CSV data occupies (for example) the first 150 bytes of 'buffer'. and the 'eof' (which probably should be named 'eol' or 'eor') field takes up 2 more bytes, then the remaining 104 bytes of 'buffer' will be blank and written after the CRLF characters (which means they'll be placed in the next "record")


In debug, the spaces are not there. Any ideas?


Wanna bet?! Unless the contents of buffer is exactly 256 bytes long, those spaces are there. Unless you use a VARYING field, they'll ALWAYS be in the variable. That's just how RPG works... that part has nothing to do with IFS. And they'll always show up in debug!

Now, you could prevent them from being WRITTEN to the IFS file -- by using a shorter length in the 3rd parm for write(). So you can prevent them from being written -- but there's no way to remove them from the variable itself, and therefore even if you fix your problem, you'll *still* see these spaces in debug!

But, because the CRLF characters determine when a "record" ends, the spaces will show up at the start of the next "record," even though they're at the end of your variable.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.