On Sep 28, 2007 3:16 PM, Bryan Baldus <[EMAIL PROTECTED]> wrote:
> A recent posting on the OCLC-CAT discussion list ("Help needed de-duping,
> editing and exporting a raw MARC file with Connexion") mentions difficulty
> the poster is experiencing with using records with too many 949 fields for
> MarcEdit to load. This led me to attempt to create a test MARC file to see
> if I could replicate the problem. In the process, I believe I may have found
> a problem with the way MARC::Record updates the leader for the record
> length. Starting with a file containing a minimal raw MARC record (leader,
> 001 of '1', 008, and 245 of '.'), I ran the file through the loop:
>
> while (my $record = $batch->next()) {
>         for my $fieldno (0..4810) { #where 4810 was the approximate number
> of fields needed to push the record length past 99999
>                 my $new_field = MARC::Field->new('949', '', '', a =>
> "$fieldno");
>                 $record->append_fields($new_field);
>         } #for fields
>
> print OUT $record->as_usmarc(); #where OUT is an export file previously
> opened
>
> } # while
>
> ################################
>
> The output file shows the start of the leader as "100032pam 22577931."
> MARC::Record::set_leader_lengths has a line "substr($self->{_leader},0,5)  =
> sprintf("%05d",$reclen);". Is this supposed to limit the $reclen to 5
> characters, or does sprintf "%05d" simply append the necessary 0s to make
> sure the length is at least 5 digits? Since a record length over 99999 is
> impossible, it might be good to have MARC::Record complain about exceeding
> the record size limit if the $reclen > 99999, and to not exceed 5 characters
> when setting the record length.
>
> Please correct me if I am wrong. Thank you for your assistance,
>

You're right on.  I've updated MARC::Record in CVS to warn (carp) on
this condition.  When ever 2.0.1 comes out this will be included.  I'm
inclined to turn this into a hard exception (croak) if I that's the
consensus.

OT:  Since they were right next door, I also adjusted the regrexp's
that test the requested encoding to make them a little more lax about
how you spell UTF-8 and MARC-8.

-- 
Mike Rylander
 | VP, Research and Design
 | Equinox Software, Inc. / The Evergreen Experts
 | phone:  1-877-OPEN-ILS (673-6457)
 | email:  [EMAIL PROTECTED]
 | web:  http://www.esilibrary.com

Reply via email to