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

[email protected] (Stefano Bargioni) Fri, 30 May 2014 11:20:35 +0200
Newsgroups perl.perl4lib
Message-ID <[email protected]>
--Apple-Mail-9-80157387
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=windows-1252

If I'm not wrong,=20
$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.
> =20
> When processing about 5 million records I would expect some crazy =
records. The new script (incorporating Timothy=92s  suggestions) exited =
prematurely on record 85,877 with: =93Warnings detected: Entirely empty =
subfield found in tag 260=94. I know 260 is publication stuff but it=92s =
not =93required=94.  I=92m deliberately printing warnings but again the =
script exited prematurely.
> =20
> Thanks for assistance.
> John
> =20
> =20
> =20
> =20
> =20
> =20
> From: Timothy Prettyman [mailto:[email protected]]=20
> 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
> =20
> For your first question, instead of:
> =20
>  $batch =3D MARC::Batch->new(=91USMARC=92,<STDIN>);
> =20
> use:
> =20
>  $batch =3D MARC::Batch->new(=91USMARC=92,STDIN);
> =20
> For your second, the error is likely caused when a field you're using =
as_string() on doesn't exist in the record. =20
> =20
> So, you could do something like the following:
> =20
> $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 =
field (or whatever)
> };
> $field_008             =3D $field->as_string();
> =20
> Hope this helps
> =20
> -Tim
> =20
> Timothy Prettyman
> LIT/Library Systems
> University of Michigan
> =20
>=20
> On Thu, May 29, 2014 at 12:08 PM, John E Guillory <[email protected]> =
wrote:
> Hello,
> Two questions please:
> =20
> 1.      I=92ve written a script that opens a marc file for reading =
using this syntax:
>=20
> =20
> $file =3D $ARGV[0];
> $batch =3D MARC::Batch->new('USMARC',$file);
> =20
> It then loops thru the records using this syntax:
> while ( $record =3D $batch->next()) {
>          =85..check position 6, 7 of leader and position 23 of 008 and =
make some changes
> }
> =20
> 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. =20
> I understand that this can be done using this syntax:    while ($line =
=3D<STDIN>){ =85}, but I don=92t understand how to use that STDIN with =
=93MARC::Batch->new(=91USMARC=92,$file);=94    This does not work:    =
$batch =3D MARC::Batch->new(=91USMARC=92,<STDIN>);
> =20
> 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, =93Can't call method "as_string" on an undefined value =
at ./marc_batch.pl=94.  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=92t think my particular error is being handled by the =
strict_off() setting. Doesn=92t anybody know what causes/how to fix =
=93Can=92t call method as_string?=94 error? Full script below=97it=92s =
pretty short, thanks to MARC::Batch.
>=20
> =20
> Thanks for ensights!=20
> =20
> =20
> use MARC::Batch;
> =20
> $file =3D $ARGV[0];
> chomp($file);
> =20
> $batch =3D MARC::Batch->new('USMARC',$file);
> $batch->strict_off();    # otherwise script exits when encounters =
errors
> =20
> open(OUT,'>new_marc');
> =20
> 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);
> =20
>     $field                 =3D $record->field('008');
>     $field_008             =3D $field->as_string();
>     $field_008_position_23 =3D substr($field_008,23,1);
> =20
> if ( ($leader_pos_6 eq "a") && ($leader_pos_7 eq "m") && =
($field_008_position_23 eq "o") || ($field_008_position_23 eq "s") ) {
> =20
>        $control_num        =3D $record->field('001');
>        $control_num        =3D $control_num->as_string();
> =20
>        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";
> =20
>        print OUT $record->as_usmarc();
>       print "$control_num|$old_leader|$leader|$field_008\n";
>  =20
> } else {  # not a match so just print this one unchanged=85
>        print OUT $record->as_usmarc();
> }
> =20
> }
> =20
> # handles errors:
> if (@warnings =3D $batch->warnings()) {
>      print "\n Warnings detected: \n", @warnings;
> }
> =20
> close(OUT);
> close(LOG);
> =20
> =20
> =20
> John Guillory
> Louisiana Library Network
> 225.578.3758
> =20
> =20



__________________________________________________
Il tuo 5x1000 al Patronato di San Girolamo della Carit=E0 =E8 un gesto sem=
plice ma di grande valore.
Una tua firma aiuter=E0 i sacerdoti ad essere pi=F9 vicini alle esigenze d=
i tutti noi.
Aiutaci a formare sacerdoti e seminaristi provenienti dai 5 continenti ind=
icando nella dichiarazione dei redditi il codice fiscale 97023980580.

--Apple-Mail-9-80157387
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=windows-1252

<html><head></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space; =
"><div>If I'm not =
wrong,&nbsp;</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><br></div><div><div>On 29/mag/2014, at 23.13, John E =
Guillory wrote:</div><br class=3D"Apple-interchange-newline"><blockquote =
type=3D"cite">

