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



Try adding O_append to the 2nd open.


Yours truly,
Glenn Gundermannglenn.gundermann@xxxxxxxxx (416) 317-3144
-------- Original message --------From: Jack Tucky <jacktucky@xxxxxxxxx> Date: 2016-04-26 8:17 PM (GMT-05:00) To: "RPG programming on the IBM i (AS/400 and iSeries)" <rpg400-l@xxxxxxxxxxxx> Subject: IFS Open & Append
I'm trying to open a stream file to append data to it.  This is the code I
grabbed from the internet to test:

fd = open(%trim($file_name)
          : O_WRONLY+O_CREAT+O_APPEND+O_CCSID
          : S_IRGRP + S_IWGRP + S_IXGRP:819);
callp close(fd);
fd = open(%trim($file_Name):O_WRONLY+O_TEXTDATA);

$xml = '<Items>';
callp write(fd: %addr($xml): %len(%trim($xml)));

when I write to the stream file it goes to the beginning of the file.

I tried reading through the file using this first, then using write but it
did the same thing

dow (read(fd: %addr(Buf): %size(Buf)) > 0);
   buf = *allx'20';
enddo;

How can I add to the end of a stream file?

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.