CSCI 360 Spring 2014

Program 9 -- Bit Manipulation
(100 points)


Overview

For this assignment, write a program that will process the domestic and imprted beer information for a liquor store. The beer information will be put into a table and then printed.

Input

The input to the program is a file that contains an unknown number, but no more than 40, variable length beer records. Each record contains a beer name, brewery location, number of cases in stock, and price per case. Each field ends with a colon (:). For example:

Anchor Steam:California:25:1599:
Pete's Wicked Ale:California:24:2141:
Sierra Nevada Pale Ale:California:18:2699:
New Belgium Fat Tire Amber Ale:Colorado:12:2364:
Boulder Planet Porter:Colorado:1:2220:
Coors Original:Colorado:32:1799:
Coors Light:Colorado:29:1799:
Boulder Pass Time Pale Ale:Colorado:17:1794:
Killian's Irish Red Lager:Colorado:31:2459:
Hazed and Infused Dry Hopped Ale:Colorado:21:2180:
Samuel Adams Boston Lager:Massachusetts:33:2141:

NOTE: For ease, the input records are grouped together based on the brewery location.

Table Requirements

The table should be defined as 2360 bytes in the storage area for the MAIN routine. Since the length of the beer name and brewery location varies from beer to beer, the actual length of a beer name and brewery location will need to be stored as part of a table entry. Therefore, each entry's length will ultimately be determined beer name and brewery location.

Each entry should have the following format:

  Field Size        Field Contents
  2 bytes           The length of the beer name and the brewery location (binary)
  2 bytes           The number of cases in stock (packed)
  3 bytes           The price per case (packed)
  1 - 32 bytes      The name of the beer (minimum 1 byte; maximum 32 bytes)
  1 - 20 bytes      The location of the brewery (minimum 1 byte; maximum 20 bytes)

As noted above, the length of the beer name and the brewery location will be condensed into a two byte field. This means that each of the values will be stored as a specific number of bits. These two bytes should have the following format:

  Bits              Field Contents
  0 - 5             The length of the beer name
  6 - 10            The length of the brewery location
 11 - 15            Filler - should always be 0s

Processing

The program will consist of three external routines: MAIN, BUILD, and PRINT.

Main Routine

This routine will control the overall flow of the program by implementing the following logic:

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

The parameter list(s), table, and storage area for the logical end of table address should all be defined in the storage area for this routine.

BUILD Routine

This routine will process the input file and place the data into the table.

Input Parameters for the BUILD routine

Suggested Logic for the BUILD routine

 1. Initialization:  Load the input parameters

 2. Read the first input record
 3. While there are input records
 4.   Calculate and save the length of the beer name
 5.   Put the beer name into the table
 6.   Calculate and save the length of the brewery location
 7.   Put the brewery location into the table
 8.   Combine the lengths of the beer name and brewery location into 2 bytes
 9.   Make sure the combined lengths are padded with 5 bits of 0
10.   Put the two bytes into the table
11.   Put the # of cases and case price in the table
12.   Increment the table pointer to the start of the next entry
13.   Read the next input record
14. Endwhile
15. Return the address of the logical end of the table

Implementation Hints:

To aid in the debugging process, here is a partial dump of the table that the BUILD routine is producing. The table begins at address X'0000A0'.

                             CORE ADDRESSES SPECIFIED-     0000A0 TO 000AA0