<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8">
<meta name=3D"Generator" content=3D"Microsoft Word 14 (filtered =
medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
p
	{mso-style-priority:99;
	mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
span.EmailStyle18
	{mso-style-type:personal-reply;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri","sans-serif";}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->

<div lang=3D"EN-US" link=3D"blue" vlink=3D"purple">
<div class=3D"WordSection1"><p class=3D"MsoNormal"><span =
style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif=
&quot;;color:#1F497D">Thanks Timothy for your help.
<o:p></o:p></span></p><p class=3D"MsoNormal"><span =
style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif=
&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p><p =
class=3D"MsoNormal"><span =
style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif=
&quot;;color:#1F497D">When processing about 5 million records I would =
expect some crazy records. The new script (incorporating Timothy=92s =
&nbsp;suggestions) exited prematurely on record
 85,877 with: =93Warnings detected: Entirely empty subfield found in tag =
260=94. I know 260 is publication stuff but it=92s not =93required=94. =
&nbsp;I=92m deliberately printing warnings but again the script exited =
prematurely.
<o:p></o:p></span></p><p class=3D"MsoNormal"><span =
style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif=
&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p><p =
class=3D"MsoNormal"><span =
style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif=
&quot;;color:#1F497D">Thanks for assistance.
<o:p></o:p></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<o:p></o:p></span></p><p =
class=3D"MsoNormal"><span =
style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif=
&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p><p =
class=3D"MsoNormal"><span =
style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif=
&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p><p =
class=3D"MsoNormal"><span =
style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif=
&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p><p =
class=3D"MsoNormal"><span =
style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif=
&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p><p =
class=3D"MsoNormal"><span =
style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif=
&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p><p =
class=3D"MsoNormal"><span =
style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif=
&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></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;"> Timothy Prettyman [mailto:[email protected]]
<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]">[email protected]</a><br>
<b>Subject:</b> Re: sending marc records into a script that uses =
MARC::Batch<o:p></o:p></span></p><p =
class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<div><p class=3D"MsoNormal">For your first question, instead =
of:<o:p></o:p></p>
<div><p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div><p class=3D"MsoNormal"><span =
style=3D"font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&q=
uot;">&nbsp;$batch =3D =
MARC::Batch-&gt;new(=91USMARC=92,&lt;STDIN&gt;);</span><o:p></o:p></p>
</div>
<div><p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div><p class=3D"MsoNormal"><span =
style=3D"font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">use:</span>=
<o:p></o:p></p>
</div>
<div><p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div><p class=3D"MsoNormal"><span =
style=3D"font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&q=
uot;">&nbsp;$batch =3D =
MARC::Batch-&gt;new(=91USMARC=92,STDIN);</span><o:p></o:p></p>
</div>
<div><p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div><p class=3D"MsoNormal"><span =
style=3D"font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">For your =
second, the error is likely caused when a field you're using as_string() =
on doesn't exist in the record. &nbsp;</span><o:p></o:p></p>
<div><p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div><p class=3D"MsoNormal">So, you could do something like the =
following:<o:p></o:p></p>
</div>
<div><p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div><p class=3D"MsoNormal"><span =
style=3D"font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&q=
uot;">$field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D =
$record-&gt;field('008');</span><o:p></o:p></p>
</div>
<div><p class=3D"MsoNormal"><span =
style=3D"font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&q=
uot;">$field or do { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp;# check for existence of =
field</span><o:p></o:p></p>
</div>
<div><p class=3D"MsoNormal"><span =
style=3D"font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&q=
uot;">&nbsp; &nbsp;print "no 008 field for record\n"; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp;# no field</span><o:p></o:p></p>
</div>
<div><p class=3D"MsoNormal"><span =
style=3D"font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&q=
uot;">&nbsp; &nbsp;next; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# skip the =
field (or whatever)</span><o:p></o:p></p>
</div>
<div><p class=3D"MsoNormal"><span =
style=3D"font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&q=
uot;">};</span><o:p></o:p></p>
</div>
<div><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span =
style=3D"font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&q=
uot;">$field_008&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; =3D $field-&gt;as_string();<o:p></o:p></span></p>
</div>
<div><p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
<div><p class=3D"MsoNormal">Hope this helps<o:p></o:p></p>
</div>
<div><p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div><p class=3D"MsoNormal">-Tim<o:p></o:p></p>
</div>
<div><p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div><p class=3D"MsoNormal">Timothy Prettyman<o:p></o:p></p>
</div>
<div><p class=3D"MsoNormal">LIT/Library Systems<o:p></o:p></p>
</div>
<div><p class=3D"MsoNormal">University of Michigan<o:p></o:p></p>
</div>
</div>
<div><p class=3D"MsoNormal" =
style=3D"margin-bottom:12.0pt"><o:p>&nbsp;</o:p></p>
<div><p class=3D"MsoNormal">On Thu, May 29, 2014 at 12:08 PM, John E =
Guillory &lt;<a href=3D"mailto:[email protected]" =
target=3D"_blank">[email protected]</a>&gt; wrote:<o:p></o:p></p>
<div>
<div><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hello,<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Two =
questions please:<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p>1.<span =
style=3D"font-size:7.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>I=92ve =
written a script that opens a marc file for reading using this =
syntax:<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">$file =3D =
$ARGV[0];<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">$batch =3D =
MARC::Batch-&gt;new('USMARC',$file);<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">It then =
loops thru the records using this syntax:<o:p></o:p></p><p =
class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">while ( =
$record =3D $batch-&gt;next()) {<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =85..check position 6, 7 of leader =
and position 23 of 008 and make some changes<o:p></o:p></p><p =
class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">}<o:p></o:p><=
/p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">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. &nbsp;<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I =
understand that this can be done using this syntax:&nbsp;&nbsp;&nbsp; =
while ($line =3D&lt;STDIN&gt;){ =85}, but I don=92t understand how to =
use that STDIN with =
=93MARC::Batch-&gt;new(=91USMARC=92,$file);=94&nbsp;&nbsp;&nbsp; This
 does not work:&nbsp;&nbsp;&nbsp; $batch =3D =
MARC::Batch-&gt;new(=91USMARC=92,&lt;STDIN&gt;);<o:p></o:p></p><p =
class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p>2.<span =
style=3D"font-size:7.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </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, =93Can't call method "as_string" on an undefined value at =
./<a href=3D"http://marc_batch.pl/" =
target=3D"_blank">marc_batch.pl</a>=94.&nbsp;
 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=92t think =
my particular error is being handled by the strict_off()
 setting. Doesn=92t anybody know what causes/how to fix =93Can=92t call =
method as_string?=94 error? Full script below=97it=92s pretty short, =
thanks to MARC::Batch.
<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Thanks for =
ensights!&nbsp;
<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">use =
MARC::Batch;<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">$file =3D =
$ARGV[0];<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">chomp($file);=
<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">$batch =3D =
MARC::Batch-&gt;new('USMARC',$file);<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">$batch-&gt;st=
rict_off();&nbsp;&nbsp;&nbsp; # otherwise script exits when encounters =
errors<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">open(OUT,'&gt=
;new_marc');<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">while ( =
$record =3D $batch-&gt;next()) {<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nbsp;&=
nbsp; =
$leader&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp; =3D $record-&gt;leader();<o:p></o:p></p><p =
class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nbsp;&=
nbsp; =
$leader_pos_6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D =
substr($leader,6,1);<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nbsp;&=
nbsp; =
$leader_pos_7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D =
substr($leader,7,1);<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nbsp;&=
nbsp; =
$field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D =
$record-&gt;field('008');<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nbsp;&=
nbsp; =
$field_008&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; =3D $field-&gt;as_string();<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nbsp;&=
nbsp; $field_008_position_23 =3D =
substr($field_008,23,1);<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">if ( =
($leader_pos_6 eq "a") &amp;&amp; ($leader_pos_7 eq "m") &amp;&amp; =
($field_008_position_23 eq "o") || ($field_008_position_23 eq "s") ) =
{<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp; =
$control_num&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D =
$record-&gt;field('001');<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp; =
$control_num&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D =
$control_num-&gt;as_string();<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp; print "008 position 23: $field_008_position_23 =
\n";<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp; print "OLD leader: $leader \n";<o:p></o:p></p><p =
class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp; $old_leader =3D $leader;<o:p></o:p></p><p =
class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp; substr($leader,6,1) =3D 'm';<o:p></o:p></p><p =
class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp; print "NEW leader: $leader \n";<o:p></o:p></p><p =
class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp; print OUT =
$record-&gt;as_usmarc();<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;print =
"$control_num|$old_leader|$leader|$field_008\n";<o:p></o:p></p><p =
class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nbsp;
<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">} else =
{&nbsp; # not a match so just print this one unchanged=85<o:p></o:p></p><p=
 class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp; print OUT =
$record-&gt;as_usmarc();<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">}<o:p></o:p><=
/p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">}<o:p></o:p><=
/p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"># handles =
errors:<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">if =
(@warnings =3D $batch-&gt;warnings()) {<o:p></o:p></p><p =
class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nbsp;&=
nbsp;&nbsp; print "\n Warnings detected: \n", =
@warnings;<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">}<o:p></o:p><=
/p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">close(OUT);<o=
:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">close(LOG);<o=
:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">John =
Guillory<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Louisiana =
Library Network<o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><a =
href=3D"tel:225.578.3758" =
target=3D"_blank">225.578.3758</a><o:p></o:p></p><p class=3D"MsoNormal" =
style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></=
o:p></p>
</div>
</div>
</div><p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
</div>

</blockquote></div><br></body></html>=

<div>__________________________________________________</div>
<div><font color=3D"#007700">Il tuo <b>5x1000</b> al
 Patronato di San Girolamo della Carit&agrave; &egrave; un gesto semplice ma di grande valore.</font></div>
<div><font color=3D"#007700">Una tua firma aiuter&agrave; i sacerdoti ad essere pi&ugrave; vicini alle esigenze di tutti noi.</font></div>
<div><font color=3D"#007700">Aiutaci a formare sacerdoti e seminaristi provenienti dai 5 continenti indicando nella dichiarazione dei redditi il codice fiscale <b>97023980580</b>.</font></div>
<div><br></div>
--Apple-Mail-9-80157387--