Programming Assignment
This program is missing some of the code. Add the code called for and pass in the written program.
If you see any errors that I made by mistake, fix them for extra credit.
The input file is stored on an A drive disk and is called inven.dat. The layout for the inven.dat file is:
|
Column |
Data in the field |
|
1 - 5 |
Item Number |
|
6 - 30 |
Item Name |
|
31 - 32 |
Vendor Code |
|
33 - 36 |
On Hand (numeric data) |
|
37 - 40 |
On Order (numeric data) |
The output will be sent to the printer.
Note: I am not showing the first 7 characters which are blank, assume the I of IDENTIFICATION DIVISION is in column 8.
|
IDENTIFICATION DIVISION. |
|
|
PROGRAM-ID. INVENPRG. |
|
|
AUTHOR. |
Insert your name here. |
|
ENVIRONMENT DIVISION. |
|
|
INPUT-OUTPUT SECTION. |
|
|
FILE-CONTROL. |
|
|
SELECT INVEN-FILE |
|
|
ASSIGN TO |
Finish the assign statement. |
|
SELECT INVEN-REPORT |
|
|
ASSIGN TO |
Finish the assign statement. |
|
DATA DIVISION. |
|
|
FILE SECTION. |
|
|
FD |
Put in the name of the input file. |
|
DATA RECORD IS INVEN-RECORD. |
|
|
01 INVEN-RECORD. |
|
|
05 INVEN-ID PIC X(5). |
|
|
05 |
Define the rest of the input data fields . |
|
05 |
Use the layout above. |
|
05 |
|
|
05 |
|
|
FD INVEN-REPORT |
|
|
DATA RECORD IS PRINTZ. |
|
|
01 PRINTZ. |
|
|
05 FILLER PIC X. |
|
|
05 INVEN-ID-PR PIC X(5). |
|
|
05 FILLER PIC X(5). |
Define the output data fields on the print |
|
05 |
line. |
|
05 FILLER PIC X(5). |
|
|
05 |
|
|
05 FILLER PIC X(5). |
|
|
05 |
|
|
05 FILLER PIC X(5). |
|
|
05 |
|
|
05 FILLER |
Put in the length of this filler to make a |
|
WORKING-STORAGE SECTION. |
to make a total of 80 or 81 characters. |
|
01 INDICATORZ. |
|
|
05 END-OF-FILE PIC XXX VALUE "NO ". |
|
|
PROCEDURE DIVISION. |
|
|
MAIN-PROGRAM. |
|
|
PERFORM |
Put in the names of the paragraphs to be |
|
PERFORM |
performed. |
|
PERFORM |
|
|
STOP RUN. |
|
|
A-100-INITIALIZATION. |
|
|
OPEN INPUT |
Put in the name of the input file to OPEN. |
|
OUTPUT |
Put in the name of the output file to OPEN. |
|
B-100-PROCESS-FILE. |
|
|
READ |
Put in the name of the file to READ. |
|
AT END |
|
|
MOVE "YES" TO END-OF-FILE. |
|
|
PERFORM B-200-PROCESS-RECORD |
|
|
UNTIL |
Put in the test on the UNTIL clause. |
|
B-200-PROCESS-RECORD. |
|
|
MOVE SPACES TO PRINTZ. |
|
|
MOVE |
Code the rest of the MOVE statements to |
|
MOVE |
MOVE the data from the input file to the |
|
MOVE |
print line. |
|
MOVE |
|
|
MOVE |
|
|
WRITE |
Put in the name of the record to WRITE. |
|
AFTER ADVANCING 1 LINE. |
|
|
READ INVEN-FILE |
|
|
AT END |
|
|
MOVE "YES" TO |
Put in the name of the indicator. |
|
C-100-WRAP-UP. |
|
|
CLOSE INVEN-FILE |
|
|
INVEN-REPORT. |
|