0000A0   3140025C 01599CC1 95838896 9940E2A3    858194C3 81938986 96999589 81454002   *. .....A..... S....C.......... .*
0000C0   4C02141C D785A385 7DA240E6 89839285    8440C193 85C38193 89869699 95898159   *....P..... W..... A..C..........*
0000E0   40018C02 699CE289 85999981 40D585A5    81848140 D7819385 40C19385 C3819389   * .....S..... N..... P... A..C...*
000100   86969995 89817900 012C0236 4CD585A6    40C28593 8789A494 40C681A3 40E38999   *.............N.. B...... F.. T..*
000120   8540C194 82859940 C19385C3 96939699    81849655 00001C02 220CC296 A4938485   *. A.... A..C..............B.....*
000140   9940D793 819585A3 40D79699 A38599C3    96939699 81849639 00032C01 799CC396   *. P..... P.....C..............C.*
000160   9699A240 D6998987 89958193 C3969396    99818496 2D00029C 01799CC3 969699A2   *... O.......C..............C....*
000180   40D38987 88A3C396 93969981 84966900    017C0179 4CC296A4 93848599 40D781A2   * L....C..............B...... P..*
0001A0   A240E389 948540D7 81938540 C19385C3    96939699 81849665 00031C02 459CD289   *. T... P... A..C..............K.*
0001C0   93938981 957DA240 C99989A2 8840D985    8440D381 878599C3 96939699 81849681   *....... I.... R.. L....C........*

PRINT Routine

This routine will print the contents of the table.

Input Parameters for the PRINT routine

Suggested Logic for the PRINT routine

 1. Initialization:  Load the input parameters

 2. Write the page and column headers
 3. While there are records in the table
 4.   Put the number of cases and case price on the print line
 5.   Get the beer name and brewery location lengths from the table
 6.   Separate the lengths
 7.   Put the beer name on the print line
 8.   Put the brewery location on the print line
 9.   Write the print line
10.   Increment the table pointer to the start of the next entry
11. Endwhile

Implementation Hints:

Output

The output for this program will be a report that lists the beers. The report should start at the top of a new page. The column headers should be double spaced from the report header. The information lines should be single spaced.

                        Domestic and Imported Beer Information

Brewery Location         Beer Name                            Cases       Price per Case
----------------------------------------------------------------------------------------
California               Anchor Steam                           25           $15.99
California               Pete's Wicked Ale                      24           $21.41
California               Sierra Nevada Pale Ale                 18           $26.99
Colorado                 New Belgium Fat Tire Amber Ale         12           $23.64
Colorado                 Boulder Planet Porter                   1           $22.20
Colorado                 Coors Original                         32           $17.99
Colorado                 Coors Light                            29           $17.99
Colorado                 Boulder Pass Time Pale Ale             17           $17.94
Colorado                 Killian's Irish Red Lager              31           $24.59
Colorado                 Hazed and Infused Dry Hopped Ale       21           $21.80
Massachusetts            Samuel Adams Boston Lager              33           $21.41
Missouri                 Michelob Light                         51           $10.99
Missouri                 Budweiser                              48           $17.99
Missouri                 Bud Light                              50           $17.99
New York                 J.W. Dundee Honey Brown Lager          13           $19.03
Pennsylvania             Rolling Rock                            5           $20.95
Washington               Redhook E.S.B                          24           $26.99
Wisconsin                Leinenkugel Red Lager                   8           $13.99
Wisconsin                Miller Genuine Draft                   26           $12.99
Wisconsin                Miller Lite                            10           $17.99
Belgium                  Lindeman's Kreik Lambic                31           $88.68
Belgium                  Stella Artois Pilsner                  17           $38.94
Canada                   Labatt Blue Lager                       2            $9.99
China                    TsingTao Lager                          1           $13.58
Czech Republic           Pilsner Urquell                        23           $14.99
England                  Samuel Smith's Oatmeal Stout            6           $53.94
England                  Bass Pale Ale                          14           $24.85
Germany                  Celebrator Doppelbock                  10           $31.68
Germany                  Paulaner Hefe-Weizen                   24           $14.99
Germany                  Ayinger Altbairisch Dunkel             36           $28.68
Ireland                  Harp Lager                             17           $12.99
Italy                    Peroni Lager                           12           $34.36
Jamaica                  Red Stripe Lager                       12           $30.76
Japan                    Kirin Lager                            16           $14.99
Mexico                   Dos Equis Amber Lager                  20           $12.99
The Netherlands          Grolsch Lager                          29           $13.99
New Zealand              Steinlager                             30           $11.99

Processing Note/Requirement:

  1. Use the following JCL statement to access the input file:

  2. //FT05F001 DD DSN=KC02330.CSCI360.FILES(DATA9),DISP=SHR