Starting from:

$30

Assignment 9 – Subprograms and Linkage 

CSCI 360 Assignment 9 – Subprograms and Linkage 
200 points
This assignment adds four external subprograms to your Assignment 8 program. Each subprogram will
require at least one parameter passed to it.
To start, copy your PDSE member and name the new PDSE member .
will "drive", or control, the processing of the payroll information to create the exact same report
you created in Assignment 8.
The input data set is
Note that ALL records must be read in the subprogram described below.
External Subprograms
Implement each of the following subprograms ONE AT A TIME! Get it working before moving to
the next.

Parameter List:
Functionality:
This subprogram will read the input file and, for the first record, will pack the federal and state
withholding percentages into the storage of to be used later. To do this, both and
must be passed to as parameters. For the remaining records, place the character
(employee name) and packed decimal fields (employee ID, hourly pay rate, hours worked, deductions
and bonus) for each employee into a table defined in the main program's storage, named with
120 entries. Each entry of the table should only be as long as absolutely necessary to store an employee's
data. The table should be defined in the storage of the main program immediately following the 18-
fullword register save area and, like and , must be passed into as a
parameter.

Parameter List:
Functionality:
This subprogram will be the most complex. It will process the employee data stored in the table in a
loop creating the exact same report as created in Assignment 8. It will call when necessary
CSCI 360 Assignment 9 – Subprograms and Linkage Page 2 of 4
for each employee entry in the table.
Keep running totals in this subprogram and, when the table and all employees have been detailed, print
the totals page and, when ready, call to calculate each of the averages in turn. Before calling
the subprogram, move the total that needs averaging to a generic 7-byte packed decimal field named
. When the subprogram completes its work and returns, the average should be stored
in the generic 6-byte packed decimal field named .
Note that, if a variable is declared in a program (for example, in ) that calls a
subprogram ( ) that needs that variable as a parameter and then THAT subprogram ( )
calls another subprogram ( ) that needs the same variable as a parameter, you need to do
something special. First, dereference that parameter in the first subprogram ( ) using the
standard instruction. After doing this, the address of that variable ( ) is in one of the
registers. To prepare to pass that same address to the subprogram ( ) of the subprogram
( ), store the pointer register's contents (the one that points to , for example) in the
parameter list defined in the subprogram's ( 's) storage that will be used to call the subprogram
( ).
In the first subprogram's ( 's) storage, declare:
Then, when you enter and do the , store the register that points at at
and the register that points at at before calling .
You will have to do something similar with in the parameter list named to prepare
to call .
Additionally, after you the into the print line after the loop in , shift it 2 decimal
digits to the left to add two decimal places so that it and the total you're going to divide by it in
will both start out with the same number of decimal places BEFORE calling . Of course, only
shift it only once and then use it to call as many times as necessary.

Parameter List:

Functionality:
This external subprogram will calculate the employee's two withholding amounts and the employee's
net pay amount.
CSCI 360 Assignment 9 – Subprograms and Linkage Page 3 of 4

Parameter List:
Functionality:
This external subprogram will calculate a single average. It must be called each time an average needs
to be calculated.
Notes
• calls first and then .
• calls subprogram when necessary and, when it is done processing all of the
employees and is ready to calculate and print averages on the totals page, calls as necessary.
• Use a for both the input record and the table entry. A should only be declared above the
in which it is used. The names of a and all of its fields must begin with a dollar sign.
• Be sure that you use the variable names provided for the previous assignment. For the fields'
corresponding input fields, replace the beginning with , for their corresponding output fields, replace
the beginning with , for their corresponding tablized fields, replace the beginning with , and, for
their corresponding fields, replace the beginning with a dollar sign ( ).
• Note that you will not need all of the provided variable storage in the main program and in every
subprogram. Decide which need to be declared in which program or subprogram. For example, the
input record need only be declared in . Variables named , , ,
and will now all be packed into and stored in an entry of the table. A should
be defined for a single table entry.
• Once again, pay close attention to the exact output provided and what it looks like to help you build your
program.
• Note that you will get addressability errors in when you declare your table. Be sure your 18-
fullword save area to the top of storage (right after the and statements that immediately follow
the ) and add the following immediately after standard entry linkage for only:
This establishes register 11 as a second base register that takes over from register 12 when your program
is longer than 4095 bytes and then establishes register 10 as a third base register that takes over from
register 11 when your program is longer than 8192 bytes. Because of this, make sure you don't use
registers 10 or 11 in your code. All of this is because your table is 6,360 bytes long!
CSCI 360 Assignment 9 – Subprograms and Linkage Page 4 of 4
• As you were taught, you are not allowed to reference a variable that is defined in a different by
name! ASSIST might not flag this as an error but it is. You may only use parameters and registers as
pointers to reference variables in other s.
• The output from this program will match that from your Assignment 8 program exactly!
• Put your s and their subprograms in the following order in your file:
Document your program completely according to the CSCI 360 Documentation and Coding Guidelines
in Course Documents on Blackboard and submit your single .txt file on Blackboard as before.

More products