1. File Handeling and Sorting

All,

        I need to know what is the best way to handle the following File
situation:

I need to have a file that consists of the following type of structure

[KEY FIELD] [FIELD1] [FIELD2] [FIELD3] ...... and so on.

I need to sort the file based on the KEY FIELD, also the fields
following the KEY FIELD are of varying types and lengths, some records
will have
more FIELDS than others.

I also need to have the information encrypted and compressed to save
space, I would like to have a fairly fast access time if possible.

I was just wondering if there was already some kind of Library or
include file already written to handle this type of situation or if I
need to write it myself, my thoughts would be, why should I re-invent
the wheel.

Thanks In Advance for any help offered.

Later All,
--
+ + +  Rev. Ferlin Scarborough  -  Centreville, Alabama  -  USA

          http://sites.netscape.net/fscarborough/homepage
          http://members.theglobe.com/ferlin

MailTo:ferlin at sandw.net
MailTo:ferlin at email.com
MailTo:fscarborough at netscape.net
MailTo:ferlin at theglobe.com

new topic     » topic index » view message » categorize

2. Re: File Handeling and Sorting

Lets take a look at what is considered standard import/export
format.  Also its common flexibilities and allowances.

CSV - Comma Seperated Values
The standards for it are simple.

1. Most programs expect a set number of fields.
   In other words.  If the first line has 6 fields it
   expects the remaining entries to contain the same
   number of 6 fields.

2. Many programs expect or allow the first line of fields
   to be names for the fields.
   Example:
     Key,First,Last
     1,Lucius,Hilley
     2,Ferlin,Scarborough

3. Many but not all programs allow for use of commas in the field
   by using what is called a text qualifer, However the qualifer
   itself is rarely allowed in the field because of its use as
   a qualifer.  Standard Qualifer is the double quote ".
   Example:
     "Key","Product","Colors"
     "1","Fancy Watch","Red, Green, & Blue"
   That would come up as:
   Key      Product             Colors
     1      Fancy Watch         Red, Green, & Blue

4. Some programs allow you to Use a different seprating value and/or
   qualifer.
     Standard:
       Seperator: Comma
       Qualifier: Double Quote
     Possiblities:
       Seperator: Tab, Exclamation Point
       Qualifier: Single Quote, Exclamation Point

5. Random access can be faster if the size of the fields doesn't vary.
6. Some programs do allow for a varying number of fields per line.





        Lucius L. Hilley III
        lhilley at cdc.net   lucius at ComputerCafeUSA.com
+----------+--------------+--------------+----------+
| Hollow   | ICQ: 9638898 | AIM: LLHIII  | Computer |
|  Horse   +--------------+--------------+  Cafe'   |
| Software | http://www.cdc.net/~lhilley |  USA     |
+----------+-------+---------------------+----------+
                   | http://www.ComputerCafeUSA.com |
                   +--------------------------------+
----- Original Message -----
From: Ferlin Scarborough <ferlin at SANDW.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Thursday, September 02, 1999 10:10 AM
Subject: File Handeling and Sorting


> ---------------------- Information from the mail
header -----------------------
> Sender:       Euphoria Programming for MS-DOS
<EUPHORIA at LISTSERV.MUOHIO.EDU>
> Poster:       Ferlin Scarborough <ferlin at SANDW.NET>
> Subject:      File Handeling and Sorting
> --------------------------------------------------------------------------
-----
>
> All,
>
>         I need to know what is the best way to handle the following File
> situation:
>
> I need to have a file that consists of the following type of structure
>
> [KEY FIELD] [FIELD1] [FIELD2] [FIELD3] ...... and so on.
>
> I need to sort the file based on the KEY FIELD, also the fields
> following the KEY FIELD are of varying types and lengths, some records
> will have
> more FIELDS than others.
>
> I also need to have the information encrypted and compressed to save
> space, I would like to have a fairly fast access time if possible.
>
> I was just wondering if there was already some kind of Library or
> include file already written to handle this type of situation or if I
> need to write it myself, my thoughts would be, why should I re-invent
> the wheel.
>
> Thanks In Advance for any help offered.
>
> Later All,
> --
> + + +  Rev. Ferlin Scarborough  -  Centreville, Alabama  -  USA
>
>           http://sites.netscape.net/fscarborough/homepage
>           http://members.theglobe.com/ferlin
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: File Handeling and Sorting

Lets take a look at what is considered standard import/export
format.  Also its common flexibilities and allowances.

CSV - Comma Seperated Values
The standards for it are simple.

