Re: sending marc records into a script that uses MARC::Batch

[email protected] (Timothy Prettyman) Fri, 30 May 2014 12:39:18 -0400
Newsgroups perl.perl4lib
Message-ID <CA+rAGyO-RAUZ2KAOrcnqm5n+9QbNwn=oaaXd8EUoJyxdvrRckQ@mail.gmail.com>
--001a11c2ab34d80f9e04faa0afbd
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I think you have to check for warnings as you read each record, so try
moving your error handing code right after the batch->next() call.  But
Robin's suggestion is good advice, and is probably a more robust way to
handle the crud that can show up in a file of marc records.

-Tim


On Fri, May 30, 2014 at 5:20 AM, Stefano Bargioni <[email protected]> wrote:

> If I'm not wrong,
> $batch->strict_off();
> will avoid your loop to print warnings and stop processing records.
> HTH. Stefano
>
> On 29/mag/2014, at 23.13, John E Guillory wrote:
>
>  Thanks Timothy for your help.
>
>
>
> When processing about 5 million records I would expect some crazy records=
.
> The new script (incorporating Timothy=E2=80=99s  suggestions) exited prem=
aturely on
> record 85,877 with: =E2=80=9CWarnings detected: Entirely empty subfield f=
ound in
> tag 260=E2=80=9D. I know 260 is publication stuff but it=E2=80=99s not =
=E2=80=9Crequired=E2=80=9D.  I=E2=80=99m
> deliberately printing warnings but again the script exited prematurely.
>
>
>
> Thanks for assistance.
>
> John
>
>
>
>
>
>
>
>
>
>
>
>
>
> *From:* Timothy Prettyman [mailto:[email protected]]
> *Sent:* Thursday, May 29, 2014 11:23 AM
> *To:* John E Guillory
> *Cc:* [email protected]
> *Subject:* Re: sending marc records into a script that uses MARC::Batch
>
>
>
> For your first question, instead of:
>
>
>
>  $batch =3D MARC::Batch->new(=E2=80=98USMARC=E2=80=99,<STDIN>);
>
>
>
> use:
>
>
>
>  $batch =3D MARC::Batch->new(=E2=80=98USMARC=E2=80=99,STDIN);
>
>
>
> For your second, the error is likely caused when a field you're using
> as_string() on doesn't exist in the record.
>
>
>
> So, you could do something like the following:
>
>
>
> $field                 =3D $record->field('008');
>
> $field or do {                                          # check for
> existence of field
>
>    print "no 008 field for record\n";            # no field
>
>    next;                                                  # skip the fiel=
d
> (or whatever)
>
> };
>
> $field_008             =3D $field->as_string();
>
>
>
> Hope this helps
>
>
>
> -Tim
>
>
>
> Timothy Prettyman
>
> LIT/Library Systems
>
> University of Michigan
>
>
>
> On Thu, May 29, 2014 at 12:08 PM, John E Guillory <[email protected]> wrote:
>
> Hello,
>
> Two questions please:
>
>
>
> 1.      I=E2=80=99ve written a script that opens a marc file for reading =
using
> this syntax:
>
>
>
> $file =3D $ARGV[0];
>
> $batch =3D MARC::Batch->new('USMARC',$file);
>
>
>
> It then loops thru the records using this syntax:
>
> while ( $record =3D $batch->next()) {
>
>          =E2=80=A6..check position 6, 7 of leader and position 23 of 008 =
and make
> some changes
>
> }
>
>
>
> This works great. However, instead of accessing the file this way, I want
> to pipe the output of a previously run marc dump command directly into th=
is
> script via the pipe.
>
> I understand that this can be done using this syntax:    while ($line
> =3D<STDIN>){ =E2=80=A6}, but I don=E2=80=99t understand how to use that S=
TDIN with
> =E2=80=9CMARC::Batch->new(=E2=80=98USMARC=E2=80=99,$file);=E2=80=9D    Th=
is does not work:    $batch =3D
> MARC::Batch->new(=E2=80=98USMARC=E2=80=99,<STDIN>);
>
>
>
> 2.      My current script successfully reads and processes a marc file of
> over 5 gigs!....but exits entirely on record 160,585 with the error from
> MARC::Batch, =E2=80=9CCan't call method "as_string" on an undefined value=
 at ./
