5 use MARC::File::XML ( BinaryEncoding => 'utf-8' );
7 use Unicode::Normalize;
11 binmode(STDOUT, ':utf8');
12 binmode(STDIN, ':utf8');
30 foreach my $argnum ( 0 .. $#ARGV ) {
32 print STDERR "Processing " . $ARGV[$argnum] . "\n";
35 open $M, '<:utf8', $ARGV[$argnum];
36 my $batch = MARC::Batch->new('XML',$M);
39 $batch->warnings_off();
42 while ( try { $record = $batch->next() } otherwise { $record = -1 } ) {
43 next if ($record == -1);
47 print STDERR "WARNINGS: Record $count : " . join(":",@warnings) . " : continuing...\n" if ( @warnings );
48 my $my_903a = $record->field('903')->subfield('a'); # target bib id's here
49 my @tags = $record->field('852');
50 foreach my $tag ( @tags ) {
51 my $lib = $tag->subfield(''); # library
52 my $barcode = $tag->subfield('p'); # barcod
53 my $loc = $tag->subfield(''); # current location
54 my $home_loc = $tag->subfield('c'); # home location
55 my $cn = $tag->subfield('h'); # call number
56 my $type = $tag->subfield(''); # item type
57 my $create_date = $tag->subfield(''); # acq date
58 my $price = $tag->subfield('9'); # price
59 $price =~ s/[^0-9\.]//g;
60 my $circ_flag = $tag->subfield(''); # circulate flag
61 my $total_circ = $tag->subfield(''); # total charges
62 my $cat1 = $tag->subfield(''); # cat1
63 my $cat2 = $tag->subfield(''); # cat2
65 $my_903a, $lib, $barcode, $loc, $home_loc,
66 $cn, $type, $create_date, $price, $circ_flag,
67 $total_circ, $cat1, $cat2) . "\n";
71 print STDERR "Processed $count records\n";