Question: For this program, you will have two files: Transaction file Master file You will update the master file by using the transaction file. The file

For this program, you will have two files:

Transaction file

Master file

You will update the master file by using the transaction file. The file layouts/records for the two files are:

TRANSACTION FILE

Account Number: 5 alphanumeric characters

Customer Name: 20 alphanumeric characters

Amount 1: 5 total numeric characters, with two decimal places (999v99)

Amount 2: same layout as Amount 1

Discount Amount: Same layout as Amount 1

contents of transaction file:

00001FRANK DIMAGGIO 475611234501500 01000CHARLES HANSON 009990100001000 20000PAUL BROWN 234561119902000 45000GARY JONES 010000100000500 60000TODD HARTMAN 300002000010000 

MASTER FILE

Account Number: 5 alphanumeric characters

Customer Name: 20 alphanumeric characters

Total Amount: 4 numeric characters, decimal placeholder, 2 numeric characters

Amount Due: same layout as Total Amount

Blank space: 3 alphanumeric

contents of master file:

00001FRANK DIMAGGIO 059906058406 01000CHARLES HANSON 001999000999 20000PAUL BROWN 034655032655 45000GARY JONES 002000001500 60000TODD HARTMAN 050000040000 

CALCULATIONS

Total Amount = Amount 1 + Amount 2

Amount Due = Total Amount Discount Amount

-----------------Code I have so far---------------------------------------------------

****This is the code that is give but some of it is missing

IDENTIFICATION DIVISION.

PROGRAM-ID. COBOLHOMEWORK1.

AUTHOR. Author A. Author.

DATE-WRITTEN 28 November 2000

*

* a program to sum two amounts and subtract a discount

*

ENVIRONMENT DIVISION.

INPUT-OUTPUT SECTION.

FILE-CONTROL.

SELECT ACCOUNT-TRANS

ASSIGN TO '/home/author/COBOL/TRANSACT.txt'

ORGANIZATION IS LINE SEQUENTIAL.

SELECT ACCOUNT-MASTER

ASSIGN TO '/home/author/COBOL/MASTER.txt'

ORGANIZATION IS LINE SEQUENTIAL.

DATA DIVISION.

FILE SECTION.

FD ACCOUNT-TRANS.

01 TRANS-REC.

05 ACCT-NO-IN PIC X(5).

05 CUST-NAME-IN PIC X(20).

05 AMT1-IN PIC 999V99.

05 AMT2-IN PIC 999V99.

05 DISCOUNT-AMT-IN PIC 999V99.

FD ACCOUNT-MASTER.

01 MASTER-REC.

05 ACCT-NO-OUT PIC X(5).

05 CUST-NAME-OUT PIC X(20).

05 TOTAL-OUT PIC 9999V99.

05 AMT-DUE-OUT PIC 9999V99.

05 PIC X(3).

WORKING-STORAGE SECTION.

01 WS-STORED-AREAS.

05 ARE-THERE-MORE-RECORDS PIC XXX VALUE "YES".

05 WS-TOTAL PIC 9(4)V99.

PROCEDURE DIVISION.

000-MAIN-MODULE.

DISPLAY 'COBOL HOMEWORK 1'.

STOP RUN.

200-CALC-RTN.

MOVE SPACES TO MASTER-REC

MOVE ACCT-NO-IN TO ACCT-NO-OUT

MOVE CUST-NAME-IN TO CUST-NAME-OUT

ADD AMT1-IN AMT2-IN GIVING WS-TOTAL, TOTAL-OUT

SUBTRACT DISCOUNT-AMT-IN FROM WS-TOTAL GIVING AMT-DUE-OUT

DISPLAY "Customer " CUST-NAME-OUT " gets $" AMT-DUE-OUT

WRITE MASTER-REC.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!