> marc_batch.pl=E2=80=9D.  Documentation on using MARC::Batch says that to =
tell it
> to continue processing even when errors are encountered one should use
> strict_off(), then print/report warnings at the bottom of the script. I
> don=E2=80=99t think my particular error is being handled by the strict_of=
f()
> setting. Doesn=E2=80=99t anybody know what causes/how to fix =E2=80=9CCan=
=E2=80=99t call method
> as_string?=E2=80=9D error? Full script below=E2=80=94it=E2=80=99s pretty =
short, thanks to
> MARC::Batch.
>
>
>
> Thanks for ensights!
>
>
>
>
>
> use MARC::Batch;
>
>
>
> $file =3D $ARGV[0];
>
> chomp($file);
>
>
>
> $batch =3D MARC::Batch->new('USMARC',$file);
>
> $batch->strict_off();    # otherwise script exits when encounters errors
>
>
>
> open(OUT,'>new_marc');
>
>
>
> while ( $record =3D $batch->next()) {
>
>     $leader                =3D $record->leader();
>
>     $leader_pos_6          =3D substr($leader,6,1);
>
>     $leader_pos_7          =3D substr($leader,7,1);
>
>
>
>     $field                 =3D $record->field('008');
>
>     $field_008             =3D $field->as_string();
>
>     $field_008_position_23 =3D substr($field_008,23,1);
>
>
>
> if ( ($leader_pos_6 eq "a") && ($leader_pos_7 eq "m") &&
> ($field_008_position_23 eq "o") || ($field_008_position_23 eq "s") ) {
>
>
>
>        $control_num        =3D $record->field('001');
>
>        $control_num        =3D $control_num->as_string();
>
>
>
>        print "008 position 23: $field_008_position_23 \n";
>
>        print "OLD leader: $leader \n";
>
>        $old_leader =3D $leader;
>
>        substr($leader,6,1) =3D 'm';
>
>        print "NEW leader: $leader \n";
>
>
>
>        print OUT $record->as_usmarc();
>
>       print "$control_num|$old_leader|$leader|$field_008\n";
>
>
>
> } else {  # not a match so just print this one unchanged=E2=80=A6
>
>        print OUT $record->as_usmarc();
>
> }
>
>
>
> }
>
>
>
> # handles errors:
>
> if (@warnings =3D $batch->warnings()) {
>
>      print "\n Warnings detected: \n", @warnings;
>
> }
>
>
>
> close(OUT);
>
> close(LOG);
>
>
>
>
>
>
>
> John Guillory
>
> Louisiana Library Network
>
> 225.578.3758
>
>
>
>
>
>
> __________________________________________________
> Il tuo *5x1000* al Patronato di San Girolamo della Carit=C3=A0 =C3=A8 un =
gesto
> semplice ma di grande valore.
> Una tua firma aiuter=C3=A0 i sacerdoti ad essere pi=C3=B9 vicini alle esi=
genze di
> tutti noi.
> Aiutaci a formare sacerdoti e seminaristi provenienti dai 5 continenti
> indicando nella dichiarazione dei redditi il codice fiscale *97023980580*=
.
>
>

