Calculate the current commission that the dealer receives

Assignment Help Programming Languages
Reference no: EM13996656

Program:

For this assignment you will produce a sequential update program using techniques similar to the program I posted at the end of this homework. You are given two files, a "master" file with dealer information called Dealer.dat with record specification of:

01 Dealer-Record.
03 Dealer-NumberPic X(8).
03 Dealer-Name.
05 Last-NamePic X(25).
05 First-NamePic X(15).
05 Middle-NamePic X(10).
03 Address-Line-1Pic X(38).
03 CityPic X(21).
03 State-Or-CountryPic X(5).
03 Postal-CodePic 9(5).
03 Consignment-PercentPic 9(3).
03 Last-Sold-AmountPic S9(7)v99.
03 Last-Sold-DatePic 9(8).
03 Sold-To-DatePic S9(7)v99.
03 Commission-To-DatePic S9(7)v99.

and a transaction file called Trans.dat with record specification of:

01 Trans-Record.
03 Transaction-DatePic 9(8).
03 Transaction-Text.
05 Transaction-TypePic X(4).
05 Transaction-Dealer-NumberPic X(8).
03 Transaction-PricePicS9(7)v99.
03 Transaction-QtyPic 9(3).

Your task is to apply the transactions in Trans.dat to the master file Dealer.dat to produce a "new master" called Dealer-Out.dat. Transactions whose dealer number do not match a dealer number in Dealer.dat will be copied intact to a file Reject.dat.

During the apply step, if the Dealer-Number in Dealer-Record matches the Transaction-Dealer-Number in Trans-Record you will do the following:

• Calculate the value of the current transaction as the Transaction-Qty times the Transaction-Price.

• Update the Sold-To-Date in Dealer-Record by adding in the value of the current transaction.

• Calculate the current commission that the dealer receives by multiplying the value of the current transaction by the Consignment-Percent. Note that the Consignment-Percent is given as a number for 1 to 100, so you need to turn it into a decimal quantity.

• Update the Commission-To-Date by adding in the current commission.

If the date of the transaction is more recent than Last-Sold-Date, then 1) updateLast-Sold-Date to be the date of the transaction (in its original format), and 2)update Last-Sold-Amount to be the same as the value of the current transaction.

(Note that to do a date comparison, you need to reformat the date as YYYYMMDD, and compare the two dates using that format).

You will also keep a running total of:

• The number of transactions processed

• The number of rejected transactions, and

• The total of the commissions paid to dealers.

Prior to exiting the program, you should print these out to the display, so you should get an output similar to the following:

Begin Prog03
Processing Complete
Transactions Read 154
Transactions Rejected 149
Total of Commissions Paid 1,469.10

You should pass in the following

  • Your Prog03.cbl file
  • Your Dealer-Out.dat file
  • Your Reject.dat file

       IDENTIFICATION DIVISION.

       PROGRAM-ID.  SEQ1000.

       ENVIRONMENT DIVISION.

       INPUT-OUTPUT SECTION.

       FILE-CONTROL.

           SELECT RCTTRAN  ASSIGN TO "RCTTRAN.DAT"

               ORGANIZATION IS LINE SEQUENTIAL.

           SELECT OLDMAST  ASSIGN TO "OLDMAST.DAT"

               ORGANIZATION IS LINE SEQUENTIAL.

           SELECT NEWMAST  ASSIGN TO "NEWMAST.DAT"

               ORGANIZATION IS LINE SEQUENTIAL

               FILE STATUS IS NEWMAST-FILE-STATUS.                  

           SELECT ERRTRAN  ASSIGN TO "ERRTRAN.DAT"

               ORGANIZATION IS LINE SEQUENTIAL

               FILE STATUS IS ERRTRAN-FILE-STATUS.

       DATA DIVISION.

       FILE SECTION.

FD  RCTTRAN.

01  TRANSACTION-RECORD      PIC X(23).

FD  OLDMAST.

01  OLD-MASTER-RECORD       PIC X(70).

FD  NEWMAST.

01  NEW-MASTER-RECORD       PIC X(70).

FD  ERRTRAN.

01  ERROR-TRANSACTION       PIC X(23).

       WORKING-STORAGE SECTION.

01  SWITCHES.

