Through various programs, when I've been processing MARC records and found 1 
that didn't pass muster (couldn't pass structural or character set 
requirements) I generally slogged through, found it, and fixed it. But now I 
have passed on some of my code to someone who doesn't have the time or the 
expertise to do that, so I'm asking for help on behalf of both of us. 

First, let's say I have a hash of record id numbers (voyager bib ids for those 
who speak voyager) And here's a code snippet:

foreach my $bib (sort keys %list_of_docs_bibs) {
        # put the bits of the marc record back into a string marc string
        my $bib_marc = &get_bib_string($dbh, $dbase, $bib);
        # create a marc record object from marc record string
        my $bib_rec = MARC::Record->new_from_usmarc($bib_marc);
        
        #do useful stuff to $bib_rec
}

Occasionally, this code will hit a bib record that has an invalid tag and will 
blow up with something like:
" Tag "`1`" is not a valid tag at ...USMARC.pm line 222"
What is an appropriate way to print out that record to an error file and go on 
to the next record, rather than having the program blow up and stop?
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Second, related question. Although all of the records in the voyager database 
are SUPPOSED to be in Unicode, one occasionally encounters a record that has 
non-Unicode characters. So, pretty much same question -- What is an appropriate 
way to print out that record someplace and go on to the next record, rather 
than having the program blow up and stop? 

Suggestions gratefully appreciated

Anne L. Highsmith
Director of Consortia Systems
Texas A&M University
5000 TAMU
College Station, TX   77843-5000
Phone: 979 862 4234
Fax: 979 845 6238
Email: hism...@tamu.edu

Reply via email to