Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

COBOL ASSIGNMENT

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:

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Who manages?

Answered: 1 week ago