Solved-Assignment 5 -Solution

$30.00 $19.00

*Overview* In this assignment, you will rewrite the program you wrote in Assignment 4 using external subroutines instead of internal subroutines. There are a few minor changes and additional steps. ———————————————————————— *Input* The input to the program will be a file with an unknown number of records. The data starts with a number of lines…

You’ll get a: . zip file solution

 

 

Description

5/5 – (2 votes)

*Overview*

In this assignment, you will rewrite the program you wrote in Assignment

4 using external subroutines instead of internal subroutines. There are

a few minor changes and additional steps.

————————————————————————

*Input*

The input to the program will be a file with an unknown number of records.

The data starts with a number of lines very much like those in the data

for Assignment 4, followed by a line containing the integer -222222222.

This number serves as a delimiter and is not part of the data. After

that are three lines each containing two integers as described below.

Use the following JCL statement to specify the input file:

//FT05F001 DD DSN=KC02314.SPRING18.CSCI360.HW5DATA,DISP=SHR

————————————————————————

*What needs to be done*

* Call the BUILD subroutine to read lines in the file until it find

the delimiter line. Each line contains zero or more integers. Put

the integers in the table. Do not put the delimiter value -222222222

in the table.

* After you find the line containing -222222222, read the next three

lines in the file. Each contains two small nonzero integers which we

can call D1 and H1 (first line), D2 and H2 (second line) and D3 and

H3 (third line). Store these in fullwords for now.

* In the main routine, print a heading saying something like “Table

Contents”.

* Now call subroutine PRINT to print the contents of the table with 5

numbers on each line.

* In the main routine, print a heading saying something like

“Multiples of D1” (filling in the value of D1).

* Call subroutine PRINT to print a list of all of the integers which

are multiples of D1 with H1 values on each line. (The last line may

not have as many as H1 values on it.)

* Now repeat the last step with D2 and H2.

* Now repeat the last step with D3 and H3.

————————————————————————

*External Subroutines*

You will need several external subroutines:

* BUILD is a subroutine that will read the input file and build the

table. It will store the address of the last entry in a fullword

passed in as its second parameter.

The arguments for BUILD are:

o the address of the input buffer

o the address of the table

o the address of a fullword containing the address of the next

available entry

* PRINT is a subroutine that will print all numbers in the table that

are multiples of DIV (thus all the numbers if DIV is 1 or -1), with

HOWMANY values per line, starting on a new page and double-spaced.

The arguments for PRINT are:

o the address of the table

o the address of a fullword containing the address of the next

available entry

o the address of a fullword called DIV

o the address of a fullword called HOWMANY

The first time you call PRINT, use the values 1 and 5 for DIV and

HOWMANY. Later, those values will come from input. Before you call

PRINT, copy the values you want into DIV and HOWMANY.

There are several requirements for using an external subroutine:

* Each external subroutine is actually a separate program. You need a

_CSECT_ with the name of the subroutine, as in:

BUILD CSECT

* You need to create a _parameter list_ for the subroutine (a set of

consecutive fullwords, each containing the address of a parameter).

We did this with internal subroutines.

* You need to _call_ the subroutine, as in:

LA 1,BPARMS Parmlist for BUILD

L 15,=V(BUILD) Get the address of BUILD

BALR 14,15 Branch to BUILD

Here the BALR instruction will set register 14 = the address of the

next instruction after the BALR.

* In the subroutine, you need a _register save area_ and _standard

entry linkage_. (You should probably go read about standard entry

linkage.)

* At the end of the subroutine, you need _standard exit linkage_. (You

should probably go read about standard exit linkage.)

————————————————————————

*Other Requirements*

* The JCL for this assignment is the same as the JCL for Assignment 4

except the line above to specify the input file.

* You may assume that the table needs to hold no more than 80 values.

You do not need to count the numbers. Each entry is one fullword.

Initialize the table to the value -128 (as in 80F’-128′).

* In the PRINT subroutine, you may assume the value of HOWMANY is

never more than 7.

* In the PRINT subroutine, examine the value of DIV. If it is 1, print

all the numbers in the table. If it is not 1, print only those

numbers which are multiples of DIV. (Actually, everthing is a

multiple of 1.)

* The first time you call PRINT, the value of DIV should be 1 and the

value of HOWMANY should be 5. The second time you call PRINT, the

value of DIV should be D1 and the value of HOWMANY should be H1. The

third time you call PRINT, use the values of D2 and H2 for DIV and

HOWMANY, respectively. You can manage this with one parameter list

containing the addresses of two fullwords, DIV and HOWMANY, and then

change the values of those fullwords as needed.

* In PRINT, double-space between lines of numbers.

* You may use register equates if you want, but it is not required.

* You may use extended mnemonics such as BH, BL, BNE, etc. for branch

instructions.

* Document your program as usual and submit it through Blackboard as

usual.