On Nov 14, 2005, at 10:15 AM, Ed Sanchez wrote:
Would you point me in the right direction for help?

I'd recommend you upgrade to using MARC::Record and co. One advantage to doing so is that you can use the no_strict() method on a MARC::Batch object for ignoring errors like this. Of course you do this at your own risk. I took a quick stab at converting your little script to MARC::Record. It's untested, and hopefully will provide a brief intro to using MARC::Record. The cookbook can provide more examples:

http://search.cpan.org/~petdance/MARC-Record-1.38/lib/MARC/Doc/ Tutorial.pod

//Ed

--

#!/user/bin/perl
use MARC::Batch;
use MARC::Field;
use strict;

$batch = MARC::Batch->new('USMARC', 'mymarc.dat');
$batch->strict_off();

open(OUTFILE, ">export.dat");

while ( my $record = $batch->next() )
{
    # delete all existing 856 fields
    $record->delete($_) for $record->field('856');

    # add new 856 field
    $record->insert_grouped_field(
        MARC::Field->new(
            '856', '', '',
3=>"Some reserve materials are online. Follow this link to see if your course materials are available online.",
            u=>"http://www.lib.unc.edu/reserves/"; ) );

    # add to output file
    print OUTFILE $marc->as_usmarc();
}

Reply via email to