seems to be working now
[migration-tools.git] / miker-filter_incoming.pl
index 030c02a..99c6171 100644 (file)
@@ -3,13 +3,15 @@ use warnings;
 use strict;
 
 use Getopt::Long;
-#use Time::HiRes qw/time/;
-#use MARC::Record;
-#use MARC::File::XML ( BinaryEncoding => 'utf-8' );
+use Time::HiRes qw/time/;
+use MARC::Record;
+use MARC::File::XML ( BinaryEncoding => 'utf-8' );
+
+# THIS FILE EXTRACTS NONMATCHING RECORDS
 
 # configuration hashref
 my $conf  = ();
-initialize($conf);
+#initialize($conf);
 
 my $idfile = shift;
 my $marcfile = shift;
@@ -26,7 +28,7 @@ while (<F>) {
 
 close F;
 
-my $M;
+my $M; my $I; my $S;
 open $M, '<:utf8', $marcfile;
 open $I, '>:utf8', $import;
 open $S, '>:utf8', $shelve;
@@ -38,11 +40,11 @@ my $scount = 0;
 while (<$M>) {
     /tag="903" ind1=" " ind2=" ">.*?<subfield code="a">(\d+)</;
     if ( $id{$1} ) {
-        print $I $_;
-        $icount++;
-    } else {
         print $S $_;
         $scount++;
+    } else {
+        print $I $_;
+        $icount++;
     }
     $count++;