Due 2 May, 1997, 5:00 PM
Complete Problem IV-18 on page 593 of the textbook.
Create a protected directory called ~/csci/241/home6 as described in the handout Turning in Assignments. In solving this assignment, create three different Cobol programs and store them in the following files
Design these programs to communicate via shared external records.
The input file for this problem is
You'll have to break the COBOL standard to complete this assignment. Here is a list (probably incomplete) of a few things you'll need to do.
You'll need a different Makefile that will separately compile the three COBOL program files. Something like the following should work fine.
all: home6 home6: home6.o tablea.o tableb.o cobol -o home6 home6.o tablea.o tableb.o home6.o: home6.cob cobol -c home6.cob tablea.o: tablea.cob cobol -c tablea.cob tableb.o: tableb.cob cobol -c tableb.cob clean: rm -f home6 *.o HOME6.OUT
You'll need to "tell" the COBOL compiler that the tables are being shared between the three files. This isn't hard: all you need to do is add the word EXTERNAL to the 01-level record definition of your program. Your definition should look something like:
01 CURRENT-PAYMENTS-TOTAL-TABLE EXTERNAL. 05 CURRENT-PAYMENT-TOTAL PIC 999999V99 OCCURS 6 TIMES.
Be sure that the identical record declaration appears in all COBOL programs that use the shared record.
When the non-main programs, in this case tablea.cob and tableb.cob, are called, execution begins with the first paragraph of the PROCEDURE DIVISION. In order to prevent COBOL from executing all paragraphs of your program, you must end the first paragraph with the statement EXIT PROGRAM. This repaces the STOP RUN which is commonly used to terminate COBOL programs.
The "name" of your sub-programs are given in the PROGRAM-ID sentence. I suggest you use
PROGRAM-ID. TABLEA.
in tablea.cob and
PROGRAM-ID. TABLEB.
in tableb.cob.
Use the non-standard CALL statement to execute paragraphs in the sub-programs. To call the first paragraph of table.cob include the statement
CALL "TABLEA"
in your program. Yes, the quote marks are required.