cs215 - lec 5 record organization
DESCRIPTION
Reading/writing collection of recordsTRANSCRIPT
![Page 1: CS215 - Lec 5 record organization](https://reader034.vdocument.in/reader034/viewer/2022052411/556d09e3d8b42ad34f8b4b25/html5/thumbnails/1.jpg)
![Page 2: CS215 - Lec 5 record organization](https://reader034.vdocument.in/reader034/viewer/2022052411/556d09e3d8b42ad34f8b4b25/html5/thumbnails/2.jpg)
� List different methods for record organization.
� Continue with the company class;
� Use fixed length of bytes ,
� Use fixed number of fields
� Use length indicator,
� Use delimiter,
� Use index.
Dr. Hussien M. Sharaf2
![Page 3: CS215 - Lec 5 record organization](https://reader034.vdocument.in/reader034/viewer/2022052411/556d09e3d8b42ad34f8b4b25/html5/thumbnails/3.jpg)
Dr. Hussien M. Sharaf3
Fixed length of
bytesVariable length
Length indicator
Record delimiter
Record index
Fixed number of
fields
![Page 4: CS215 - Lec 5 record organization](https://reader034.vdocument.in/reader034/viewer/2022052411/556d09e3d8b42ad34f8b4b25/html5/thumbnails/4.jpg)
� A fixed length record file is one in which each record contains the same number of bytes.
� The length must be the max expected length.
� Problems:
1. The estimation of max length.
2. The choice of a character to fill the remaining space.
3. Not readable to human eye.
4. Waste of space.
Dr. Hussien M. Sharaf4
Record 3 Record 4Record 1 Record 2
200 bytes 200 bytes200 bytes 200 bytes
![Page 5: CS215 - Lec 5 record organization](https://reader034.vdocument.in/reader034/viewer/2022052411/556d09e3d8b42ad34f8b4b25/html5/thumbnails/5.jpg)
� A fixed number of fields where each field can be of variable size.
� The count must be the max expected count.
� Problems:
1. The estimation of max count.
2. Not readable to human eye.
3. Waste of space in case of an empty field.
Dr. Hussien M. Sharaf5
Record 3 Record 4Record 1 Record 2
180 bytes 190 bytes210 bytes 250 bytes
6 fields 6 fields6 fields 6 fields
![Page 6: CS215 - Lec 5 record organization](https://reader034.vdocument.in/reader034/viewer/2022052411/556d09e3d8b42ad34f8b4b25/html5/thumbnails/6.jpg)
� To choose a special character that will not appear within a record and then insert that after each record.
Dr. Hussien M. Sharaf6
3. Record Delimiter
� Problems:
1. The choice of a delimiter character that does not get in the way of processing (ex. White space is not a good choice cause the field may contain spaces within it like “address fields” same for @).
Name EmailID Course
Name EmailID Course
Record1
Record2
\n
\n
![Page 7: CS215 - Lec 5 record organization](https://reader034.vdocument.in/reader034/viewer/2022052411/556d09e3d8b42ad34f8b4b25/html5/thumbnails/7.jpg)
Dr. Hussien M. Sharaf7
4. Length indicator
And
5. Index
will be continued at next
lecture
![Page 8: CS215 - Lec 5 record organization](https://reader034.vdocument.in/reader034/viewer/2022052411/556d09e3d8b42ad34f8b4b25/html5/thumbnails/8.jpg)
1. Start by determining Output.
2. List the inputs.
3. Think about processing.
![Page 9: CS215 - Lec 5 record organization](https://reader034.vdocument.in/reader034/viewer/2022052411/556d09e3d8b42ad34f8b4b25/html5/thumbnails/9.jpg)
� Continue using the CompanyInfo class:
[A] Write a method that takes in ostream and writes to it a company record whose fields have Keyword = Value
� Write a driver to use this class based on the template Menu.
Dr. Hussien M. Sharaf9
![Page 10: CS215 - Lec 5 record organization](https://reader034.vdocument.in/reader034/viewer/2022052411/556d09e3d8b42ad34f8b4b25/html5/thumbnails/10.jpg)
� Continue using the CompanyInfo class:
[B] Write a method that takes in istream and reads from it a company record whose fields have Keyword = Value
� Write a driver to use this class based on the template Menu.
Dr. Hussien M. Sharaf10
![Page 11: CS215 - Lec 5 record organization](https://reader034.vdocument.in/reader034/viewer/2022052411/556d09e3d8b42ad34f8b4b25/html5/thumbnails/11.jpg)
� Next week is the deadline.
� No excuses.
� Don’t wait until last day.
� I can help you to the highest limit within the next 3 days.
Dr. Hussien M. Sharaf11
![Page 12: CS215 - Lec 5 record organization](https://reader034.vdocument.in/reader034/viewer/2022052411/556d09e3d8b42ad34f8b4b25/html5/thumbnails/12.jpg)
1. Delete the “bin” and “obj” folders.
2. Compress the solution folder using winrar.
3. Rename the compressed file as follows:
StudentName_ID_LecExcercise.rar
4. Email to: [email protected] with your ID in the subject.
Dr. Hussien M. Sharaf 12
![Page 13: CS215 - Lec 5 record organization](https://reader034.vdocument.in/reader034/viewer/2022052411/556d09e3d8b42ad34f8b4b25/html5/thumbnails/13.jpg)