From 9e42dbf33efb3dc9b2536308e2dcea0f56c258fb Mon Sep 17 00:00:00 2001 From: Shawn Boyette Date: Tue, 3 Feb 2009 16:28:48 +0000 Subject: [PATCH] fixed old2new map issues --- marc_cleanup | 31 +++++++++++++++++-------------- 1 files changed, 17 insertions(+), 14 deletions(-) diff --git a/marc_cleanup b/marc_cleanup index 853de84..9afae88 100755 --- a/marc_cleanup +++ b/marc_cleanup @@ -62,7 +62,8 @@ while ( buildrecord() ) { $sidx = ($sidx == $#spinner) ? 0 : $sidx + 1; } - do_automated_cleanups(); + my $rc = do_automated_cleanups(); + next if $rc; $ptr = 0; until ($ptr == $#record) { @@ -115,7 +116,8 @@ sub do_automated_cleanups { $ptr = 0; until ($ptr == $#record) { # get datafield/tag data if we have it - stow_record_data(); + my $rc = stow_record_data(); + return $rc if $rc; # catch empty datafield elements if ($record[$ptr] =~ m/c/code="c">/; $record[$ptr] =~ s/code=" ">\$/code="c">\$/; } + return 0; } sub stow_record_data { # get tag data if we're looking at it - if ($record[$ptr] =~ m/{'original-subfield'} and - $recmeta{tag} == $conf->{'original-tag'}) { + if ($conf->{'original-subfield'} and $recmeta{tag} == $conf->{'original-tag'}) { my $line = $record[$ptr]; my $lptr = $ptr; my $osub = $conf->{'original-subfield'}; $recmeta{oid} = 'NONE'; until ($line =~ m||) { + if ($line =~ /(.+?)(.+?)new map file if needed if ($conf->{'renumber-from'} and $conf->{'original-subfield'}) { - unless (defined $recmeta{oid}) { - my $msg = join(' ', "No old id num found"); - dump_record($msg); - } else { - print $OLD2NEW $recmeta{oid}, "\t", $recmeta{nid}, "\n" - } + print $OLD2NEW $recmeta{oid}, "\t", $recmeta{nid}, "\n" } # actually write the record -- 1.7.2.5