Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

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

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M91705495
  • Price:- $65

Guranteed 36 Hours Delivery, In Price:- $65

Have any Question?


Related Questions in Programming Language

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

Overviewthis tasks provides you an opportunity to get

Overview This tasks provides you an opportunity to get feedback on your Learning Summary Report. The Learning Summary Report outlines how the work you have completed demonstrates that you have met all of the unit's learn ...

Background informationthis assignment tests your

Background Information This assignment tests your understanding of and ability to apply the programming concepts we have covered throughout the unit. The concepts covered in the second half of the unit build upon the fun ...

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

Task arrays and structsoverviewin this task you will

Task: Arrays and Structs Overview In this task you will continue to work on the knight database to help Camelot keep track of all of their knights. We can now add a kingdom struct to help work with and manage all of the ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As