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---------------------------------------------------
IDENTIFICATION DIVISION.
PROGRAM-ID. COBOLHOMEWORK1.
AUTHOR. Author A. Author.
DATE-WRITTEN 11 November 2017
*
* 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
RECORD CONTAINS 40 CHARACTERS.
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
RECORD CONTAINS 40 CHARACTERS.
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).
PROCEDURE DIVISION.
DISPLAY 'COBOL HOMEWORK 1'.
STOP RUN.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started