05  FIRST-EXECUTION-SWITCH          PIC X   VALUE "Y".

88  FIRST-EXECUTION                     VALUE "Y".

05  ALL-RECORDS-PROCESSED-SWITCH    PIC X   VALUE "N".

88  ALL-RECORDS-PROCESSED               VALUE "Y".

01  FILE-STATUS-FIELDS.

05  NEWMAST-FILE-STATUS     PIC XX.

88  NEWMAST-SUCCESSFUL          VALUE "00".

05  ERRTRAN-FILE-STATUS     PIC XX.

88  ERRTRAN-SUCCESSFUL          VALUE "00".

01  RECEIPT-TRANSACTION.

05  RT-ITEM-NO              PIC X(5).

05  RT-VENDOR-NO            PIC X(5).

05  RT-RECEIPT-DATE         PIC X(8).

05  RT-RECEIPT-QUANTITY     PIC S9(5).

01  INVENTORY-MASTER-RECORD.

05  IM-ITEM-NO              PIC X(5).

05  IM-DESCRIPTIVE-DATA.

10  IM-ITEM-DESC        PIC X(40).

10  IM-UNIT-COST        PIC S9(3)V99.

10  IM-UNIT-PRICE       PIC S9(3)V99.

05  IM-INVENTORY-DATA.

10  IM-REORDER-POINT    PIC S9(5).

10  IM-ON-HAND          PIC S9(5).

10  IM-ON-ORDER         PIC S9(5).

       PROCEDURE DIVISION.

       000-UPDATE-INVENTORY-MASTER.

           OPEN INPUT  RCTTRAN

                       OLDMAST

                OUTPUT NEWMAST

                EXTEND ERRTRAN.

           MOVE LOW-VALUE TO IM-ITEM-NO.

           PERFORM 300-PROCESS-RECEIPT-TRAN

               UNTIL ALL-RECORDS-PROCESSED.

           CLOSE RCTTRAN

                 OLDMAST

                 NEWMAST

                 ERRTRAN.

           STOP RUN.

       300-PROCESS-RECEIPT-TRAN.

           PERFORM 310-READ-RECEIPT-TRANSACTION.

           PERFORM 320-PROCESS-INVENTORY-MASTER

               UNTIL IM-ITEM-NO >= RT-ITEM-NO.

           IF      IM-ITEM-NO = HIGH-VALUE

               AND RT-ITEM-NO = HIGH-VALUE

               SET ALL-RECORDS-PROCESSED TO TRUE

           ELSE

               IF IM-ITEM-NO = RT-ITEM-NO

                   PERFORM 350-APPLY-RECEIPT-TRANSACTION

               ELSE

                   PERFORM 360-WRITE-ERROR-TRANSACTION.

       310-READ-RECEIPT-TRANSACTION.

           READ RCTTRAN INTO RECEIPT-TRANSACTION

               AT END

                   MOVE HIGH-VALUE TO RT-ITEM-NO.

       320-PROCESS-INVENTORY-MASTER.

           IF FIRST-EXECUTION

               PERFORM 330-READ-OLD-MASTER

               MOVE "N" TO FIRST-EXECUTION-SWITCH

           ELSE

               PERFORM 340-WRITE-NEW-MASTER

               PERFORM 330-READ-OLD-MASTER.

       330-READ-OLD-MASTER.

           READ OLDMAST INTO INVENTORY-MASTER-RECORD

               AT END

                   MOVE HIGH-VALUE TO IM-ITEM-NO.

       340-WRITE-NEW-MASTER.

           WRITE NEW-MASTER-RECORD FROM INVENTORY-MASTER-RECORD.

           IF NOT NEWMAST-SUCCESSFUL

               DISPLAY "WRITE ERROR ON NEWMAST FOR ITEM NUMBER "

                   IM-ITEM-NO

               DISPLAY "FILE STATUS CODE IS " NEWMAST-FILE-STATUS

               SET ALL-RECORDS-PROCESSED TO TRUE.

       350-APPLY-RECEIPT-TRANSACTION.

           ADD RT-RECEIPT-QUANTITY TO IM-ON-HAND.

           SUBTRACT RT-RECEIPT-QUANTITY FROM IM-ON-ORDER.

       360-WRITE-ERROR-TRANSACTION.

           WRITE ERROR-TRANSACTION FROM RECEIPT-TRANSACTION.

           IF NOT ERRTRAN-SUCCESSFUL

               DISPLAY "WRITE ERROR ON ERRTRAN FOR ITEM NUMBER "

                   RT-ITEM-NO

               DISPLAY "FILE STATUS CODE IS " ERRTRAN-FILE-STATUS

               SET ALL-RECORDS-PROCESSED TO TRUE.

