Page 1 Computer Science 255 Third Hour Exam Name ______________________ Tuesday, Dec. 3 100 pts. Please Read All Questions Before Starting the Exam 1. (20 pts.) The file PARTS-FILE contains records as follows: 01 PARTS-REC. 02 PNO PIC X(5). 02 PNAME PIC X(20). 02 INVENTORY PIC 9(5). The file MODIFY-FILE contains records as follows: 01 BASIC-REC. 02 PNO PIC X(5). 02 TRANSACTION PIC X. 88 ADD-TO-INVENTORY VALUE "A". 88 SUB-FROM-INVENTORY VALUE "S". 01 ADD-REC. 02 FILLER PIC X(6). 02 ADD-AMT PIC 999. 01 SUB-REC. 02 FILLER PIC X(6). 02 SUB-AMT PIC 999. If the record in MODIFY-FILE is an ADD-REC, then the amt is to be added to the inventory amount of the corresponding record; if a SUB-REC, the amount is to be subtracted. Both files are in ascending order by part number. On the following page, write the code necessary (procedure division only) to perform the indicated operations on the incoming master file, producing a new master file. Display an error message if a transaction is attempted on a nonexistent record, or if a subtract operation brings an inventory level below zero. For this exercise, do not consider any other errors (such as sequence error or inventory above a maximum amount). Working space for problem 1 2. (15 pts.) List the five basic steps in the software life cycle model with a brief explanation of each. 3. (10 pts.) Briefly define: a. Entity integrity b. Referential integrity 4. A series of questions leading up to some more COBOL code. In the following, assume that a company has a number of geographical regions in which it works (eg., NorthWest region, NewEngland region, etc.) Each region has a region number (PIC X(5)), a region name (PIC X(20)), and the name of a city in which the headquarters for that region are to be found (PIC X(20)). The company also has salespeople. Each salesperson has an employee number (PIC X(9)), and a name (PIC X(20), not necessarily unique). Each region has a number of salespeople, but each salesperson is assigned to one (and only one) region. a. (15 pts.) Model this situation using an entity-relationship diagram. b. (20 pts.) Write SELECT statements for the files derived from the entity-relationship diagram. Use the region number for the primary key for regions, but build a unique key over the region name. Briefly justify any other indexes (but be sure to include any that would probably be useful). c. (20 pts.) Write the code necessary to write out the employee name and region name and number of employee number "123456789".