Page 1 COMPUTER SCIENCE 255 THIRD HOUR EXAM NAME ___________________________ 7 pages, 100 pts. 10:00 AM Thursday, Nov. 18 1. (30 pts.) The file EMPLOYEES contains 20 records organized as follows: 01 EMPLOYEE-REC. 02 ENO PIC X(3). 02 ENAME PIC X(10). 02 DEPT PIC X(10). a. Write the DATA DIVISION entry necessary to create a table of 20 entries of this record type ordered in ascending order by ENO. Arrange things so that you can use a binary search on the table. (problem 1 continued) b. Write the code necessary to load the table with records from the file. You may assume that the file EMPLOYEES has exactly 20 records in it. c. Using the COBOL binary search verb, write the code necessary to search the table for the employee with ENO 'E04' and display the employee's name and department if found. If not found, print an error message. 2. (10 pts.) Suppose that we have the following: 01 EXAM-PROBLEM. 02 TABLE-VALUES PIC X(15) VALUE "ABCDEFGHIJKLMNO". 02 TABLE-REC REDEFINES TABLE-VALUES. 04 EXAM-TABLE OCCURS 3 TIMES. 06 FLD-A PIC XX. 06 FLD-B OCCURS 3 TIMES PIC X. what would be the result of the following? DISPLAY FLD-A(2). DISPLAY FLD-B(3, 2). 3. An Entity-Relationship question (20 points) Suppose that we have CUSTOMER entities with attributes CNO, CNAME, and ADDR (CNO is the key), and that we have SALESPER entities with attributes ENO and ENAME (ENO is the key). Each customer is associated to one (and only one) salesperson, and each salesperson is associated with several customers. a. Sketch an entity-relationship diagram for this situation. b. List the files that would be used to implement this relationship, listing the fields to be found in the files. 4. (10 pts.) Files that are assumed to be in sequence should be checked to make sure that they are in sequence. Describe how this is done in COBOL. Be sure to write the necessary COBOL statements. 5. A level break problem (30 pts.) Records in the file CARSALES.DAT consist of a sales manager name, a salesperson name (both 20 characters) and a car sale (PIC 9(5)v99). Each sales manager manages a number of salespersons and each salesperson reports to only one sales manager. The records are in order by sales manager name followed by salesperson name. On this and the following page, write the PROCEDURE DIVISION entries (only!) necessary to produce a report of the data in CARSALES, with subtotals for each sales manager, each salesperson, and the entire dealership. Do not worry about report elements (page headers, page footers, and the like). Workspace for problem 5