Computer Science 255

Exercise #7

Due: Various (see below)

 

A multi-step exercise, with documentation.

 

The file dia0:[matthews.cs255]PARTA.DAT and PARTB.DAT contain records as follows:

FD	PARTS-FILE
	RECORD CONTAINS 15 TO 40 CHARACTERS
	DATA RECORDS ARE BASIC-REC, INSERT-REC, MODIFY-REC.
01	BASIC-REC.
	02	PNO.
		04	DEPT	PIC 9(4).
		04	ITEM-NO PIC 9(3).
	02	TIMESTAMP.
		04	YYYY  PIC 9(4).
		04	DDD   PIC 9(3).
	02	TRANSACTION-CODE  PIC X.
		88	INSERT-REC VALUE "I".
		88	DELETE-REC VALUE "D".
		88	ADD-REC  VALUE "A".
		88	SUB-REC  VALUE "S".
		88	MODIFY-REC VALUES "A", "S".
01	INSERT-REC.
	02	FILLER PIC X(15).
	02	PNAME	PIC X(20).
	02	UNIT-COST PIC 999V99.
01	MODIFY-REC.
	02	FILLER PIC X(15).
	02	AMT	PIC 9(3).

 

This file is terminated by a sentinel record with a PNO value of "9999999" and a TIMESTAMP value of "9999999" and a transaction code of "D".

The file dia0:[matthews.cs255]department.dat has records with the following format:

01	DEPARTMENT-REC.
	02	DNO	PIC 9(4).
	02	DNAME PIC X(20).

This file has exactly 10 records.

Step 1: (due Friday, Oct. 31)

  1. Write a program (call it MERGE.COB) which will merge two files called TEMPA.DAT and TEMPB.DAT which have the same file organization as PARTA.DAT and PARTB.DAT and which are in order first by PNO and then TIMESTAMP into a single file called TEMPC.DAT (in order by the same key, and with the same sentinel record).
  2. Write a program (call it VALIDATE.COB) which will read in TEMPC.DAT and DEPARTMENT.DAT and which will produce two files and a report as follows:
  1. Write a control script (call it SCRIPT01.COM) which will perform the following actions:

The remaining steps of this exercise will be added later. The files PARTA.DAT, PARTB.DAT and DEPARTMENT.DAT are available, though in very preliminary form (i.e., much will be added to the parts files, and the department file may be changed, though the number of records and the format of the records will not change).

Please let me know (send me email) if you find any problems with the files or have any questions.