1 / 15

Variable Length Data and Records

Variable Length Data and Records. - Ashwin Kalbhor Class ID : 107. Agenda . Records with Variable Length Fields Records with Repeating Fields Variable Format Records Records that do not fit in a block. Example of a record. name. address. gender. birth date.

Download Presentation

Variable Length Data and Records

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Variable Length Data and Records - AshwinKalbhor Class ID : 107

  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 0 30 286 287 297

  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 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 record 1 record 3 block 1 block 2

  15. Thank You.

More Related