use YAML;
use JSON;
-my $marcxml = shift;
+my $marcxml = shift || help();
open HOLDINGS, '>', "holdings";
open X, '>', "holdings.x";
open Z, '>', "holdings.z";
open ALL852, '>', "holdings.all852";
+$| = 1;
my $holdings = {};
my $copyid = 0;
+my $count = 0;
my %all852 = ( x => {}, z => {} ); # hash of all subfields in all 852s
my $t = XML::Twig->new( twig_handlers => { record => \&record } );
for my $copy (@{$holdings->{copies}})
{ print_reports($copy) }
$r->purge;
+ $count++; print "\r$count";
}
sub process_datafields {
print HOLDINGS join("\t", $holdings->{id}, $copy->{copyid},
$copy->{b}, $copy->{p}, $copy->{h}, $copy->{9}), "\n";
}
+
+
+sub help {
+ print <<HELP;
+Usage is: extract_holdings MARCXML_FILE
+HELP
+ exit;
+}