$fileName");//printReportHeading(); $lineIn = fgets($fp); // primer input while ( !feof($fp) ) { $groupIn = substr($lineIn, 30, 11); // extract control field(group) $groupControl = $groupIn; // initialize new group $groupOut = $groupIn; while ($groupIn == $groupControl) { // process one group $id = substr($lineIn, 0, 5); // extract other fields $name = substr($lineIn, 5, 25); $price = number_format(substr($lineIn,41,5),2); print("$groupOut$id$name". "$price"); $groupOut = ' '; // suppress group after printing for first in group $lineIn = fgets($fp); // get next record(line) $groupIn = substr($lineIn, 30, 11); // extract control field } // end inner loop $groupControl = $groupIn; // initialize new group $groupOut = $groupIn; } // end outer loop fclose($fp); ?>