1. Most programs expect a set number of fields.
   In other words.  If the first line has 6 fields it
   expects the remaining entries to contain the same
   number of 6 fields.

2. Many programs expect or allow the first line of fields
   to be names for the fields.
   Example:
     Key,First,Last
     1,Lucius,Hilley
     2,Ferlin,Scarborough

3. Many but not all programs allow for use of commas in the field
   by using what is called a text qualifer, However the qualifer
   itself is rarely allowed in the field because of its use as
   a qualifer.  Standard Qualifer is the double quote ".
   Example:
     "Key","Product","Colors"
     "1","Fancy Watch","Red, Green, & Blue"
   That would come up as:
   Key      Product             Colors
     1      Fancy Watch         Red, Green, & Blue

4. Some programs allow you to Use a different seprating value and/or
   qualifer.
     Standard:
       Seperator: Comma
       Qualifier: Double Quote
     Possiblities:
       Seperator: Tab, Exclamation Point
       Qualifier: Single Quote, Exclamation Point

5. Random access can be faster if the size of the fields doesn't vary.
6. Some programs do allow for a varying number of fields per line.


My greatest suggestion is to allow the CSV format as both an Import
and Export option.

My ideas:
  1. To force a fixed number of fields across the database file yet
     allow fields to be inserted and deleted.
  2. To allow varying lengths for the fields yet behind the scenes
     enforce a fixed length for each field.
  3. To allow retained naming of each field.

The fixed fields and field lengths make the faster Random access
possible.  Yet I will still permit the flexibility of variable
length data, and any number of fields.

I would have the first 2 lines containing Setup information.
One line would contain field names and the other would
contain field lengths.  Boths pieces of information could
be in plain text and use the CSV format.

Once the 2 line header is read, random access is easily possible
due to the fixed lengths.  If an addition is to be larger than
the current length then the entire database will have to be
rewritten with the new length.


    I just gave away what one of my projects was to be.
If someone beats me to its completion, GREAT.  I would LIKE
credit for supplying said person witht the ideas.
    I would also like to be informed of the projects completion,
and a copy of it.  I have much use for such a flexible database.
I have other ideas I would like to put into such a database that
will allow for some potection against database bloat due to vastly
varying data lengths.
    Example:
     Key, Item ID, Description
     1, WD-1289, Bag of 50 water ballons
     2, DR-543, AMD K-6 300Mhz with 32xCD, 2x4x26 CD-RW, 6.4Gig Western
Digital HD

Assuming that most descriptions where like Key# 1 then Key#2 would cause
unneccessary bloat because of the fixed field lengths.
I have Ideas on how to Reduce such undesired bloating.

Your welcome to probe my brain for more ideas.

        Lucius L. Hilley III
        lhilley at cdc.net   lucius at ComputerCafeUSA.com
+----------+--------------+--------------+----------+
| Hollow   | ICQ: 9638898 | AIM: LLHIII  | Computer |
|  Horse   +--------------+--------------+  Cafe'   |
| Software | http://www.cdc.net/~lhilley |  USA     |
+----------+-------+---------------------+----------+
                   | http://www.ComputerCafeUSA.com |
                   +--------------------------------+
----- Original Message -----
From: Ferlin Scarborough <ferlin at SANDW.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Thursday, September 02, 1999 10:10 AM
Subject: File Handeling and Sorting


> ---------------------- Information from the mail
header -----------------------
> Sender:       Euphoria Programming for MS-DOS
<EUPHORIA at LISTSERV.MUOHIO.EDU>
> Poster:       Ferlin Scarborough <ferlin at SANDW.NET>
> Subject:      File Handeling and Sorting
> --------------------------------------------------------------------------
-----
>
> All,
>
>         I need to know what is the best way to handle the following File
> situation:
>
> I need to have a file that consists of the following type of structure
>
> [KEY FIELD] [FIELD1] [FIELD2] [FIELD3] ...... and so on.
>
> I need to sort the file based on the KEY FIELD, also the fields
> following the KEY FIELD are of varying types and lengths, some records
> will have
> more FIELDS than others.
>
> I also need to have the information encrypted and compressed to save
> space, I would like to have a fairly fast access time if possible.
>
> I was just wondering if there was already some kind of Library or
> include file already written to handle this type of situation or if I
> need to write it myself, my thoughts would be, why should I re-invent
> the wheel.
>
> Thanks In Advance for any help offered.
>
> Later All,
> --
> + + +  Rev. Ferlin Scarborough  -  Centreville, Alabama  -  USA
>
>           http://sites.netscape.net/fscarborough/homepage
>           http://members.theglobe.com/ferlin
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu