|
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.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
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.