--001a11c2ab34d80f9e04faa0afbd
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I think you have to check for warnings as you read each re=
cord, so try moving your error handing code right after the batch-&gt;next(=
) call. =C2=A0But Robin&#39;s suggestion is good advice, and is probably a =
more robust way to handle the crud that can show up in a file of marc recor=
ds.<div>
<br></div><div>-Tim</div></div><div class=3D"gmail_extra"><br><br><div clas=
s=3D"gmail_quote">On Fri, May 30, 2014 at 5:20 AM, Stefano Bargioni <span d=
ir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_blank">bargio=
[email protected]</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div style=3D"word-wrap:break-word"><div>If =
I&#39;m not wrong,=C2=A0</div><div>$batch-&gt;strict_off();</div><div>will =
avoid your loop to print warnings and stop processing records.</div>
<div>HTH. Stefano</div><div><div class=3D"h5"><div><br></div><div><div>On 2=
9/mag/2014, at 23.13, John E Guillory wrote:</div><br><blockquote type=3D"c=
ite">





<div lang=3D"EN-US" link=3D"blue" vlink=3D"purple">
<div><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&qu=
ot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Thanks Timothy for y=
our help.
<u></u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11=
.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">=
<u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-s=
ize:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f=
497d">When processing about 5 million records I would expect some crazy rec=
ords. The new script (incorporating Timothy=E2=80=99s =C2=A0suggestions) ex=
ited prematurely on record
 85,877 with: =E2=80=9CWarnings detected: Entirely empty subfield found in =
