Lseek() api will give the length of the *STMF. I expect there are other
apis that also return length. Using that, I'll take a look at ftruncate.

Thanks,

Keith


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of bvining
Sent: 15 July 2009 16:38
To: RPG programming on the IBM i / System i
Subject: Re: Updating Text Data in a Stream File

Have you looked at the ftruncate() API? If I understand you correctly
you could get the length of the *STMF, subtract 2, and truncate to that
length.
DSPF will continue to show trailing controls, but a DMP will show that
they are indeed gone.

Bruce

----- Original Message -----
From: "McCully, Keith (Insurance,Technology Services)"
<Keith.McCully@xxxxxxxxx>
To: "RPG programming on the IBM i / System i" <rpg400-l@xxxxxxxxxxxx>
Sent: Wednesday, July 15, 2009 10:02 AM
Subject: RE: Updating Text Data in a Stream File


Hi Dennis,

Sorry if my description was rather convoluted - I tried to keep it
simple!

Basically, CPYTOIMPF is appending to an ASCII Text file. The problem
is
that at the end of the file there the potential for a null line. I say
'potential' because whether you see an extra line depends on your text
viewing application. For example, iSeries Navigator Edit will show the
line but green screen EDTF will not - there have been a few posts on
this.

The null line is caused by the LF of the CRLF on the last data line
but
some applications can handle this while others can't.

What I have done, using a combination of RPG and QC2LE APIs, is to
replace the CRLF with 2 null bytes - only for the last row. This has
removed the null row from iSeries Navigator but currently unable to
test
using the Wintel app.

What I'm wondering is whether it's possible to simply remove the CRLF
for the very last row rather than doing the 2 null replace?

I hope that's a bit clearer.

Thanks,

Keith


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Dennis Lovelady
Sent: 15 July 2009 15:34
To: 'RPG programming on the IBM i / System i'
Subject: RE: Updating Text Data in a Stream File

Hi, Keith:

I have an ASCII Text File in the IFS (Code Page 819) populated by
CPYTOIMPF. A feature of this command is that line endings CR & LF are
created (ASCII 0D & OA). However, this creates a null line at the end
<snip>
Looking back through the archives shows a number of postings on this
topic and suggestions on how to resolve the problem. One way that I'm

Sorry, but I missed what "the problem" is, even on the third read.
Are
you referring to the 0x00 ending of the file (which is the standard
"end
of file" indicator for any text-based system) ? If so, what problem
is
the standard causing you? If not... would you mind enlightening
me/us?

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"Where a calculator on the ENIAC is equpped with 18,000 vaccuum tubes
and weighs 30 tons, computers in the future may have only 1,000
vaccuum
tubes and perhaps weigh 1 1/2 tons."
-- Popular Mechanics, March 1949



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

*** WARNING : This message originates from the Internet ***

The Royal Bank of Scotland plc, Registered in Scotland No. 90312.
Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB

Authorised and regulated by the Financial Services Authority.

This e-mail message is confidential and for use by the addressee only.
If
the message is received by anyone other than the addressee, please
return
the message to the sender by replying to it and then delete the
message
from your computer. Internet e-mails are not necessarily secure. The
Royal
Bank of Scotland plc does not accept responsibility for changes made
to
this message after it was sent.

Whilst all reasonable care has been taken to avoid the transmission of

viruses, it is the responsibility of the recipient to ensure that the
onward transmission, opening or use of this message and any
attachments
will not adversely affect its systems or data. No responsibility is
accepted by The Royal Bank of Scotland plc in this regard and the
recipient should carry out such virus and other checks as it considers

appropriate.

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



This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2019 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].