After writing an empty string in a new file at position 1 the file exists with size 0.
After writing one character into a new file at position N the file exists with size N.
After writing an empty string in a new file at position N the file exists witj size 0.
I'd expect a minimal size N-1 after any successful write access at position N, also for an empty charout( FILE, '' ), at the moment only position 1 works as expected yielding size 0.
Anonymous
According to 7.4.15. CHAROUT, "the string can be a null string, in which case no characters are written to the stream, and 0 is always returned."
As nothing is written to the file, your result should be the expected behavior
There is no such thing as writing an empty string. If there is no data to write, then nothing is written. the 0-length file is not created by the act of writing the null string, but by opening the file itself.
This issue had a "high astonishment factor" for me in experiments with "sparse" FAT disk images created in a REXX script. Writing lots of NUL bytes is slow; just changing the position beyond the current EOF is fast. Apparently the trick is to seek to POS-1 and write one NUL instead of going to POS and write zero bytes.