$35
CSCI 465 Assignment 5 – COBOL
250 points
This assignment's objective is to give you more experience using the basics of the COBOL programming
language. For this assignment, you will be building upon the report you created for Assignment 4.
After the stock market closes at the end of a trading business day, mutual fund managers meet and
determine the day's closing price per share for the mutual fund they manage. This price per share is based
on the daily closing value of the shares of different stocks and bonds the mutual fund holds in its hopefully
diverse portfolio.
The bulk of the single input file represents sales transactions by brokers around the world, all for a single
mutual fund. The first record of the transaction file provides the business day's closing share price and
name of the mutual fund to be processed.
For reference, after the U. S. Stock Market closes, the mutual fund's portfolio managers determine the daily
closing share price of the mutual fund based on how the fund's portfolio of stocks, bonds and other
investment instruments performed during the trading day.
Each of the remaining unknown number of records in the input file represents the day's sales by a single
broker. The branches where the brokers work are identified by the city in which they are located and the
brokers are, of course, identified by their names.
The Data
The input records:
The First Record in the File:
Share Price: 5 bytes zoned decimal with two decimal places (lowest price per share is
$0.01 and the maximum price per share is $999.99)
Mutual Fund Name: 35 bytes (centered in the 35 bytes)
Commission Percent 1: 6 bytes zoned decimal (Example: 100000 = 100.000%)
Commission Percent 2: 6 bytes zoned decimal (Example: 000025 = 0.025%)
Commission Percent 3: 6 bytes zoned decimal (Example: 000005 = 0.005%)
Unused: 22 bytes
The Remaining Records in the File:
Branch Name: 25 bytes character
Broker’s Name: 25 bytes character
Deposit Amount: 11 bytes zoned decimal with two decimal places (max. $999,999,999.99)
Unused: 3 bytes
Commission Percent Flag: 1 byte zoned decimal (value of either 1, 2 or 3)
Unused: 15 bytes
Note that even though the layout of the so-called "remaining records" in this assignment matches
that in Assignment 4, the numbers might be smaller or larger.
CSCI 465 Assignment 5 - COBOL Page 2 of 5
The Program
Write a COBOL program that creates two well-designed reports and write them to the same .
Get the date and time using the COBOL Intrinsic Date Function only ONCE, perhaps in a subroutine
performed at the very beginning of your program before you open any files for reading or writing.
Open and read the first record from the file and save the daily share price of the mutual fund shares. Move
the name of the mutual fund to your report header. Save the three commission percentages to use them to
calculate broker commissions.
Begin reading the remaining records in the file, each representing a single broker's daily sales of the mutual
fund. Read until end-of-file creating the report with detail lines for each record (broker sale) processed.
As you go through the file of broker sales records, you need to compute the share amount, i.e., number of
shares sold. This is done by dividing the deposit amount (note that deposit amount and sales amount are the
same thing) by the share price for the day. After that, you will need to determine whether or not a broker
has sold more than 150,000.0000 shares of the mutual fund. If so, write ONLY the broker’s name and the
share amount in packed decimal (that you have computed) to a temporary data set. The for this
temporary data set should only be large enough to hold the broker's name and the number of shares they
sold in a minimum of packed decimal bytes. This means that you will have to open the temporary data set
for output BEFORE reading the first broker sales record.
Note: To simplify things, though, get the first report done correctly and THEN you can come back to the
processing described in the above paragraph.
The First Report
Using all 132 bytes available across the printed page. Spread the first report headers and detail lines and
any summary totals lines at the end of the report across the entire 132 bytes but make sure they look as
good and clear to read as possible and are appropriately spaced.
The first report should have three appropriate header lines, single spaced, at the top of each printed page.
The first header line should include the date in the form MM/DD/YYYY in the upper left hand corner, the
name of the mutual fund company (from the first record in the file) in the middle of the line and the page
number in the form of PAGE: nnn in the upper right hand corner. Be sure that the month and day of the
date show the leading 0 when months January through September and days 1 through 9 of each month. See
the example output.
The second header line should include, directly under the date, the time in the form HH:MM. For this report,
you must determine if it is AM or PM. If PM, subtract 12 from the hour and print the time with PM,
otherwise print the time with AM. In the middle of the page, centered under the name of the mutual fund
company, the text BROKER SALES AND COMMISSIONS REPORT for this first report. See the example
output.
The third header line should include a label of SHARE PRICE: and the formatted current share price
centered across the report under the previous two header lines. The largest share price is $999.99 so the
receiving field should be appropriately numeric-edited to display the floating dollar sign, suppressed
leading zeros, the decimal and two decimal places. See the example output.
CSCI 465 Assignment 5 - COBOL Page 3 of 5
Each detail line should be double-spaced. Below the headers, print column headers for the information to
be included in the detail lines below it such as:
BRANCH NAME BROKER NAME SALES AMOUNT SHARE AMOUNT etc.
Note: When creating column headers, it is always best to place headers for character data, like BRANCH
NAME and BROKER NAME in this program, left-justified over the detail line columns, and, for numeric
data, like SALES AMOUNT, right-justified over the detail line columns. It is also good to put some
appropriately placed hyphens single-spaced underneath the column headers. They should indicate the
maximum size of the field itself. If the column header is longer than the maximum size of the field itself,
put a hyphen under every character of the column header.
There should be no more than 18 double-spaced detail lines (not including headers and column headers)
per page of detail lines. Of course, be sure that the header lines are printed and the page number increased
by one for each new page of the report, including the summary totals page.
Each detail line should include, in this order from left to right, the Branch Name, the Broker Name, the
Sales Amount, the computed Share Amount (described below) and the computed Broker Commission
Amount (which depends on the Commission Percent Flag).
See the 465 Assign 5 COBOL Exact Output Fa21.txt file provided on Blackboard.
The First Report Totals
As you process records from the broker sales file, keep running totals of 1) the number of records,
i.e., number of brokers processed, 2) the total deposit amount processed, 3) the total number of shares
computed and 4) the total broker commission amount computed.
You will report the totals across a single summary line on a separate summary page at the end of the printed
first broker sales report. Although on a new page, place the totals for deposits, shares, and broker
commissions directly under the columns for those items in the detail lines. You can print the number of
brokers on the same line but to the left of total deposits. You can even add new column headers on the final
totals page for these totals.
See the example output provided.
The Second Report
Just like the first report, use all 132 bytes available across the printed page. Spread the second report headers
and detail lines and any summary totals lines at the end of the report across the entire 132 bytes but make
sure they look as good and clear to read as possible and are appropriately spaced.
The second report should also have three appropriate header lines, single spaced, at the top of each printed
page. The first header line should include the date in the form MM/DD/YYYY in the upper left hand corner,
the name of the mutual fund company (from the first record in the file) in the middle of the line and the
page number in the form of PAGE: nnn in the upper right hand corner. Be sure to reset your beginning
page number to 1 for this report.
The second header line should include, directly under the date, the time in the form HH:MM. For this report,
you must determine if it is AM or PM. If PM, subtract 12 from the hour and print the time with PM,
otherwise print the time with AM. In the middle of the page (horizontally speaking), centered under the
CSCI 465 Assignment 5 - COBOL Page 4 of 5
name of the mutual fund company, the text BROKER LARGE SALES REPORT for this second report. Do
not display the current share price in the headers for this report.
Each detail line should be double-spaced. Below the headers, print column headers for the information to
be included in the detail lines below it such as:
BROKER NAME SHARE AMOUNT
Note: Once again, when creating column headers, it is always best to place headers for character data, like
BROKER NAME in this program, left-justified over the detail line columns, and, for numeric data, like
SHARE AMOUNT, right-justified over the detail line columns. It is also good to put some appropriately
placed hyphens single-spaced underneath the column headers. They should indicate the maximum size of
the field itself. If the column header is longer than the maximum size of the field itself, put a hyphen under
every character of the column header.
There should be no more than 18 double-spaced detail lines (not including headers and column headers)
per page of detail lines. Of course, be sure that the header lines are printed and the page number increased
by one for each new page of the report, including the summary totals page.
Each detail line should include, in this order from left to right, the Broker Name and the computed share
amount.
See the example output provided.
The Second Report Totals
As you process records from this high sales temporary file, keep a running total of 1) the number of records,
i.e., number of brokers processed, and 2) the total number of shares.
You will report the totals across a single summary line on a separate summary page at the end of the printed
broker high sales report. Display the number of high sales brokers and their high sale shares total in the
middle of the page as there are only two numbers to display. You should add new column headers on this
page for the two numbers you are displaying.
See the example output provided.
The Output of Your Job
What you will hand in will be one single three-step job .txt file with an instream COBOL
program followed by a Binder step followed by a fetch step similar to what you have done before.
Document both your COBOL program and your JCL as dictated in Chapter 1 of the Course Notes.
Additional Programming Notes:
• Deposit Amount and Sales Amount are the same thing! Refer to the fields in your code using
, and (using the latter if defined in packed decimal in your
). The column header should say , though, for management's sake.
CSCI 465 Assignment 5 - COBOL Page 5 of 5
• Share Amount = Deposit Amount / Share Price. As in the real world, round the Share Amount to three
decimal places but display this amount in a detail line with four decimal places and the final decimal
place ALWAYS set to 0.
• In addition to their salaries, which we do not need to know for this report, brokers are paid a commission
based on the Commission Percent Flag. Use Commission Percent 1 from the input file's first record to
compute commission dollar amount for those brokers with a Commission Percent Flag = 1, use
Commission Percent 2 from the input file's first record to compute commission dollar amount for those
brokers with a Commission Percent Flag = 2, and use Commission Percent 3 from the input file’s first
record to compute commission dollar amount for those brokers with a Commission Percent Flag = 3.
• Commission is a dollar amount and should be rounded to two decimal places when computed.
• Be sure to edit all numbers to be displayed by suppressing leading zeros if not a dollar amount and
adding commas and a floating dollar sign for any dollar amount.
• Please remove display commands used for debugging before you submit your file for grading.
• Be sure that EVERY byte of your output 132-byte records are either fields receiving data or in-between
bytes initialized as spaces. Remember that there should be NO byte undefined.
• Note the example output for both reports – including their totals pages – included in the Assignment 5
folder on Blackboard. The numbers are not correct but show spacing of detail columns, headers, etc.
• Note the addition of the word TOTALS to the second header of each of the two reports’ totals pages.