Question: COBOL ASSIGNMENT (PLEASE HELP) For this program, you will have two files: Transaction file Master file You will update the master file by using the

COBOL ASSIGNMENT

(PLEASE HELP)

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

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

CALCULATIONS

Total Amount = Amount 1 + Amount 2

Amount Due = Total Amount Discount Amount

TRANSACTION FILE CONTENTS:

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

WHAT THE MASTERFILE SHOULD LOOK LIKE AFTER EXECUTION:

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

THE CODE I HAVE SO FAR:

It will not compile, keeps giving cusname is invalid level error. I cant even check to see if this code is in fact correct please help

IDENTIFICATION DIVISION.

PROGRAM-ID. PROBLEM1.

DATA DIVISION.

WORKING-STORAGE SECTION.

77 TRAN-ACCNUM PIC X(5).

77 TRAN-CUSNAME PIC X(20).

77 TRAN-AMT1 PIC 9(5)V9(2).

77 TRAN-AMT2 PIC 9(5)V9(2).

77 TRAN-DISCAMT PIC 9(5)V9(2).

77 MAS-ACCNUM PIC X(5).

77 MAS.CUSNAME PIC X(20).

77 TOTAMT PIC 9(4)V9(2).

77 AMTDUE PIC 9(4)V9(2).

77 BLKSPC PIC X(3).

PROCEDURE DIVISION.

000-MAIN-MODULE.

OPEN INPUT ACCOUNT-TRANS

OUTPUT ACCOUNT-MASTER

PERFORM UNTIL ARE-THERE-MORE-RECORDS= "NO "

READ ACCOUNT TRANS

AT END MOVE "NO " TO ARE-THERE-MORE-RECORDS

NOT AT END PERFORM 200-CALC-RTN

END-READ

END-PERFORM

CLOSE ACCOUNT-TRANS

ACCOUNT-MASTER

STOP RUN.

200-CALC-RTN.

MOVE SPACES TO MASTER-REC

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

MOVE CUSNAME-IN TO CUSNAME-OUT

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

SUBTRACT DISCOUNT-AMT-IN FROM WS-TOTAL GIVING 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!