$sth->execute;
my $count = 0;
+ my @skipped;
while (my $bib = $sth->fetchrow_hashref) {
$count++;
next if $count_only;
my $marc = $rec->[0]->[0];
my $marcdoc = MARC::Record->new_from_xml($marc, 'UTF-8', 'USMARC');
- print MARCFILE $marcdoc->as_usmarc;
+ if (my @warnings = $marcdoc->warnings) {
+ print "Skipping record $bib_id on warnings: @warnings\n";
+ push(@skipped, $bib_id);
+ } else {
+ print MARCFILE $marcdoc->as_usmarc;
+ }
- print "$count records written...\n" if ($count % 1000) == 0;
+ print "$count records processed...\n" if ($count % 1000) == 0;
next unless $export_date;
close(MARCFILE) if $out_file;
- print "$count total bib records\n";
+ my $skip_count = scalar(@skipped);
+ print "total bib count = $count\n";
+ print "skipped bib count = $skip_count\n";
+ print "export bib count = ".($count - $skip_count)."\n";
+ print "skipped bibs: @skipped\n";
$sth->finish;
$edate_sth->finish;