Eric,

To your point #2.  In looking at other implementations of Rexx, I found that 
some implementations note that if you move the write pointer to someplace in 
the existing file, and then write, the file will be truncated to that written 
data.  This led me to the realization that the write pointer is also the 
“working” end of file pointer. If you move the write pointer to the middle of 
the file what will the result be, especially if the data written is greater 
than the original data in the position, wiping out the record separator (CRLF) 
in the process.

I would lean toward not being able to move the write pointer, and use 
sequential file update processes that are old and well defined.

I know that update in place is a common technique on the mainframe, but 
mainframes also support record structures, and record i/o, Rexx for the most 
part doesn’t.  There is not a data structure that is tied to the file in away 
that prohibits writing records that don’t agree with the structure of the file.

To your point #1, I think replace is more common than default of append.  In 
most programming environments I’ve used you must explicitly specify append.

There have been times in Rexx, where to bullet proof a program, I’ve had to 
issue a close then open against a file because the program in development never 
reached the file close logic from the last execution, the result being an 
append rather than the desired replace.

Bruce

> On Feb 10, 2021, at 11:21 AM, Erich Steinböck <erich.steinbo...@gmail.com> 
> wrote:
> 
> Thanks for clarifying the timeline :-)
> 
> Now back to the question:
> s~open('append'); s~lineOut('xxx', 1) ignores the line number argument for 
> lineOut and unconditionally appends
> s~open; s~lineOut('xxx', 1) overwrites the first line
> 
> This is pretty crazy, as
> 1) "append" should be default (or not?) for any write operation, and
> 2) if "append" prohibits overwriting existing lines, we can never overwrite 
> parts of an existing file at all
> 
> I'd propose to remove the rewrite restriction and make "append" default, but 
> then: we also have this rexxref paragraph "The write pointer cannot be moved 
> anywhere within the extent of the file as it existed when the file was 
> opened."
> 
> So many errors in one place?
> Thus my question: anyone remembers what the intention of all this was?
> 
> 
> 
> _______________________________________________
> Oorexx-devel mailing list
> Oorexx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Attachment: signature.asc
Description: Message signed with OpenPGP

_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to