tag 260=E2=80=9D. I know 260 is publication stuff but it=E2=80=99s not =E2=
=80=9Crequired=E2=80=9D. =C2=A0I=E2=80=99m deliberately printing warnings b=
ut again the script exited prematurely.
<u></u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11=
.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">=
<u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-s=
ize:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f=
497d">Thanks for assistance.
<u></u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11=
.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">=
John<u></u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-siz=
e:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f49=
7d"><u></u>=C2=A0<u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u>=C2=A0<u></u></spa=
n></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&q=
uot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u>=C2=A0<u></u=
></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u>=C2=A0<u></u></spa=
n></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&q=
uot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u>=C2=A0<u></u=
></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u>=C2=A0<u></u></spa=
n></p><p class=3D"MsoNormal"><b><span style=3D"font-size:10.0pt;font-family=
:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style=3D"=
font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> Ti=
mothy Prettyman [mailto:<a href=3D"mailto:[email protected]" target=3D"_bla=
nk">[email protected]</a>]
<br>
<b>Sent:</b> Thursday, May 29, 2014 11:23 AM<br>
<b>To:</b> John E Guillory<br>
<b>Cc:</b> <a href=3D"mailto:[email protected]" target=3D"_blank">perl4lib@=
perl.org</a><br>
<b>Subject:</b> Re: sending marc records into a script that uses MARC::Batc=
h<u></u><u></u></span></p><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<div><p class=3D"MsoNormal">For your first question, instead of:<u></u><u><=
/u></p>
<div><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div><p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&qu=
ot;Arial&quot;,&quot;sans-serif&quot;">=C2=A0$batch =3D MARC::Batch-&gt;new=
(=E2=80=98USMARC=E2=80=99,&lt;STDIN&gt;);</span><u></u><u></u></p>
</div>
<div><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div><p class=3D"MsoNormal"><span style=3D"font-family:&quot;Arial&quot;,&q=
uot;sans-serif&quot;">use:</span><u></u><u></u></p>
</div>
<div><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div><p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&qu=
ot;Arial&quot;,&quot;sans-serif&quot;">=C2=A0$batch =3D MARC::Batch-&gt;new=
(=E2=80=98USMARC=E2=80=99,STDIN);</span><u></u><u></u></p>
</div>
<div><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div><p class=3D"MsoNormal"><span style=3D"font-family:&quot;Arial&quot;,&q=
uot;sans-serif&quot;">For your second, the error is likely caused when a fi=
eld you&#39;re using as_string() on doesn&#39;t exist in the record. =C2=A0=
</span><u></u><u></u></p>

<div><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div><p class=3D"MsoNormal">So, you could do something like the following:<=
u></u><u></u></p>
</div>
<div><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div><p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&qu=
ot;Arial&quot;,&quot;sans-serif&quot;">$field=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D $rec=
ord-&gt;field(&#39;008&#39;);</span><u></u><u></u></p>
</div>
<div><p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&qu=
ot;Arial&quot;,&quot;sans-serif&quot;">$field or do { =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# check for existence o=
f field</span><u></u><u></u></p>

</div>
<div><p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&qu=
ot;Arial&quot;,&quot;sans-serif&quot;">=C2=A0 =C2=A0print &quot;no 008 fiel=
d for record\n&quot;; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# no field</=
span><u></u><u></u></p>
</div>
<div><p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&qu=
ot;Arial&quot;,&quot;sans-serif&quot;">=C2=A0 =C2=A0next; =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0# skip the field (or whatever)</span><u></u><u></u></p>

</div>
<div><p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&qu=
ot;Arial&quot;,&quot;sans-serif&quot;">};</span><u></u><u></u></p>
</div>
<div><p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&qu=
ot;Arial&quot;,&quot;sans-serif&quot;">$field_008=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D $field-&gt;as_string()=
;<u></u><u></u></span></p>
</div>
<div><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
</div>
<div><p class=3D"MsoNormal">Hope this helps<u></u><u></u></p>
</div>
<div><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div><p class=3D"MsoNormal">-Tim<u></u><u></u></p>
</div>
<div><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div><p class=3D"MsoNormal">Timothy Prettyman<u></u><u></u></p>
</div>
<div><p class=3D"MsoNormal">LIT/Library Systems<u></u><u></u></p>
</div>
<div><p class=3D"MsoNormal">University of Michigan<u></u><u></u></p>
</div>
</div>
<div><p class=3D"MsoNormal" style=3D"margin-bottom:12.0pt"><u></u>=C2=A0<u>=
</u></p>
<div><p class=3D"MsoNormal">On Thu, May 29, 2014 at 12:08 PM, John E Guillo=
ry &lt;<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>=
&gt; wrote:<u></u><u></u></p>
<div>
<div><p class=3D"MsoNormal">Hello,<u></u><u></u></p><p class=3D"MsoNormal">=
Two questions please:<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0<u></u>=
<u></u></p><p>1.<span style=3D"font-size:7.0pt">=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 </span>I=E2=80=99ve written a script that opens a marc file for reading=
 using this syntax:<u></u><u></u></p>
<p class=3D"MsoNormal">=C2=A0<u></u><u></u></p><p class=3D"MsoNormal">$file=
 =3D $ARGV[0];<u></u><u></u></p><p class=3D"MsoNormal">$batch =3D MARC::Bat=
ch-&gt;new(&#39;USMARC&#39;,$file);<u></u><u></u></p><p class=3D"MsoNormal"=
>=C2=A0<u></u><u></u></p>
<p class=3D"MsoNormal">It then loops thru the records using this syntax:<u>=
</u><u></u></p><p class=3D"MsoNormal">while ( $record =3D $batch-&gt;next()=
) {<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0 =E2=80=A6..check position 6, 7 of leader and position 23=
 of 008 and make some changes<u></u><u></u></p>
<p class=3D"MsoNormal">}<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0<u><=
/u><u></u></p><p class=3D"MsoNormal">This works great. However, instead of =
accessing the file this way, I want to pipe the output of a previously run =
marc dump command directly into this script via the pipe. =C2=A0<u></u><u><=
/u></p>
<p class=3D"MsoNormal">I understand that this can be done using this syntax=
:=C2=A0=C2=A0=C2=A0 while ($line =3D&lt;STDIN&gt;){ =E2=80=A6}, but I don=
=E2=80=99t understand how to use that STDIN with =E2=80=9CMARC::Batch-&gt;n=
ew(=E2=80=98USMARC=E2=80=99,$file);=E2=80=9D=C2=A0=C2=A0=C2=A0 This
 does not work:=C2=A0=C2=A0=C2=A0 $batch =3D MARC::Batch-&gt;new(=E2=80=98U=
SMARC=E2=80=99,&lt;STDIN&gt;);<u></u><u></u></p><p class=3D"MsoNormal">=C2=
=A0<u></u><u></u></p><p>2.<span style=3D"font-size:7.0pt">=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0 </span>My current script successfully reads and processes a=
 marc file of over 5 gigs!....but exits entirely on record 160,585 with the=
 error from MARC::Batch, =E2=80=9CCan&#39;t call method &quot;as_string&quo=
t; on an undefined value at ./<a href=3D"http://marc_batch.pl/" target=3D"_=
blank">marc_batch.pl</a>=E2=80=9D.=C2=A0
 Documentation on using MARC::Batch says that to tell it to continue proces=
sing even when errors are encountered one should use strict_off(), then pri=
nt/report warnings at the bottom of the script. I don=E2=80=99t think my pa=
rticular error is being handled by the strict_off()
 setting. Doesn=E2=80=99t anybody know what causes/how to fix =E2=80=9CCan=
=E2=80=99t call method as_string?=E2=80=9D error? Full script below=E2=80=
=94it=E2=80=99s pretty short, thanks to MARC::Batch.
<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0<u></u><u></u></p><p class=
=3D"MsoNormal">Thanks for ensights!=C2=A0
<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0<u></u><u></u></p><p class=
=3D"MsoNormal">=C2=A0<u></u><u></u></p><p class=3D"MsoNormal">use MARC::Bat=
ch;<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0<u></u><u></u></p><p clas=
s=3D"MsoNormal">$file =3D $ARGV[0];<u></u><u></u></p>
<p class=3D"MsoNormal">chomp($file);<u></u><u></u></p><p class=3D"MsoNormal=
">=C2=A0<u></u><u></u></p><p class=3D"MsoNormal">$batch =3D MARC::Batch-&gt=
;new(&#39;USMARC&#39;,$file);<u></u><u></u></p><p class=3D"MsoNormal">$batc=
h-&gt;strict_off();=C2=A0=C2=A0=C2=A0 # otherwise script exits when encount=
ers errors<u></u><u></u></p>
<p class=3D"MsoNormal">=C2=A0<u></u><u></u></p><p class=3D"MsoNormal">open(=
OUT,&#39;&gt;new_marc&#39;);<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0=
<u></u><u></u></p><p class=3D"MsoNormal">while ( $record =3D $batch-&gt;nex=
t()) {<u></u><u></u></p>
<p class=3D"MsoNormal">=C2=A0=C2=A0=C2=A0 $leader=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D $rec=
ord-&gt;leader();<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0=C2=A0=C2=
=A0 $leader_pos_6=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D=
 substr($leader,6,1);<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0=C2=A0=
=C2=A0 $leader_pos_7=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =
=3D substr($leader,7,1);<u></u><u></u></p>
<p class=3D"MsoNormal">=C2=A0<u></u><u></u></p><p class=3D"MsoNormal">=C2=
=A0=C2=A0=C2=A0 $field=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D $record-&gt;field(&#39;00=
8&#39;);<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0=C2=A0=C2=A0 $field_=
008=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
 =3D $field-&gt;as_string();<u></u><u></u></p>
<p class=3D"MsoNormal">=C2=A0=C2=A0=C2=A0 $field_008_position_23 =3D substr=
($field_008,23,1);<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0<u></u><u>=
</u></p><p class=3D"MsoNormal">if ( ($leader_pos_6 eq &quot;a&quot;) &amp;&=
amp; ($leader_pos_7 eq &quot;m&quot;) &amp;&amp; ($field_008_position_23 eq=
 &quot;o&quot;) || ($field_008_position_23 eq &quot;s&quot;) ) {<u></u><u><=
/u></p>
<p class=3D"MsoNormal">=C2=A0<u></u><u></u></p><p class=3D"MsoNormal">=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 $control_num=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0 =3D $record-&gt;field(&#39;001&#39;);<u></u><u></u></p><p c=
lass=3D"MsoNormal">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 $control_num=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D $control_num-&gt;as_string();<u></=
u><u></u></p>
<p class=3D"MsoNormal">=C2=A0<u></u><u></u></p><p class=3D"MsoNormal">=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 print &quot;008 position 23: $field_008_p=
osition_23 \n&quot;;<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 print &quot;OLD leader: $leader \n&quot;;<u></u><u=
></u></p>
<p class=3D"MsoNormal">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 $old_leader =3D=
 $leader;<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 substr($leader,6,1) =3D &#39;m&#39;;<u></u><u></u></p><p class=
=3D"MsoNormal">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 print &quot;NEW leader:=
 $leader \n&quot;;<u></u><u></u></p>
<p class=3D"MsoNormal">=C2=A0<u></u><u></u></p><p class=3D"MsoNormal">=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 print OUT $record-&gt;as_usmarc();<u></u>=
<u></u></p><p class=3D"MsoNormal">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0print=
 &quot;$control_num|$old_leader|$leader|$field_008\n&quot;;<u></u><u></u></=
p>
<p class=3D"MsoNormal">=C2=A0=C2=A0
<u></u><u></u></p><p class=3D"MsoNormal">} else {=C2=A0 # not a match so ju=
st print this one unchanged=E2=80=A6<u></u><u></u></p><p class=3D"MsoNormal=
">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 print OUT $record-&gt;as_usmarc();<u=
></u><u></u></p><p class=3D"MsoNormal">}<u></u><u></u></p>
<p class=3D"MsoNormal">=C2=A0<u></u><u></u></p><p class=3D"MsoNormal">}<u><=
/u><u></u></p><p class=3D"MsoNormal">=C2=A0<u></u><u></u></p><p class=3D"Ms=
oNormal"># handles errors:<u></u><u></u></p><p class=3D"MsoNormal">if (@war=
nings =3D $batch-&gt;warnings()) {<u></u><u></u></p>
<p class=3D"MsoNormal">=C2=A0=C2=A0=C2=A0=C2=A0 print &quot;\n Warnings det=
ected: \n&quot;, @warnings;<u></u><u></u></p><p class=3D"MsoNormal">}<u></u=
><u></u></p><p class=3D"MsoNormal">=C2=A0<u></u><u></u></p><p class=3D"MsoN=
ormal">close(OUT);<u></u><u></u></p>
<p class=3D"MsoNormal">close(LOG);<u></u><u></u></p><p class=3D"MsoNormal">=
=C2=A0<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0<u></u><u></u></p><p c=
lass=3D"MsoNormal">=C2=A0<u></u><u></u></p><p class=3D"MsoNormal">John Guil=
lory<u></u><u></u></p>
<p class=3D"MsoNormal">Louisiana Library Network<u></u><u></u></p><p class=
=3D"MsoNormal"><a href=3D"tel:225.578.3758" target=3D"_blank">225.578.3758<=
/a><u></u><u></u></p><p class=3D"MsoNormal">=C2=A0<u></u><u></u></p>
</div>
</div>
</div><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
</div>
</div>

</blockquote></div><br></div></div></div>
<div>__________________________________________________</div>
<div><font color=3D"#007700">Il tuo <b>5x1000</b> al
 Patronato di San Girolamo della Carit=C3=A0 =C3=A8 un gesto semplice ma di=
 grande valore.</font></div>
<div><font color=3D"#007700">Una tua firma aiuter=C3=A0 i sacerdoti ad esse=
re pi=C3=B9 vicini alle esigenze di tutti noi.</font></div>
<div><font color=3D"#007700">Aiutaci a formare sacerdoti e seminaristi prov=
enienti dai 5 continenti indicando nella dichiarazione dei redditi il codic=
e fiscale <b>97023980580</b>.</font></div>
<div><br></div></blockquote></div><br></div>

--001a11c2ab34d80f9e04faa0afbd--