}
            }
        }
    }
    if (!empty($hitList)) {
        $resp[$i] = $hitList;
    }
    fclose($fp);
    //echo "from $theHost<br />";print_r($resp[$i]);echo "<br />---------<br />";
}
//echo "complete SRU raw reply:<br />";print_r($resp);echo "<br />---------<br />";
//$displayXML=true;
//showXML($resp,$displayXML); //for debugging purposes
### parse downloaded XML and create
$xml_parser = xml_parser_create();
$ttlHits = 0;
for ($i = 0; $i < $postVars[numHosts]; $i++) {
    if (!empty($resp[$i])) {
        xml_parse_into_struct($xml_parser, $resp[$i], $hostRecords[$i]);
        //echo "host #$i strucured:<br />";print_r($hostRecords[$i]);echo "<br />---------<br />";
        list($num_records, $marc[$i]) = get_marc_fields($hostRecords[$i]);
        $msg = $marc[$i][0]['diagMsg'];
        if ($num_Records == 0 && !empty($msg)) {
            echo "Host Diagnostic Response: {$msg}";
            exit;
        }
        //echo "host #$i marc:<br />";print_r($marc[$i]);echo "<br />---------<br />";
        $ttlHits += $num_records;
    }
}
xml_parser_free($xml_parser);
                break;
            case 'ZS:RECORDPOSITION':
                $recordposition++;
                $subcount = 0;
                break;
        }
    }
    /**    
    * The ZS:RECORDPOSITION tag does not occur when only one record is returned.    
    * Update recordposition to indicate 1 record.    
    */
    if ($recordposition == 0 && $total_hits > 0) {
        $recordposition = 1;
    }
    return array($recordposition, $marc);
}
list($num_records, $marc) = get_marc_fields($loc_records);
if ($num_records == 1) {
    $postVars['values'] = $marc[0];
    $action = 'Edit';
} else {
    if ($num_records < 1) {
        echo "No se Encontraron Resultados Para  " . $locVal . "\n <br>";
        echo "Talvez no ingreso un término a buscar \n";
        echo "<form name='form' action='" . $_SERVER['PHP_SELF'] . "' method='POST'>\n";
        echo "  <input type='submit' name='action' value='Volver' class='button' />\n";
        echo "</form>\n";
    } else {
        $action = 'Multiple';
    }
}