[net.unix] file attributes

tjr@ihnet.UUCP (Tom Roberts) (08/09/85)

Concerning file attributes (e.g. record size, FORTRAN carriage-control, etc.).

I have seen only two real objections to putting this in a header at the top
of the file:

1:	"I don't want to deal with the header when doing random access".

2:	"Standard UNIX commands (e.g. pr) won't be able to print my files".

Since nobody else has rebutted this, I will attempt to do so.

1:
Keep in mind that for a high-level language there are (at least) two levels
of access: the HLL access, and the run-time library access. For files with
such attributes (however implemented), the run-time library MUST obtain
the attribites before allowing the HLL to manipulate the file. This implies
that it is simple for the library to know how long the header is when the
file is opened, and to handle it appropriately whenever the HLL does a 
"seek". Note that the library MUST know the record size by the time of the 
"seek" call, because the HLL is going to seek to a record #, not to a
byte offset in the file. I believe that the complications to the library
code are negligible, compared to the handling of these attributes (which
must be done however they are implemented).

2:
It is unreasonable to expect to be able to print such a file with
the standard UNIX "pr" (etc.); special tools will be required. This is
inherent in the problem (which UNIX has wisely decided not to solve for you).
There is nothing to stop you from writing a new command, call it "pr", and
have it understand both normal UNIX files and your new attribute files.
Enough such commands and you will have MVS (:-).

I can see no compelling reason not to put such simple attributes into
a header at the top of the file, probably starting with a new magic number.

	Tom Roberts
	AT&T Bell Laboratories
	ihnp4!ihnet!tjr