[Koha] MARC Communications Format Records
Zeno Tajoli
tajoli at palazzoforti.com
Tue Aug 20 20:45:41 NZST 2002
At 15.50 19/08/02 -0700, you wrote:
> It looks like we will have
>to convert this alphanumeric value into an integer in order to use it as
>the biblionumber in Koha. Can anyone suggest how we might load these
>records and convert the database control number?
Well, to modify MARC21 record a good tool is the Perl module 'MARC'.
Pay attention that it works with MARC21 record only in perfetct standard
ISO2709 (so no line-breaks for example).
A script to change field 001 into an integer value it can be so:
#!/usr/bin/perl
use MARC::Batch;
my $batch = MARC::Batch->new('USMARC','oder.dat');
open(OUT,'>newer.dat');
$i = 1;
while ( my $record = $batch->next() ) {
## look for the 001 field
my $field_001 = $record->field('001');
## delete it
$record->delete_field($field_001) if $field_001;
##write new 001
$record->append_fields(
MARC::Field->new('001',$i)
);
## print out modified record
print OUT $record->as_usmarc();
##Increment $i of 1
$i++;
}
Bye
Zeno Tajoli - Verona, Italy
Librarian and Software Developer
More information about the Koha
mailing list