File handler not appending to file
Brian K. White
bw.aljex at gmail.com
Mon Sep 16 13:35:02 PDT 2019
Oh yeah, remove the 0 from "rwc0" too.
If you need to do that potentially sometimes, do that in @once.
Thanks Walter.
--
bkw
On 9/16/19 4:30 PM, Walter Vaughan Jr via Filepro-list wrote:
> Maybe I am missing something, but isn't your 0 (zero) by definition truncating the file if it sees data, so that loop 2 erases loop 1, loop 3 erases loop 2, loop 4 erases loop 3, etc....?
>
> Also I see this in the release notes: In Version 5.7.04, a new flag "A" was added.
> Anything written to the file will be appended to the end of the file.
>
> -----Original Message-----
> From: Filepro-list <filepro-list-bounces+wvaughan=steelerubber.com at lists.celestial.com> On Behalf Of James Flanagan via Filepro-list
> Sent: Monday, September 16, 2019 4:02 PM
> To: Filepro_List <filepro-list at lists.celestial.com>
> Subject: File handler not appending to file
>
> Filepro 5.7.00.09D4
> FreeBSD 10.3
>
> I have used filepro’s file handlers (open, writeline, and close) many times successfully, but always as a one stop shop for the file creation.
>
>
> Now, I want to (if possible) use these same functions in a dreport where it would append the file with another line for each record processed, but presently, each iteration overwrites the existing line with its single output line, despite using the “0”, which according to the manual “0 - truncate if already exists” .
>
> Up until now, I have been using system commands and elaborate echo commands, but the data is getting filled with some characters that are problematic without having to encapsulate in single quotes, etc.
>
> Below is a sample where I would expect /tmp/test to have 9 lines, numbered 1-9 when complete, but Instead only has the last iteration of the loop saved to line #1 of the file.
>
> @wef1::':
> ::fi="/tmp/test":
> ::li="1":
> loop::':
> ::aa=open(fi,"rwc0")
> ::ab=writeline(aa,li):
> ::ac=close(aa):
> ::li=li+"1":
> :li lt "10":goto loop:
> ::end:
>
> Please let me know if this can be done. Thank you.
>
>
>
>
> James Flanagan
> Flantec.com <http://flantec.com/>
>
> email: James at Flantec.com <mailto:James at Flantec.com>
> mobile: 760-458-8498
> home: 219-221-6219
> text: 7604588498 at txt.att.net <mailto:7604588498 at txt.att.net>
>
> Skype: Flantec
> ichat: James at Flantec.com <mailto:James at Flantec.com>
>
> home: 1901 Cidermill Road
> Michigan City, IN 46360
>
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.celestial.com/pipermail/filepro-list/attachments/20190916/9106fc28/attachment.html>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: PastedGraphic-1.tiff
> Type: image/tiff
> Size: 19328 bytes
> Desc: not available
> URL: <http://mailman.celestial.com/pipermail/filepro-list/attachments/20190916/9106fc28/attachment.tiff>
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> Subscribe/Unsubscribe/Subscription Changes http://mailman.celestial.com/mailman/listinfo/filepro-list
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> Subscribe/Unsubscribe/Subscription Changes
> http://mailman.celestial.com/mailman/listinfo/filepro-list
More information about the Filepro-list
mailing list