Presentation is loading. Please wait.

Presentation is loading. Please wait.

Variable Length Data and Records

Similar presentations


Presentation on theme: "Variable Length Data and Records"— Presentation transcript:

1 Variable Length Data and Records

2 Agenda Records with Variable Length Fields
Records with Repeating Fields Variable Format Records Records that do not fit in a block

3 Example of a record name address gender birth date

4 Records with Variable Length Fields
Simple and Effective way to represent variable length records is as follows – 1. Fixed length fields are kept ahead of the variable length records. 2. A header is put in front of the of the record. 3. Record header contains Length of the record Pointers to the beginning of all variable length fields except the first one.

5 Example Record with name and address as variable length field.
header information record length to address gender birth date name address Record with name and address as variable length field.

6 Records with repeating fields
Repeating fields simply means fields of the same length L. All occurrences of Field F grouped together. Pointer pointing to the first field F is put in the header. Based on the length L the starting offset of any repeating field can be obtained.

7 Example of a record with Repeating Fields
other header information record length to address to movie pointers name address Movie star record with “movies” as the repeating field. pointers to movies

8 Alternative representation
Record is of fixed length Variable length fields stored on a separate block. The record itself keeps track of - 1. Pointers to the place where each repeating field begins, and 2. Either how many repetitions there are, or where the repetitions end.

9 Storing variable length fields separately from the record.

10 Variable Format Records
Records that do not have fixed schema Represented by sequence of tagged fields Each of the tagged fields consist of information Attribute or field name Type of the field Length of the field Value of the field

11 Variable Format Records
code for name code for restaurant owned code for string type code for string type length length N S 14 Clint Eastwood R S 16 Hog’s Breath Inn

12 Records that do not fit in a block
When the length of a record is greater than block size ,then record is divided and placed into two or more blocks Portion of the record in each block is referred to as a RECORD FRAGMENT Record with two or more fragments is called a SPANNED RECORD Record that do not cross a block boundary is called UNSPANNED RECORD

13 Spanned Records Spanned records require the following extra header information – A bit indicates whether it is fragment or not A bit indicates whether it is first or last fragment of a record Pointers to the next or previous fragment for the same record

14 Spanned Records block header record header record 2 - b record 2 - a


Download ppt "Variable Length Data and Records"

Similar presentations


Ads by Google