[comp.sys.mac.misc] What's a flat file

srlngmw@windy.dsir.govt.nz (10/24/90)

The title says it all!!!!

The other day I was asked what a flat file was.   Being denied all access
to Macs for the whole of my life, I had to embarrass myself and confess
that I didn't know.   Please help me restore my pride by providing me
with enough information to impress (but not confuse) anyone.

Thanks in advance,

Gary Williams,
DSIR Geology & Geophysics,
PO Box 30-368,
Lower Hutt,
NEW ZEALAND.

Email: SRLNGMW@LHN.DSIR.GOVT.NZ

srlngmw@windy.dsir.govt.nz (10/26/90)

In article <18689.2725c24c@windy.dsir.govt.nz> I wrote:

>The other day I was asked what a flat file was.   Being denied all access
>to Macs for the whole of my life, I had to embarrass myself and confess
>that I didn't know.   Please help me restore my pride by providing me
>with enough information to impress (but not confuse) anyone.

Thanks to all those who responded.   The following is a summary of the
three schools of thought (with my interpretation).

1) On Macs, flat files are those that only have a "data" fork.
   All Mac files can have two forks, or parts. The data fork is what
   one would traditionally think of as "the file", since it is what
   a program sees if it opened and read the file.
 
   The "resource" fork is not directly accesible by the user, but is 
   accessed via the Mac OS's Resource Manager.   There are resources 
   of different types and there can usually be several occurrences of 
   a particular resource type.   Resources can also "point" to each 
   other thus creating a hierarchy.

2) Flat files were introduced in the early days of Macs when they only had
   small 400k disks.   Since it wasn't worth having a fancy system for 
   locating files, there was only a single directory which contained a list
   of all the files on the disk.

   As the capacity of disks increased and thus the number of files that could
   be stored, a new file system was introduced.   This system, the hierarchical 
   file system (HFS), introduced the notion of directories and subdirectories.
   Instead of a directory containing only lists of files, a directory could
   also contain directories.

   One of benefits of HFS is that files can be found faster by doing a tree
   search rather than a linear search.


3) Flat files are used by databases that are not relational.   A "flat-file
   database" stores each record separately, sequentially, and records may
   not share data.    A "relational database", however, maintains a separate
   file for each field and records are thus just collections of the index
   numbers of items from the relevant field files.  

   In this context, "flat file" is not a term unique to Macs.


In view of the context of the question "what's a flat file?", I think the
most appropriate answer is (1) although I will give (2) & (3) as alternatives.


Thanks again to everybody who responded.


Gary Williams,                 | Phone: +64 4 699059 
Earth Deformation Studies,     | Fax:   +64 4 666168
DSIR Geology & Geophysics,     | Email: SRLNGMW@LHN.DSIR.GOVT.NZ
PO Box 30-368,                 | 
Lower Hutt,                    |
NEW ZEALAND.                   |