CSCI 360 Spring 2014

Program 6
Packed Decimal Arithmetic and Edited Output
(100 points)


Overview

For this assignment, write a program that will build and print a table of statistics for the current (partial) season of the Chicago Blackhawks hockey team.

Input

The input to the program will be an unknown number of records (maximum of 30). Each record contains the information for one player and has the following format:

columns         description
-------         -----------
 1 - 2          player number (unsigned)
 3              blank
 4              position code (character)
 5              blank
 6 - 30         player name (character)
31 - 32         number of games played (unsigned)
33              blank
34 - 35         number of goals scored (unsigned)
36              blank
37 - 39         number of assists (unsigned)
40              blank
41 - 44         number of shots taken (unsigned)
45 - 46         blank
47 - 48         +/- rating (signed)
49 - 80         blank

The position code is a single character that indicates the position that the player plays.

position code       playing position
-------------       ----------------
      C                 Center
      D                 Defense
      L                 Left Wing
      R                 Right Wing

The +/- rating is a signed integer value that represents the number of times a player is on the ice when a goal is scored. If the value is negative, then the player has been on the ice for more goals that were scored against the team than for the team. If the value is positive, then the player has been on the ice for more goals that were scored for the team than against the team.

For example, assume the following are the 47-48 bytes of two of the records in the input file of data:

2E
 J

The first record indicates that the player has a +/- rating of +25 (they've been on the ice for 25 more goals scored for the team rather than against). C'2E' is equivalant to X'F2C5'. When the value is PACKed, it becomes X'025C'.

The second record indicates that the player has a +/- rating of -1 (they've been on the ice for 1 more goal scored against the team rather than for the team). C' J' is equivalant to X'40D1'. When the value is PACKed, it becomes X'001D'.

Table Requirements:

This program requires one table, which should be defined in the storage area for the MAIN routine and should be able to hold a maximum of 30 entries. Each entry of the table represents a single player and should have the following format:

SIZE      STORED
----      ---------------------
PL 2      Player Number
CL 1      Position Code
CL 25     Player name
PL 2      Number of games played
PL 2      Number of goals scored
PL 2      Number of assists
PL 3      Number of shots taken
PL 2      +/- rating
----
39 bytes

Internal Routines:

You should use at least 3 internal subroutines: MAIN, BUILD, and PRINT.

MAIN

This routine will control the flow of the program by:

  1. BUILDing the table of information
  2. PRINTing the table of information

The storage area for this routine is where the table, the fullword that holds the next available entry address for the table, input buffer, and parameter list(s) should be defined.

Make sure that the fullword that holds the address of the next available table entry initially contains the beginning address of the table.

BUILD

This routine will put the information from the input file into the table and set the address of the next available entry for the table. All numeric data will be put into the table in packed decimal format, which means that the XDECI instruction will not be used in this assignment.

Input Parameters:

NOTE: The address of the beginning of the table is not being directly passed into the BUILD routine. The code should be written to use the address of the next available table entry to set up the table pointer. By doing this, the BUILD routine can start placing data anywhere in the table.

Suggested Logic for the BUILD routine:

1. Initialization:  Load the input parameters
                    Set up the table pointer

2. Read the first input record
3. While there are input records

4.   Move the player's name and position code into the table

5.   Pack the number of games played, goals scored, assists,
        shots taken, and +/- rating into the table

6.   Increment the table pointer to the start of the next entry
7.   Read the next input record
8. Endwhile

9. Pass back the address of the next available table entry

PRINT

This routine will print a report of player information.

For each player, print the player's number, name, position, number of games played, number of goals scored, number of assists, number of points scored, number of shots taken, shooting percentage, and +/- rating.

Use the following formulas for the calculated values:

Number of Points Scored = Number of goals scored + Number of assists

Shooting Percentage = Number of goals scored / Number of shots taken * 100

All mathematical computations in this routine MUST use the packed decimal arithmetic instructions. The Shooting Percentage should be rounded and have one digit after the decimal point. NOTE: it is safe to assume that every player has taken a shot.

All of the numeric fields should be formatted using the ED/EDMK instruction. This means that the XDECO instruction will not be used in this assignment. Use the following formatting guidelines:

Input Parameters:

Suggested Logic for the PRINT routine:

1. Initialization:  Load the input parameters

2. While there are players in the table

3.   Move the player's name and position to the print line

4.   Edit the player number, number of games played, goals scored,
        assists, shots taken, and +/- rating

5.   Calculate and edit the number of points scored
6.   Calculate and edit the shooting percentage

7.   Increment the table pointer to the start of the next entry
8. Endwhile

Processing Requirements:

  1. The shooting percentage should be rounded to the nearest tenth of a percent by using the SRP instruction.

  2. The report should begin on a new page. The column headers should be triple spaced from the page header. The player lines should be single spaced.

  3. Test the program with your own instream data. For the final run, replace your instream data with the following JCL:

  4. //FT05F001 DD DSN=KC02330.CSCI360.FILES(DATA6),DISP=SHR

Output

The output for the program will be a report of the player information.

Note: It's possible that the assignment will need to be printed in Landscape to see all of the output columns.

                                             Chicago Blackhawks Player Stats


#   Player                   Position       Games    Goals   Assists    Points      Shots    Shooting %   +/- Rating
--------------------------------------------------------------------------------------------------------------------
88  Patrick Kane             Right Wing       59       27       36         63        195        13.8          +8
10  Patrick Sharp            Left Wing        60       28       30         58        231        12.1         +18
19  Jonathon Toews           Center           60       19       36         55        154        12.3         +21
81  Marian Hossa             Right Wing       55       24       26         50        191        12.6         +26
 2  Duncan Keith             Defense          59        3       45         48        147         2.0         +19
20  Brandon Saad             Left Wing        60       18       22         40        110        16.4         +22
 7  Brent Seabrook           Defense          60        6       28         34        114         5.3         +24
65  Andrew Shaw              Right Wing       58       14       12         26        113        12.4         +11
16  Marcus Kruger            Center           60        6       18         24         60        10.0          +7
 4  Niklas Hjalmarsson       Defense          60        4       19         23         78         5.1         +13
 8  Nick Leddy               Defense          60        6       17         23         88         6.8         +13
23  Kris Versteeg            Right Wing       41        7       14         21         69        10.1          +3
28  Ben Smith                Right Wing       53        7       10         17         56        12.5          +3
27  Johnny Oduya             Defense          58        3       10         13         60         5.0          +7
52  Brandon Bollig           Left Wing        60        6        6         12         79         7.6          +2
26  Michal Handzus           Center           41        4        7         11         33        12.1          -1
37  Brandon Pirri            Center           28        6        5         11         34        17.6          +6
29  Bryan Bickell            Left Wing        43        8        2         10         63        12.7          -7
32  Michal Rozsival          Defense          33        1        5          6         31         3.2           0
11  Jeremy Morin             Left Wing        15        1        4          5         31         3.2          +2
17  Sheldon Brookbank        Defense          32        1        3          4         30         3.3          +4
42  Joakim Nordstrom         Center           10        1        1          2         10        10.0          +2