Attachment:- Dealer.rar

Reference no: EM13996656

Questions Cloud

Create pivot tables and pivot charts to analyze sales : In this project you will create pivot tables and pivot charts to analyze sales, customer and product data. Cleanse the data- Open Pivot Analysis Raw Data and save it as Pivot Analysis your name completed. Review and interpret the data. Resize and/or ..
Identify and discuss the four goals of the new medicare : The authors suggest that the CMS will need a broader strategy to accomplish its mission. List and discuss at least 3 recommendations for shaping this strategy. Which one do you feel will achieve the most good?
How much ice remains when the mixture reaches equilibrium : Does all the ice melt? If so, what is the final temperature of the water? If not, how much ice remains when the mixture reaches equilibrium.
Determine the maximum speed of the mass : A 400g mass on a spring has a speed of 95.4cm/s when it's displacement is 3.0cm and 71.4 cm/s when it's displacement is 6.0 cm what is the maximum speed of the mass?
Calculate the current commission that the dealer receives : CSDP241 Spring, 2016 - Produce a sequential update program using techniques similar to the program given posted at the end of this homework.
How much water must be circulated in the lcvg to remove : During a strenuous period of extravehicular activity, an astronaut generates 2.0 MJ of heat per hour, which must be removed by means of the liquid cooling and ventilating garment (LCVG) worn under the spacesuit. How much water must be circulated ..
Analyze the services offered by the web hosting : As a web developer, choosing an appropriate hosting provider for your client or business is one of the most important steps in the development process. Analyze the services offered by the following web hosting providers: eHost and bluehost
Dtetermine the charge on the particle : The 4000 V equipotential surface is 20.0cmfarther from a positively charged particle than the 5000 V equipotential surface. What is the charge on the particle?

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a program to calculate the volume flow rate

Write a program to calculate the volume flow rate in cubic feet per second of water flowing through a pipe of diameter d in inches and a velocity of v feet per second.

  Program to displays the sum of the integer numeric values

Design a program that displays the sum of the integer numeric values stored in two arrays, in a tabular format. The design defines two arrays of the same size (each array has 10 elements).

  What are the risks associated with directly executing user

1. What are the risks associated with directly executing user input? What are the minimum steps needed to parse user input before it is allowed to be used in execution? 2. What are the risks associated with inheritance in classes? Why are generic cla..

  Compare and contrast database connectivity in vb and c#

Compare and contrast database connectivity in VB® and C#. If you studied database connectivity in Java®, include Java® in the comparison. In which language do you find it easiest to implement a connection to a database? Why

  Write program to calculate student-s quiz average

Write a program that will calculate a student's quiz average. The program should prompt the user for the number of quizzes and then ask the user for each quiz grade.

  Write looping structure pseudocode accepting employee data

Write looping structure pseudocode which prompts user for employee data; application continues to accept data for new employees until user enters 0 for ID number to indicate desire to quit.

  Consider the problem of constructing crossword puzzles

Consider the problem of constructing crossword puzzles: fitting words into a grid of intersecting horizontal and vertical squares. Assume that a list of words (i.e. a dictionary) is provided and that the task is to fill in the squares using any su..

  Program read weight of package of breakfast cereal in ounces

Write a program which will read the weight of package of a breakfast cereal in ounces and output weight in metric tons as well as number of boxes

  Application should calculate and display the order amounts

Make sure the number of units for each package is numeric, and is not negative.

  Write program to allow two users to play tic-tac-toe

Write a program that will allow two users to play tic-tac-toe. The program should ask for moves alternately from player X and player O.

  Create program to compute monthly interest

Create program to compute the monthly interest and print new balances for each of the savers. Then set annualInterestRate to 5% and compute the next month's interest

  Find the sum of the cost line column

Write the SQL to count how many authors have a last name that starts with S.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd