Exercise: Grouped Record Processing  
                  
                  
Follow the "Processing Record Groups" link under "Programming Examples" on the
   the CS233 page for help in answering questions 1-8. The file "motoclozG.txt"
   is ordered by the group item; and it has an id in 0-4, article name in 5-29,
   category(group) in 30-40 and price in 41-46.
1. Show how to issue an open for reading from the file "motoclozG.txt" and 
   assign the return value to a file pointer named $fp. Take input from fgets()
   referencing the file pointer $fp. Within a while loop assign $lineIn fields
   to $id, $name, $group and $price. Then output those items before invoking
   fgets() for the next set of fields.or echo the contents of $lineIn within the loop.

   
2. Repeat step one with the detail line containing the items (left-to-right):
   $group, $id, $name and $price.

   
3. Enhance the program to "group indicate". That is, print the group name
   for the first record in a group (e.g. Boots) and suppress(blank out) the 
   name for the remaining records in that group. This may be done by having
   a "primer read" and initializing a group control variable and an output 
   variable with the group input value before an inner loop. At the top of the
   inner loop, test whether the group value is the same or has changed(e.g. to
   Heated Gear). A change is a "control break" and signals the need to reset
   the control and output variables after an exit from the inner loop. Within
   the inner loop, process the other input fields, then print a detail line.
   Note that should the group name be set blank, the name will not print until
   the next "control break" causes reinitialization.

   
4. Further enhance the program by printing control group footing lines with 
   price totals labeled and right-aligned. This code may be incorporated within
   the statement block for reinitializing a new group (i.e. handling a "control
   break").

   
5. Other refinements would be to format report heading, column headings, and
   and a "grand" total for all control groups to be printed after the last 
   control footing line.


motoclozG.txt(records ordered by group):
98000Engineer                 Boots      140.00
98424Street Trooper           Boots      150.00
98107Electric Jacket Liner    Heated Gear220.00
98113Electric Gloves          Heated Gear165.00
97212Full Face                Helmet     250.00
98026Shortie                  Helmet     115.00
98160Open Face                Helmet     139.00
98100Jacket                   Leather    225.00
98111Shirt                    Leather    195.00
98480Chaps                    Leather    175.00
97220Overboots                Raingear    89.00
97325Packable Jacket and PantsRaingear   199.00
98170GoreTex Rain Gloves      Raingear    59.00
98354One-piece Rain Slicker   Raingear    95.00
98358Two-piece Rainsuit       Raingear   100.00