Math Assignment:
DATA DIVISION.
FILE SECTION.
FD INPUT-FILE
DATA RECORD IS INPUT-REC.
01 INPUT-REC.
05 ITEM-NO PIC XXX.
05 ON-HAND PIC 9(5).
05 ON-ORDER PIC 9(4).
05 REORD-PT PIC 9(4).
05 COST PIC 999V99.
05 PRICE PIC 9(4)V99.
...
...
WORKING-STORAGE SECTION.
...
01 WORK-AREAS.
05 ANS1-WS PIC 9(6) VALUE 0.
05 ANS2-WS PIC 9(5) VALUE 0.
05 ANS3-WS PIC 9999 VALUE 0.
05 ANS4-WS PIC 9(4)V99 VALUE 0.
Using the data names defined above, write the math statements to accomplish
the following (be sure to pick an answer field big enough to hold the answer):
- Add the number on hand and the number on order and store the answer in
one of the fields defined under WORK-AREAS.
- Subtract the number on hand from the reorder point and store the answer
in one of the fields defined under WORK-AREAS.
- Subtract the cost from the price and store the answer in one of the
fields defined under WORK-AREAS.
- Add on hand and on order and store the answer in one of the fields
defined under WORK-AREAS. Then take this answer and subtract it from
reorder point and store the answer in one of the fields defined under
WORK-AREAS.
For the following problems, assume that the fields I name have been
defined appropriately in the DATA DIVISION. Just write the called for math
statement:
- Multiply FLD1 times FLD2 and store the answer in RSLT1-WS.
- Divide AMT1 by AMT2 and store the answer in RSLT2-WS. Use the
DIVIDE...INTO to accomplish this.
- Divide AMT 1 by AMT2 and store the answer in RSLT2-WS. Use the
DIVIDE...BY to accomplish this.
- Multiply FLD1 by 500 and store the results in RSLT3-WS. Round the
answer.
- You are counting the number of records. Every time you read a record
you want to add 1 to the field called TOT-CT-WS.
- You are accumulating the total of the SALARY field. Every time you
read a record you want to add the salary to the accumulator called
TOT-SAL-WS.