× 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.



Mike,

Isn't %size(buffer) always 256? Maybe use the Varying keyword on the buffer definition:

D buffer S 256A varying

Paul

Principal Programmer Analyst
IT Supply Chain/Replenishment


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Mike Wills
Sent: Friday, January 07, 2011 4:41 PM
To: RPG programming on the IBM i / System i
Subject: Weird problem creating IFS file

I am using Scott's documentation to create IFS files. I finally have
something working, however after the first row each line has over 150
characters of extra spaces before the data. What makes it stranger is that
there isn't any consistency on how many spaces there are.

Here is a snipit of the file:
"Transaction Date","Account Desc.","Transaction
Desc","Account","Debit","Credit"


08/01/2010,"SERV CHG-SODA SALES","Ribfest-F&B Wk1 sales
J","622-49862-345130",.00,152.95


08/01/2010,"SERV CHG-CAN SODA SALES","Ribfest-F&B Wk1 sales
J","622-49862-345138",.00,9357.38

The code I use to create this is as follows:

D eof C const(x'0d25')

P WriteCsv B
D WriteCsv PI

D buffer S 256A

/free

buffer = %trim(%char(pTranDate:*usa)) + ',"' + %trim(pAcctDesc) +
'","' + %trim(pTranDesc) + '","' + %trim(pAcct) + '",' +
%trim(%editc(pDbAmt:'L')) + ',' +
%trim(%editc(pCrAmt:'L')) + eof;

if (write(fd:%addr(buffer):%size(buffer)) < %size(buffer));
abEnd = *on;
return;
endif;

return;

/end-free
P WriteCsv E

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

--
Mike Wills
http://mikewills.me

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.