Skip to main content

Append Mode and Non-Sequential Files

2. The OPEN command should allow for a third OPEN mode called A for append. In terms of its action with respect to a file and file pointer, the command

OPEN A FOO

would be equivalent to the sequence:

OPEN W FOO
SETP E

The difference would be with respect to access control. Many systems allow a user to control separately write and append access to a file (e.g., on TENEX a user usually sets the protection on his MESSAGE.TXT file such that anyone can append to it but only he can write it). For such systems the append OPEN would succeed in many cases in which the write OPEN would fail. The principle here is that FAP (to as large as degree as is practical) should allow remote users to access files in the same way as local users may.

3. The protocol as proposed allows for the creation of non-sequential files but provides no convenient way for remotely accessing them after they are created. For example if sent to a TENEX server, the sequence:

OPEN W FOO     //byte size assumed = 36
SETP B
WRITE 512
SETP 1024
WRITE 512
CLOS

would create a file FOO with two pages (on TENEX a page = 512 36 bit words). The two pages would be page #0 and page #2; because page #1 does not exist the file is said to have a "hole" in it. Access to FOO via FAP would be difficult unless the remote user knew its (page) structure prior to access. To support remote access to files such as FOO, FAP should have means for a user to determine a file's structure. Consider a value-returning command that returns the value the file pointer should be set to in order to point to the first byte of the next used page (block or record) beyond the current position of the file pointer. With such a command, call it FNUB (Find Next Used Block), the following sequence could be used to retrieve a holey file such as FOO:

OPEN R FILE
SETP B
a: FNUB //let x=the value returned
if x=null
then CLOS
else ( SETP x
READ 512 //page size=512
goto a )

This presumes that the remote user knows the block (page) size so that he can properly access the file. One can imagine files having blocks of variable size; perhaps FNUB should return two values: the file pointer position of the next block and the size of that block in bytes.