Your first assignment is to create a data file using a COBOL program. The data file should then be the input to the sample program that processes the data on the file. The file you create should have the following fields:
Field |
Type |
Length |
Order Number |
Numeric |
4 |
Item Number |
Numeric |
2 |
When you create the file, the item numbers should have records with the item number containing 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11. The order number can be any 4 digit number.
A model you can look at to help you create the program is:
http://webber.bristol.mass.edu/pgrocer//cis12/newfirst/create1.html
Now you need to go in and modify the following program:
http://www.pgrocer.net/Cis51/dirsoupt.cbl
http://www.pgrocer.net/Cis51/dirsoupt.html
IDENTIFICATION DIVISION.
PROGRAM-ID. DIRSOUPT.
AUTHOR. GROCER.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INPUT-FILE ASSIGN TO "A:\yourdata.dat".
SELECT PRINT-FILE ASSIGN TO "A:\output.dat".
DATA DIVISION.
FILE SECTION.
FD INPUT-FILE
DATA RECORD IS INPUT-REC.
01 INPUT-REC.
05 ORDER-NO PIC 9999.
05 ITEM-NUMBER-IN PIC 99.
FD PRINT-FILE
DATA RECORD IS PRINTZ.
01 PRINTZ.
05 FILLER PIC X.
05 ORDER-NO-PR PIC 9999.
05 FILLER PIC X(10).
05 ITEM-NUMBER-IN-PR PIC 99.
05 FILLER PIC X(10).
05 ITEM-NAME-PR PIC X(15).
05 FILLER PIC X(38).
WORKING-STORAGE SECTION.
01 INDICATORS.
05 MORE-RECS PIC XXX VALUE "YES".
01 PAGE-CONTROL.
05 PAGE-NO PIC 99 VALUE 1.
05 LINE-CT PIC 99 VALUE 0.
01 DATE-WS.
05 YR-WS PIC 99 VALUE 0.
05 MO-WS PIC 99 VALUE 0.
05 DA-WS PIC 99 VALUE 0.
01 PAGE-HDR.
05 FILLER PIC XX VALUE SPACES.
05 DATE-HDR.
10 MO-HDR PIC 99.
10 FILLER PIC X VALUE "/".
10 DA-HDR PIC 99.
10 FILLER PIC X VALUE "/".
10 YR-HDR PIC 99.
05 FILLER PIC X(24) VALUE SPACES.
05 FILLER PIC X(11) VALUE "SOUP REPORT".
05 FILLER PIC X(23) VALUE SPACES.
05 FILLER PIC X(5) VALUE "PAGE ".
05 PAGE-NO-HDR PIC Z9.
05 FILLER PIC X(5) VALUE SPACES.
01 COLUMN-HDR.
05 FILLER PIC X VALUE SPACES.
05 FILLER PIC X(5) VALUE "ORDER".
05 FILLER PIC X(7) VALUE SPACES.
05 FILLER PIC X(6) VALUE "ITEM #".
05 FILLER PIC X(8) VALUE SPACES.
05 FILLER PIC X(9) VALUE "ITEM NAME".
05 FILLER PIC X(44) VALUE SPACES.
PROCEDURE DIVISION.
MAINLINE.
PERFORM A-100-INITIALIZE.
PERFORM B-100-PROCESS.
PERFORM C-100-WRAPUP.
STOP RUN.
A-100-INITIALIZE.
OPEN INPUT INPUT-FILE
OUTPUT PRINT-FILE.
PERFORM U-000-DATE-ROUT.
B-100-PROCESS.
READ INPUT-FILE
AT END
MOVE "NO " TO MORE-RECS.
PERFORM B-200-LOOP
UNTIL MORE-RECS = "NO ".
B-200-LOOP.
IF LINE-CT > 55 OR PAGE-NO = 1
PERFORM B-310-HDR-ROUT.
MOVE SPACES TO PRINTZ.
MOVE ORDER-NO TO ORDER-NO-PR.
MOVE ITEM-NUMBER-IN TO ITEM-NUMBER-IN-PR.
WRITE PRINTZ
AFTER ADVANCING 1 LINES.
ADD 1 TO LINE-CT.
READ INPUT-FILE
AT END
MOVE "NO " TO MORE-RECS.
B-310-HDR-ROUT.
MOVE PAGE-NO TO PAGE-NO-HDR.
WRITE PRINTZ FROM PAGE-HDR
AFTER ADVANCING PAGE.
WRITE PRINTZ FROM COLUMN-HDR
AFTER ADVANCING 2 LINES.
PERFORM U-010-BLANK-LINE.
ADD 1 TO PAGE-NO.
MOVE 4 TO LINE-CT.
C-100-WRAPUP.
CLOSE INPUT-FILE
PRINT-FILE.
U-000-DATE-ROUT.
ACCEPT DATE-WS FROM DATE.
MOVE MO-WS TO MO-HDR.
MOVE DA-WS TO DA-HDR.
MOVE YR-WS TO YR-HDR.
U-010-BLANK-LINE.
MOVE SPACES TO PRINTZ.
WRITE PRINTZ
AFTER ADVANCING 1 LINES.
Your assignment is to add a table to the existing program
and use the table to produce the output. The table you need to add uses direct
subscripts. The first soup (Seafood Chowder) is referenced if the number coming
in is 01. The second soup (Corn Chowder) is referenced if the number coming in
is 02. The valid soup numbers are 01 - 09.
The soups are:
01 Seafood Chowder
02 Corn Chowder
03 Clam Chowder
04 Tomato Soup
05 Chicken Soup
06 Vegetable Soup
07 Onion Soup
08 Green Pea Soup
09 Wonton Soup
Note that I had you use numbers 00 through 11 when you created the file, so that means I want you to test for invalid item numbers that would not successfully retrieve from the table.
You need to test the program with the data file you created. When you have completed the project, you need to email me a picture of the printed output that you generated, a copy of the data file and a copy of the working COBOL program with the modifications. I want the COBOL program that I can execute.