package Opals::Marc21;

require Exporter;
@ISA = qw(Exporter);

# Symbols to be exported by default
#@EXPORT    = qw(
#    opl_
#);
# Symbols to be exported on request
@EXPORT_OK = qw(
  mc21_parseRecord
  mc21_infoGeneral
  mc21_import
  mc21_importItem
  mc21_getNumHoldingImport
  mc21_export
  mc21_maxBarcodeTmp
  mc21_maxBarcodeDup
  mc21_format
);

#    mc21_importMarcCollection
# Version number
$VERSION = 0.01;

use utf8;
use strict;
use Business::ISBN;

#use Encode;
#use File::Path;
#use Time::localtime;
use POSIX qw(
  ceil
  strftime
);

#    strftime

use MARC::Record;
use MARC::Field;

#use MARC::File::USMARC;
use MARC::File::XML;

#use Opals::Constant;
use Opals::Date qw(
  date_f005
);
use Opals::Search qw(
  srch_maxRid
  srch_getNewRid
  srch_F852Default_marc21
  srch_getRecType
  srch_getIdenticalRIDs
);

#    srch_identicalCriteria
#    srch_checkLocalDatabase
use Opals::Utf8 qw(
  utf8_fromMarc8
  utf8_normalize
);

#    utf8_encode
use Opals::MarcXml qw(
  mxml_updateSubjectsList
  mxml_updateRecordIndex
  mxml_updateARIndex
  mxml_writeSortData
  mxml_createSortData
  mxml_addItemType
  mxml_exportRecord
  mxml_exportHolding
  mxml_fixXmlRecord
  mxml_newItem
  mxml_recordPath
  mxml_saveRecordIdentifier
  mxml_updateItemStatus
  mxml_archiveMarcXml
);
use Opals::Marc::Record;
use Opals::Utility qw(
  util_formatBarcode
  util_removeChar
  util_filterMarcXml
  util_getXmlRecord
);
use Opals::CallNumberUtil qw(
  cn_parseLCC
  cn_parseDewey
  cn_getCallNumSortByDewey
  cn_getCallNumSortByLcc
);
use Opals::CollectionStats qw(
  colStat_updateItemStats
);

# Thu, Jan 15, 2009 @ 12:03:29 EST
use Opals::UnionRequest qw(
  urq_createUnionRequest
  urq_addRec2UnionRequest
  urq_updateUnionRequestStatus
);
use Opals::BarcodeMgmt qw(
  bcm_getNextPendingBc_import
  bcm_alignTakenBc

);
use XML::Parser;
use JSON;
#
$| = 1;

# Fri, Jul 27, 2012 @ 16:08:53 EDT
my $classificationSystem =
  uc Opals::Context->preference('classificationSystem');

#
my %MARC21 = mc21_format();

#my @RECORD_IDENTIFIERS = (
#    {
#        tag =>'035',
#        code=> 'a',
#    },
#    {
#        tag => '020',
#        code=> 'a',
#    }
#);

#---------------------------------------------------------------
sub mc21_parseRecord {
    my ($xml) = @_;

    #    my $marc = MARC::Record->new_from_xml($xml);
    my $marc = Opals::Marc::Record::newFromXml($xml);

    my @rec = ();
    my $odd = 0;
    push @rec,
      {
        odd => ( $odd ^= 1 ),
        leader => $marc->leader(),
      };
    foreach my $field ( $marc->fields() ) {
        $odd ^= 1;
        my ( $tag, $code, $data );
        $tag = $field->tag();

        if ( $field->is_control_field() ) {
            $data = $field->data();
            $data = $data;
            ($data) || ( $data = ' ' );    # fix empty (sub)field
            push @rec,
              {
                odd   => $odd,
                tag   => $tag,
                label => $MARC21{$tag}{'label'},
                data  => $data,
              };
        }
        else {
            my @subfield = ();
            foreach my $sField ( $field->subfields() ) {
                ( $code, $data ) = @$sField;
                next if $code =~ m/[\W]/;
                $data = $data;
                ($data) || ( $data = ' ' );    # fix empty (sub)field
                push @subfield,
                  {
                    code  => $code,
                    label => $MARC21{$tag}{$code}{'label'},
                    data  => $data,
                  };
            }

            my $ind1 = $field->indicator(1);
            my $ind2 = $field->indicator(2);
            $ind1 =~ s/ /#/;
            $ind2 =~ s/ /#/;

            push @rec,
              {
                odd      => $odd,
                tag      => $tag,
                label    => $MARC21{$tag}{'label'},
                ind1     => $ind1,
                ind1_lbl => $MARC21{$tag}{'ind_1'},
                ind2     => $ind2,
                ind2_lbl => $MARC21{$tag}{'ind_2'},
                subfield => \@subfield,
                rows     => ( $#subfield + 1 ),
              };
        }
    }

    #    my $forceUtf8 = Opals::Context->config('forceUtf8');
    #    return ($forceUtf8) ? @{utf8_encode(\@rec)} : @rec;
    return @rec;
}

#---------------------------------------------------------------
sub mc21_infoGeneral {
    my ( $xml, $sysFilter ) = @_;

    #    my $marc = MARC::Record->new_from_xml($xml);
    my $marc = Opals::Marc::Record::newFromXml($xml);

    my %rec;
    $rec{'title'}     = $marc->subfield( '245', 'a' );
    $rec{'titleSort'} = $marc->subfield( '245', '-' );
    $rec{'title_sub'} = $marc->subfield( '245', 'b' );
    my $volumeInfo = $marc->subfield( '245', 'p' );
    if ( $marc->subfield( '245', 'n' ) ne '' ) {
        $volumeInfo .= ": " if ( $volumeInfo ne '' );
        $volumeInfo .= $marc->subfield( '245', 'n' );
    }
    $rec{'title_volumeInfo'} = $volumeInfo if ( $volumeInfo ne '' );
    $rec{'author'}    = $marc->subfield( '100', 'a' );
    $rec{'copyright'} = $marc->subfield( '260', 'c' );    #???
    $rec{'lccn'}      = $marc->subfield( '010', 'a' );
    $rec{'isbn'}      = $marc->subfield( '020', 'a' );
    $rec{'publisher'} = $marc->subfield( '260', 'b' );
    $rec{'place'}     = $marc->subfield( '260', 'a' );
    $rec{'page'}      = $marc->subfield( '300', 'a' );
    $rec{'location'}  = $marc->subfield( '852', 'c' );

    # Media type
    my ( $leader, $cf006, $cf007, $cf008 ) = ( '', '', '' );
    if ( $marc->leader ) {
        $leader = $marc->leader;
    }
    if ( $marc->field('006') ) {
        $cf006 = $marc->field('006')->data();
    }
    if ( $marc->field('007') ) {
        $cf007 = $marc->field('007')->data();
    }
    if ( $marc->field('008') ) {
        $cf008 = $marc->field('008')->data();
    }
    $rec{'medium'} = srch_getRecType( $leader, $cf006, $cf007, $cf008 );

    # Item barcode
    my @itemList;
    foreach my $f852 ( $marc->field('852') ) {
        my ( $barcode, $callnumber, $sCode, $lCode, $location, $prefix ) =
          ( "", "", "", "", "", "" );
        my $item;
        $sCode = $f852->subfield('a');

        if ( !$sysFilter
            || ( $sysFilter && $sysFilter eq $sCode ) )
        {
            $barcode = $f852->subfield('p');
            $callnumber =
                $f852->subfield('k') . ' '
              . $f852->subfield('h') . ' '
              . $f852->subfield('i') . ' '
              . $f852->subfield('m');
            $lCode = $f852->subfield('b');
            if ( $f852->subfield('c') ) {
                $location = $f852->subfield('c');
            }

            $prefix = $f852->subfield('k') if ( $f852->subfield('k') );

            $barcode = uc($barcode);

            #$barcode =~ s/ //g;
            #$barcode =~ s/(^ +| +$)//g;

            $callnumber =~ s/ +/ /g;
            $callnumber =~ s/(^ +| +$)//g;

            ($sCode) || ( $sCode = '' );
            ($lCode) || ( $lCode = '' );

            $item->{'barcode'}    = $barcode;
            $item->{'callnumber'} = $callnumber;
            $item->{'sCode'}      = $sCode;
            $item->{'lCode'}      = $lCode;
            $item->{'location'}   = $location;
            $item->{'prefix'}     = $prefix;

            push @itemList, $item;
        }
    }
    @itemList = sort { $a->{'barcode'} cmp $b->{'barcode'} } @itemList;
    $rec{'itemList'} = \@itemList;

    # Series title
    $rec{'title_series_a'} = $marc->subfield( '440', 'a' );
    $rec{'title_series_v'} = $marc->subfield( '440', 'v' );
    if ( !$rec{'title_series_a'} ) {
        $rec{'title_series_a'} = $marc->subfield( '490', 'a' );
        $rec{'title_series_v'} = $marc->subfield( '490', 'v' );
    }

    my ( $code, $data );

    # Subject
    my @subject = ();
    foreach my $field ( $marc->field('6..') ) {
        my @subject_part = ();
        foreach my $subfield ( $field->subfields() ) {
            ( $code, $data ) = @$subfield;
            if ( $code ne '2' ) {
                $data = util_removeChar($data);
                push @subject_part, { subject_part => $data };
            }
        }
        push @subject, { subject => \@subject_part };
    }
    $rec{'listSubject'} = \@subject;

    # Summary, content note, note
    my @summary       = ();
    my @contentNote   = ();
    my @studyPrgmNote = ();
    my @note          = ();
    my $tag;
    foreach my $field ( $marc->field('5..') ) {
        $tag = $field->tag;
        my $prgmNote = "";
        my ( $contMI, $cont_TR ) = ( "", "" );
        my ( $miscInfo, $title, $resp, $url ) = ( "", "", "", "" );
        my @contArr = ();
        my @uriArr  = ();
        foreach my $subfield ( $field->subfields() ) {
            ( $code, $data ) = @$subfield;
            if ( $tag eq '505' ) {
                if ( $code eq 'g' || $code eq 'a' ) {
                    if ( $title ne "" ) {
                        push @contArr, { title505 => $title, resp505 => $resp };
                    }

                    #if(scalar(@contArr)){
                    my @tmpCont = @contArr;
                    my @tmpUri  = @uriArr;
                    push @contentNote,
                      {
                        miscInfo    => $miscInfo,
                        titRespList => \@tmpCont,
                        uriList     => \@tmpUri
                      };
                    @contArr = ();
                    @uriArr  = ();

                    #}
                    if ( $code eq 'a' ) {
                        push @contentNote, { contNoteFormat => $data };
                        ( $miscInfo, $title, $resp ) = ( "", "", "" );
                    }
                    else {
                        ( $miscInfo, $title, $resp ) = ( $data, "", "" );
                    }
                }
                elsif ( $code eq 't' ) {
                    if ( $title ne "" ) {
                        push @contArr, { title505 => $title };
                    }
                    $title = $data;
                    $title =~ s/^\s+|\s+$//;
                }
                elsif ( $code eq 'r' ) {
                    $resp = $data;
                    $resp =~ s/^\s+|\s+$//;
                    push @contArr, { title505 => $title, resp505 => $resp };
                    ( $title, $resp ) = ( "", "" );
                }
                elsif ( $code eq 'u' ) {
                    push @uriArr, { uri => $data };
                }

            }
            elsif ( $tag eq '526' ) {
                if ( $code eq 'a' ) {
                    $prgmNote .= "$data : ";
                }
                elsif ( $code eq 'b' ) {
                    $prgmNote .= "Interest Level: $data ";
                }
                elsif ( $code eq 'c' ) {
                    $prgmNote .=
                      $prgmNote eq ""
                      ? "Reading Level: $data"
                      : " / Reading Level: $data";
                }
                elsif ( $code eq 'd' ) {
                    $prgmNote .=
                      $prgmNote eq ""
                      ? "Point Value: $data"
                      : " / Point Value: $data";
                }
                elsif ( $code eq 'z' ) {
                    $prgmNote .=
                      $prgmNote eq "" ? "Quiz #: $data" : " / Quiz #:  $data";
                }

                else {
                    $prgmNote .=
                      $prgmNote eq "" ? "\$$code $data" : " -- \$$code $data";
                }
            }
            elsif ( $code eq 'a' ) {
                if ( $tag eq '520' ) {
                    push @summary, { val => $data };
                }
                elsif ( $tag ne '505' ) {
                    push @note, { val => $data };
                }
            }

        }
        if ( $miscInfo ne "" || $title ne "" ) {
            push @contArr, { title505 => $title, resp505 => $resp };
        }
        if ( scalar(@contArr) ) {
            push @contentNote,
              {
                miscInfo    => $miscInfo,
                titRespList => \@contArr,
                uriList     => \@uriArr
              };
        }

        if ( $prgmNote ne '' ) {
            push @studyPrgmNote, { prgmNote => $prgmNote };
        }
    }
    $rec{'listContentNote'} = \@contentNote;
    $rec{'studyPrgmNote'}   = \@studyPrgmNote;
    $rec{'listSummary'}     = \@summary;
    $rec{'listNote'}        = \@note;

    # Electronic location and access
    my @listUri;
    my $ii = 0;
    foreach my $field ( $marc->field('856') ) {
        foreach my $subfield ( $field->subfield('u') ) {
            my $uri_desc = $field->subfield('3');
            $uri_desc =~ s/^ +//;

            #if($uri_desc eq ''){
            #    $uri_desc=$ii?"more info $ii":"more info";
            #    $ii++
            #}
            push @listUri, { uri => $subfield, uri_desc => $uri_desc };

        }
    }
    $rec{'listUri'} = \@listUri;

    # Field tag 880
    foreach my $field ( $marc->field('880') ) {
        my $sf880_a = $field->subfield('a');
        my $sf880_6 = $field->subfield('6');

        if ( $sf880_6 && $sf880_6 =~ m/100/g ) {
            $rec{'author_880'} = $sf880_a;
        }
        elsif ( $sf880_6 && $sf880_6 =~ m/245/g ) {
            $rec{'title_880'} = $sf880_a;
        }
        elsif ( $sf880_6 && $sf880_6 =~ m/260/g ) {
            my $sf880_b = $field->subfield('b');
            $rec{'place_880'}     = $sf880_a;
            $rec{'publisher_880'} = $sf880_b;
        }

    }

    # Illustrator
    my @illustrator = ();
    foreach my $field ( $marc->field('700') ) {
        my $sf700_a = $field->subfield('a');
        my $sf700_e = $field->subfield('e');
        if ( $sf700_e =~ m/^ill/gi ) {
            push @illustrator, $sf700_a;
        }
    }
    if ( scalar(@illustrator) > 0 ) {
        $rec{'illustrator'} = join( "; ", @illustrator );
    }

    # Done
    #    my $forceUtf8 = Opals::Context->config('forceUtf8');
    #    return ($forceUtf8) ? %{utf8_encode(\%rec)} : %rec;
    return %rec;
}

#---------------------------------------------------------------
sub mc21_getImport {
    my ($dbh) = @_;
    $dbh->do(
"update opl_marcImport set status='indexing' where countProcessed=countTotal && status='accepted'"
    );
    my $sth = $dbh->prepare(<<_STH_);
select  *
from    opl_marcImport
where   status = 'accepted' &&
        countProcessed < countTotal
order by dateUpload asc
limit 1
_STH_
    my $rv     = $sth->execute;
    my $import = $sth->fetchrow_hashref;
    $sth->finish;

    my $iid = $import->{'iid'};
    if ($iid) {
        my $marcData = '';
        my $db_name  = Opals::Context->config('db_name');
        my $imex     = Opals::Context->config('imex');
        open FILEIMPORT, "<$imex/import/$db_name/$iid";
        while (<FILEIMPORT>) {
            $marcData .= $_;
        }
        close FILEIMPORT;

        my @record = split( /\x1D/, $marcData );
        my $countTotal = $import->{'countTotal'};
        if (   $countTotal
            && $countTotal =~ m/^[\d]+$/ )
        {    # &&

            #            $countTotal == scalar(@record)) {

            my @recordImport;

            my $first = $import->{'countProcessed'};
            my $last  = $first + 1000;
            $last = ( $last < $countTotal ) ? $last : $countTotal;
            for ( my $i = $first ; $i < $last ; $i++ ) {
                $record[$i] =~ s/^[\D]*//;
                push @recordImport, "$record[$i]\x1D";
            }

            #
            #            $sth = $dbh->prepare(<<_STH_);
            #select  sys.sid, sys.sCode, sys.sName,
            #        lib.lid, lib.lCode, lib.lName
            #from    opl_libSystem as sys, opl_library as lib
            #where   lid = ? &&
            #        sys.sCode = lib.sysCode
            #_STH_
            #            $sth->execute($import->{'lid'});
            #            $import->{'libInfo'} = $sth->fetchrow_hashref;
            #            $sth->finish;

            $import->{'record'} = \@recordImport;
        }

        return $import;
    }

    return;
}

#---------------------------------------------------------------
sub mc21_maxBarcodeTmp {
    my ($dbh) = @_;

    my $sth = $dbh->prepare(<<_STH_);
select  max(cast(replace(barcode,'TMP_','') as unsigned))
from    opl_item
where   barcode regexp '^TMP_[0-9]+\$'
_STH_
    $sth->execute;
    my ($barcode_tmp) = $sth->fetchrow_array;
    $sth->finish;

    if ($barcode_tmp) {
        $barcode_tmp =~ s/TMP\_([\d]*)/$1/;
        $barcode_tmp =~ s/^0*//g;
    }
    $barcode_tmp = 0 unless ($barcode_tmp);
    $barcode_tmp++;
    $barcode_tmp = 'TMP_' . util_formatBarcode($barcode_tmp);

    return $barcode_tmp;
}

#---------------------------------------------------------------
sub mc21_maxBarcodeDup {
    my ( $dbh, $barcode ) = @_;

    my $sql_bc = $barcode;
    $sql_bc =~ s/([*+?])/\\\\$1/g;
    $sql_bc .= '_';

    my ($maxDupBarcode) = $dbh->selectrow_array(<<_STH_);
select  max(barcode)
from    opl_item
where   barcode regexp '^DUP_$sql_bc'
_STH_

    if ( $maxDupBarcode && $maxDupBarcode =~ s/([\d]{3})$// ) {
        my $dupCount = $1;
        $dupCount =~ s/^0{1,2}//;
        $dupCount++;
        $dupCount = sprintf( "%0.3d", $dupCount );

        $maxDupBarcode .= $dupCount;
    }
    else {
        $maxDupBarcode = 'DUP_' . $barcode . '_000';
    }

    return $maxDupBarcode;
}

#---------------------------------------------------------------
sub mc21_filter {
    my ( $tagno, $tagdata ) = @_;

    return
         ( length($tagno) == 3 )
      && ( $tagno !~ m/[\D]/ )
      && ( $tagno ne '005' )
      && ( $tagno < 900 || $tagno == 940 );

    #           ($tagno ne '001') &&
}

#---------------------------------------------------------------
sub mc21_set001_005 {
    my ( $marc, $rid ) = @_;

    my @fields = $marc->fields();
    my $fRequired = MARC::Field->new( '001', $rid );
    $marc->insert_fields_before( $fields[0], $fRequired );

    # Locate field after which field 005 should be inserted. It should be
    # the last field 003. If there is not any field 003, then it should be
    # field 001.
    my @f003 = $marc->field('003');
    my $fPrevious = ( $#f003 > -1 ) ? $f003[$#f003] : $marc->field('001');

    $fRequired = MARC::Field->new( '005', date_f005() );
    $marc->insert_fields_after( $fPrevious, $fRequired );

    return $marc;
}

#---------------------------------------------------------------
sub sql_saveRecordInfo {
    my ( $dbh, $marc ) = @_;

    my $rid = getRidFromMarc($marc) || return;

    my $marcRecord;
    my $dummyStr;

    $marcRecord->{'recFormat'} = _getRecType($marc);

    # title
    $dummyStr = $marc->subfield( '245', 'a' );
    $dummyStr = util_removeChar($dummyStr);
    $marcRecord->{'title'} = $dummyStr if $dummyStr;
    $dummyStr = $marc->subfield( '245', 'b' );
    $dummyStr = $marc->subfield( '245', 'p' ) unless $dummyStr;
    $dummyStr = util_removeChar($dummyStr);
    $marcRecord->{'title'} .= ': ' . $dummyStr if $dummyStr;

    # author
    $dummyStr = $marc->subfield( '100', 'a' );
    $dummyStr =~ s/&apos;/'/g if $dummyStr;
    $dummyStr = util_removeChar($dummyStr);
    $marcRecord->{'author'} = $dummyStr if $dummyStr;

    # pubPlace
    $dummyStr = $marc->subfield( '260', 'a' );
    $dummyStr = $marc->subfield( '264', 'a' ) if($dummyStr eq "");
    $dummyStr =~ s/&apos;/'/g if $dummyStr;
    $dummyStr = util_removeChar($dummyStr);
    $marcRecord->{'pubPlace'} = $dummyStr if $dummyStr;

    # pubName
    $dummyStr = $marc->subfield( '260', 'b' );
    $dummyStr = $marc->subfield( '264', 'b' ) if($dummyStr eq "");
    $dummyStr =~ s/&apos;/'/g if $dummyStr;
    $dummyStr = util_removeChar($dummyStr);
    $marcRecord->{'pubName'} = $dummyStr if $dummyStr;

    # pubDate
    $marcRecord->{'pubDate'} = $marc->subfield( '260', 'c' );
    $marcRecord->{'pubDate'} = $marc->subfield( '264', 'c' ) if ($marcRecord->{'pubDate'} eq "");



    #ISBN 
    $marcRecord->{'isbn'} = $marc->subfield( '020', 'a');

    # leader
    $marcRecord->{'leader'} = $marc->leader();

    # cf_008
    my $cf_008 = $marc->field('008');

    #$marcRecord->{'cf_008'} = ($cf_008) ? $cf_008->data() : '';
    if ($cf_008) {
        $marcRecord->{'cf_008'} = $cf_008->data();
    }
    else {
        $marcRecord->{'cf_008'} = '940203s1995    nyua   j      000 1 eng';

        my $field;
        for ( my $i = 7 ; $i > 0 && !$field ; $i-- ) {
            $field = $marc->field("00$i");
        }

        $marc->insert_fields_after( $field,
            MARC::Field->new( '008', $marcRecord->{'cf_008'} ) );
    }

    # marc xml
    my $xml = MARC::File::XML::record($marc);
    $xml = util_filterMarcXml($xml);

    # Tue, Nov 25, 2008 @ 14:30:29 EST
    # add titleSort to opl_marcRecord

    $marcRecord->{'titleSort'} = "";
    if ( $xml =~
m/([\s]*<datafield tag="245" ind1="[\d\ ]" ind2="[\d\ ]">([\s]*<subfield code="[\w\d]">.*<\/subfield>)*[\s]*<\/datafield>)/
      )
    {
        my @sfCode = ( 'a', 'b', 'p' );
        $marcRecord->{'titleSort'} = mxml_createSortData( $1, 245, \@sfCode );
    }
    $marcRecord->{'pubDateSort'} = "";
    if ( $xml =~
m/([\s]*<datafield tag="260" ind1="[\d\ ]" ind2="[\d\ ]">([\s]*<subfield code="[\w\d]">.*<\/subfield>)*[\s]*<\/datafield>)/
      )
    {
        my @sfCode = ('c');
        $marcRecord->{'pubDateSort'} = mxml_createSortData( $1, 260, \@sfCode );
    }
    if ($marcRecord->{'pubDateSort'} eq "" && $xml =~
m/([\s]*<datafield tag="264" ind1="[\d\ ]" ind2="[\d\ ]">([\s]*<subfield code="[\w\d]">.*<\/subfield>)*[\s]*<\/datafield>)/
      )
    {
        my @sfCode = ('c');
        $marcRecord->{'pubDateSort'} = mxml_createSortData( $1, 264, \@sfCode );
    }

    # /Tue, Nov 25, 2008 @ 14:31:08 EST

    my $sql = <<_STH_;
replace into opl_marcRecord
set rid      = ?,
    title    = ?,
    titleSort    = ?,
    author   = ?,
    pubPlace = ?,
    pubName  = ?,
    pubDate  = ?,
    pubDateSort = ?,
    isbn =  ?,
    leader   = ?,
    cf_008   = ?,
    recFormat=?,
    modDate= now()
_STH_
    my @param = (
        $rid,                       $marcRecord->{'title'},
        $marcRecord->{'titleSort'}, $marcRecord->{'author'},
        $marcRecord->{'pubPlace'},  $marcRecord->{'pubName'},
        $marcRecord->{'pubDate'},   $marcRecord->{'pubDateSort'}, $marcRecord->{'isbn'},
        $marcRecord->{'leader'},    $marcRecord->{'cf_008'},
        $marcRecord->{'recFormat'}
    );

    $dbh->do( $sql, undef, @param );

    #    return $rv;
    #    return $xml;
}

#sub sql_saveRecordIdentifier {
#    my ($dbh, $marc) = @_;
#
#    my $rid = getRidFromMarc($marc) || return;
#
#    $dbh->do(<<_SQL_);
#delete from opl_recordIdentifier where rid = $rid
#_SQL_
#
#    my $sth = $dbh->prepare(<<_SQL_);
#insert
#into    opl_recordIdentifier
#set     rid = ?,
#        tag = ?,
#        code = ?,
#        data = ?
#_SQL_
#
#    my ($tag, $code, $data, $isbn_obj, $isbn13);
#    foreach my $id (@Opals::Search::RECORD_IDENTIFIERS) {
#        $tag = $id->{'tag'};
#        $code = $id->{'code'};
#
#        foreach my $f ($marc->field($tag)) {
#            $data = $f->subfield($code);
#
#            if (!$data) {
#                next;
#            }
#
#            if ($tag eq '020' && $code eq 'a') {
#                if($data ne '' && (length($data)==10 || length($data)==13) && valid_isbn_checksum($data)){
#                    $isbn_obj = Business::ISBN->new($data) || next;
#                    $isbn13 = $isbn_obj->as_isbn13;
#                    $data = $isbn13->as_string([]);
#                }
#            }
#            elsif ($tag eq '035' && $code eq 'a' &&
#                    $data !~ m/^\(OCoLC\)[1-9]/) {
#                next;
#            }
#
#            $sth->execute($rid, $tag, $code, $data);
#        }
#    }
#
#    $sth->finish;
#}

#sub mc21_zAddRecord {
#    my ($config, $xml) = @_;
#
##    my $rid;
##    if ($xml =~ m/<controlfield tag="001">([\d]*)<\/controlfield>/) {
##        $rid = $1; #my $rid = $marc->field('001')->data();
##    }
##    else {
##        return if ($rid =~ m/[\D]+/);
##    }
#
#    writeToFile(xml => $xml);
#
##
##    # Write sort data
##    $xml = mxml_writeSortData($xml);
##    #/Write sort data
##
##    $xml =~ s/<\?xml(.*)\?>\n//gi;
##    $xml =~ s/\n/ /gi;
##    my $zebraidx  = $config->{'zebraidx'};
##    my $zRoot     = $config->{'zRoot'};
##    my $zPort     = $config->{'zPort'};
##    my $zDatabase = $config->{'zDatabase'};
##
##    my $dir = "$zRoot/$zPort/record/$zDatabase/" . ceil($rid/1000);
##    umask 002;
##    if (! -d $dir) {
##        mkdir $dir;
##        system("chown apache.apache $dir");
##    }
##
##    # Write to file
##    open  RECORD, ">:utf8", "$dir/$rid.xml";
###    open  RECORD, ">$dir/$rid.xml";
##    print RECORD $xml;
##    close RECORD;
##
##    system("chown apache.apache $dir/$rid.xml");
##    system("chmod 664 $dir/$rid.xml");
#}

#---------------------------------------------------------------
sub writeToFile {
    my (%file) = @_;
    my ( $content, $marc );

    # Get content
    if ( $file{'xml'} ) {
        $content = $file{'xml'};
        $marc    = Opals::Marc::Record::newFromXml($content);
    }
    elsif ( $file{'marc'} ) {
        $marc    = $file{'marc'};
    }
    else {
        print "Write to file: content not specified.\n";
        return;
    }                
    my @f005 = $marc->field('005');
    $marc->delete_fields(@f005);
    my @fields = $marc->fields();
    my $fRequired = MARC::Field->new( '005', date_f005() );
    $marc->insert_fields_after( $fields[0], $fRequired );

    $content = MARC::File::XML::record($marc);

    my $rid = $marc->field('001')->data();
    if ( !$rid || $rid =~ m/[\D]/ ) {
        print "Write to file: Invalid RID.\n";
        return;
    }

    # Write sort data
    $content = mxml_writeSortData($content);

    $content = util_filterMarcXml($content);
    $content =~ s/<\?xml(.*)\?>\n//gi;
    $content =~ s/\n/ /gi;
    my $dir      = mxml_recordPath($rid);
    my $pathname = $dir . '/' . $rid . '.xml';
    mxml_archiveMarcXml( $file{'dbh'}, $rid, $content );
    umask 002;

    # Check and create directory if neccessary
    if ( !-d $dir ) {
        mkdir $dir;
        system("chown apache.apache $dir");
    }

    # Write to file
#    if ( $file{'MARC-8'} ) {
#        open RECORD, ">:utf8", "$pathname";
#    }
#    else {
#        open RECORD, ">$pathname";
#    }
#
#    open  RECORD, ">$pathname";
    open RECORD, ">:encoding(utf8)", "$pathname";
    print RECORD $content;
    close RECORD;

    system("chown apache.apache $pathname");

    #    system("chmod 664 $pathname");
}

#---------------------------------------------------------------
sub mc21_import {
    my ($dbh) = @_;

    my $config;
    $config->{'zebraidx'} = Opals::Context->config('zebraidx');
    return unless ( -f $config->{'zebraidx'} );

    my $import           = mc21_getImport($dbh);
    my $iid              = $import->{'iid'};
    my $record           = $import->{'record'};
    my $impUid           = $import->{'uid'};
    my $addToNewItemList = $import->{'addToNewitemList'};
    my $newItemExpDate   = $import->{'newItemExpDate'};
    return unless $iid;

    my $enc = 'a';
    if ( $import->{'encoding'} eq 'MARC-8' ) {
        $enc = ' ';
    }

    $config->{'zRoot'}     = Opals::Context->config('zRoot');
    $config->{'zPort'}     = Opals::Context->config('zPort');
    $config->{'zDatabase'} = Opals::Context->config('zDatabase');
    $config->{'type'}      = Opals::Context->config('type');

    # Get the max rid from DB
    #my $rid = srch_maxRid($dbh);

    #print "IID[$iid]: $rid\n";

    my $f852Default = srch_F852Default_marc21( $dbh, 0 );
    my $pending;
    my $origRec;
    my $db_name = Opals::Context->config('db_name');
    my $vetoedFile =
      Opals::Context->config('imex') . "/import/$db_name/$iid.veto";
    open VETO, ">>$vetoedFile";

    #Fri, Jan 30, 2009 @ 14:17:54 EST
    my $unionUpdateReqId = 0;

    #/Fri, Jan 30, 2009 @ 14:18:05 EST

    my $sth_updateCountProcessed = $dbh->prepare(<<_STH_);
update  opl_marcImport
set     countProcessed = countProcessed + 1
where   iid = $iid
_STH_
    my $sth_updateCountImported = $dbh->prepare(<<_STH_);
update  opl_marcImport
set     countImported = countImported + 1,
        dateImport = now()
where   iid = $iid
_STH_
    my $sth_updateCountMerged = $dbh->prepare(<<_STH_);
update  opl_marcImport
set     countMerged = countMerged + 1,
        dateImport = now()
where   iid = $iid
_STH_

    my %unionImport;
    # Importing records
    foreach my $rec (@$record) {
        $origRec = $rec . "\x1D";
        $sth_updateCountProcessed->execute();

        #substr($rec, 9, 1, $enc);
        # Temporarily set encoding to MARC8 to disable automatic character
        # conversion based on leader. If records are UTF-8, their leaders will
        # be reassign to UTF-8 in utf8_normalize().
        substr( $rec, 8, 1, ' ' );

        my $marc = MARC::File::USMARC->decode( $rec, \&mc21_filter );
        $marc =
          Opals::Marc::Record::convert_OCoLC_number( $marc,
            $import->{'recordSource'} );
        $marc = Opals::Marc::Record::delete_fields( $marc, '001' );

        # Fri, Mar 31, 2017 @ 15:30:17 EDT 
        # added: skip records without holding/barcode if it's re-import
        if(!$marc->field('852') && $import->{'mergeMode'} eq 're-import'){
            print VETO $origRec;
            next;
        }

        #set marc record to ebook type if import type is ebook
        if ( $import->{'type'} eq 'ebook' ) {
            $marc = _updateMarc2Ebook($marc);
        }

        # Remove subfields with empty codes
        foreach my $f ( $marc->fields() ) {
            if ( $f->is_control_field() ) {
                next;
            }

            foreach my $sf ( $f->subfields() ) {
                my $sfc = $sf->[0];
                if ( $sfc =~ m/[\W]/ ) {
                    $f->delete_subfield( code => "$sfc" );
                }
            }

            if ( scalar( $f->subfields() ) == 0 ) {
                $marc->delete_field($f);
            }
        }

        unless ( $marc->fields() ) {
            print VETO $origRec;
            next;
        }

        if ( $import->{'encoding'} eq 'MARC-8' ) {
            $marc = utf8_fromMarc8($marc);
        }
        else {
            $marc = utf8_normalize($marc);
        }

        #Mon, Jul 30, 2012 @ 11:34:14 EDT
        #for ebook import, set subfiled 852$3 and 852$k to 'ebook'
        # and set value of 852$h to value of 050$a or 082$a
        my $sf050a = $marc->subfield( '050', 'a' );
        my $sf082a = $marc->subfield( '082', 'a' );
        my $sf852h = $classificationSystem eq 'LCC' ? $sf050a : $sf082a;
        if ( !$marc->field('852') ) {
            $f852Default->delete_subfield( code => 'p' );
            if ( $import->{'type'} eq 'ebook' ) {
                $f852Default->delete_subfield( code => '3' );
                $f852Default->delete_subfield( code => 'k' );
                $f852Default->delete_subfield( code => 'h' );
                $f852Default->add_subfields( '3' => 'E-BOOK' );
                $f852Default->add_subfields( 'k' => 'E-BOOK' );
                $f852Default->add_subfields( 'h' => $sf852h );
            }
            $marc->append_fields($f852Default);
        }

        #/Mon, Jul 30, 2012 @ 11:34:14 EDT

        # Modify 852a/852b if neccessary
        #        my $sid = $import->{'libInfo'}->{'sid'};
        #        my $lid = $import->{'libInfo'}->{'lid'};
        #        ($sid && $sid =~ m/^[\d]+$/) || ($sid = 0);
        #        ($lid && $lid =~ m/^[\d]+$/) || ($lid = 0);
        #
        #        if ($sid > 2 && $lid > 2) {
        #            foreach my $f852 ($marc->field('852')) {
        #                $f852->update('a' => $import->{'libInfo'}->{'sCode'});
        #                $f852->update('b' => $import->{'libInfo'}->{'lCode'});
        #            }
        #        }
        #        elsif ($sid > 2) {
        #            foreach my $f852 ($marc->field('852')) {
        #                $f852->update('a' => $import->{'libInfo'}->{'sCode'});
        #            }
        #        }
        #        elsif ($lid > 2) {
        #            foreach my $f852 ($marc->field('852')) {
        #                $f852->update('b' => $import->{'libInfo'}->{'lCode'});
        #            }
        #        }

        #/Modify 852a/852b if neccessary
        foreach my $f852 ( $marc->field('852') ) {
            $f852->update( 'a' => $f852Default->subfield('a') );
            $f852->update( 'b' => $f852Default->subfield('b') );
        }

        # Add additional 852 subfield
        my ( $sfCode, $sfData ) =
          ( $import->{'sf852Code'}, $import->{'sf852Data'} );
        foreach my $f852 ( $marc->field('852') ) {
            $f852->delete_subfield(match => qr/^(\s*)$/);
            my $f852_new = mc21_addSubfield( $f852, $sfCode, $sfData );
            $f852->replace_with($f852_new) if ($f852_new);
        }

        #/Add additional 852 subfield

        if (   $import->{'mode'} eq 'autoMerge'
            && $marc->field('852') )
        {
            $marc = autoMerge( $dbh, $marc, $import, \%unionImport,
                $sth_updateCountMerged );

            if ( !$marc || !$marc->field('852') ) {

                #$sth_updateCountMerged->execute();
                next;
            }
        }
        elsif ( $import->{'mode'} eq 'manualMerge' ) {

     #            #($marc, $pending) = mc21_addListDuplicate($dbh, $iid, $marc);
     #            #next if $pending;
     #            next if mc21_addListDuplicate($dbh, $iid, $marc);
        }
        elsif ( $import->{'mode'} eq 'overlay' ) {
        }

# Thu, Jul 05, 2012 @ 10:23:48 EDT
#       set marc record to ebook type if import type is ebook,also replace the link text in 856$3 if requested
        if ( $import->{'type'} eq 'ebook' ) {
            my ( $sf856Code, $sf856Data ) =
              ( $import->{'sf856Code'}, $import->{'sf856Data'} );
            if ( $sf856Code ne '' && $sf856Data ne '' ) {
                my @f856 = $marc->field("856");
                foreach my $f (@f856) {
                    if ( !$f->subfield('3') ) {
                        $f->add_subfields( $sf856Code, $sf856Data );
                    }
                    else {
                        $f->update( $sf856Code, $sf856Data );
                    }
                }
            }

        }

        #/Thu, Jul 05, 2012 @ 10:23:48 EDT
        #$rid++;
        my $rid=srch_getNewRid($dbh);
        $marc = mc21_set001_005( $marc, $rid );
        foreach my $f852 ( $marc->field('852') ) {
            my $f852_new = mc21_importItem( $dbh, $rid, $f852, $iid );
            if ($f852_new) {
                $f852->replace_with($f852_new);
                $unionImport{$rid}->{ $f852_new->subfield('p') } = 1;
            }
        }

        # Save holding data into database
        #foreach my $f852 ($marc->field('852')) {
        #    sql_saveHoldingInfo($dbh, $f852);
        #}
        #/Save holding data into database

        $sth_updateCountImported->execute();

        sql_saveRecord( $dbh, $marc, $import );
        writeToFile( marc => $marc, $import->{'encoding'} => 1, dbh => $dbh );

        #writeToFile(xml => $xml);
    }

    #/Importing records

    $sth_updateCountProcessed->finish();
    $sth_updateCountImported->finish();
    $sth_updateCountMerged->finish();

    close VETO;
    %unionImport =unionExportFilter($dbh,%unionImport);
    if (%unionImport) {
        if ( !$unionUpdateReqId ) {
            $unionUpdateReqId =
              urq_createUnionRequest( $dbh, $impUid, 'import' );
        }

        foreach my $rid ( sort keys %unionImport ) {
            my @bcList = ();
            foreach my $bc ( sort keys %{ $unionImport{$rid} } ) {
                push @bcList, $bc;
            }

            urq_addRec2UnionRequest( $dbh, $unionUpdateReqId, $rid, \@bcList );
        }

        urq_updateUnionRequestStatus( $dbh, $unionUpdateReqId, 'pending' );
    }

    if (
        scalar(@$record) + $import->{'countProcessed'} ==
        $import->{'countTotal'} )
    {
        $dbh->do("update opl_marcImport set status='indexing' where iid=$iid");

#$dbh->do("update opl_marcRecord set zIndexed=0 where rid in (select distinct rid from opl_item where dateImport > ?", undef, $import->{'dateUpload'});
    }
    bcm_alignTakenBc($dbh,$iid);
}

#---------------------------------------------------------------
sub mc21_addSubfield {
    my ( $field, $sfCode, $sfData ) = @_;
    if ( !$sfCode || !$sfData ) {
        return;
    }

    if ( $MARC21{'852'}->{$sfCode}->{'rpt'} == 1 ) {
        foreach my $data ( $field->subfield($sfCode) ) {
            if ( lc($data) eq lc($sfData) ) {
                return $field;
            }
        }

        $field->add_subfields( $sfCode => $sfData );
    }
    else {
        $field->update( $sfCode => $sfData );
    }

    return $field;
}

#-------------------------------------------------------------------------------
# Wed, Jul 07, 2010 @ 11:46:44 EDT
#
#Ha
sub mc21_getNumHoldingImport {
    my ($dbh) = @_;

    my $config;
    $config->{'zebraidx'} = Opals::Context->config('zebraidx');
    return unless ( -f $config->{'zebraidx'} );

    my ( $startBc, $rangeId, $totalHolding, $totalHoldingWObc ) =
      ( '', 0, 0, 0 );
    my $import = mc21_getImport($dbh);
    my $iid    = $import->{'iid'};
    my $record = $import->{'record'};
    $startBc = $import->{'startBc'};
    $rangeId = $import->{'rangeId'};
    return unless $iid;

    foreach my $rec (@$record) {
        substr( $rec, 9, 1, ' ' );
        my $marc = MARC::File::USMARC->decode( $rec, \&mc21_filter );
        $marc =
          Opals::Marc::Record::convert_OCoLC_number( $marc,
            $import->{'recordSource'} );

        if ( $config->{'type'} == 0 ) {
            foreach my $f852 ( $marc->field('852') ) {
                my $tmpBc = $f852->subfield('p');
                $tmpBc =~ s/^\s*//gs;
                $totalHoldingWObc++ if ( $tmpBc eq '' );
                $totalHolding++;
            }
        }
    }
    return ( $totalHolding, $totalHoldingWObc );

}

#-------------------------------------------------------------------------------

=item

$barcode_tmp: the current temporary max barcode. It is only incremented if the
holding does not have a barcode or a valid barcode.

$f852: an object of type MARC::Field

=cut

sub mc21_importItem {

    #    my ($dbh, $rid, $barcode_tmp, $f852) = @_;
    my ( $dbh, $rid, $f852, $importId ) = @_;

    my ( $item, $sth, $rv );

#    my $tm = localtime;
#    my $todayStr = sprintf("%04d-%02d-%02d", $tm->year +1900, ($tm->mon)+1, $tm->mday);
    my @lt = localtime;
    my $todayStr = strftime( '%F', @lt );

    #return strftime('%Y-%m-%d %H:%M:%S', @lt);

    my $barcode = $f852->subfield('p');
    $barcode =~ s/^\s*//g if ($barcode);
    if ( !$barcode || $barcode eq '' ) {
        if ( $barcode eq '' && defined $importId && $importId > 0 ) {
            $barcode = bcm_getNextPendingBc_import( $dbh, $importId );
        }
        else {
            $barcode = mc21_maxBarcodeTmp($dbh);

        }

    }
    if ( !$barcode || $barcode eq '' )
    {    #In case close dialog without select format barcode
        $barcode = mc21_maxBarcodeTmp($dbh);
    }

    # Up-shift bar code
    $barcode = uc($barcode);

    # Disable bar code filter. The filter was used to remove bad characters not
    # in bar code label. Initially, we think a bar code may compose of
    # alpha-numeric characters only. Later, a dash was added to satified Indian
    # library, Financial Services Library (HCLFS). In September 2007, we got a
    # lot of troublesome Follette bar codes. Follette bar codes are so
    # inconsistent: some having only digits (3425), some starting a upper-case T
    # (T0003425), some having spaces (T 003425), some starting with only 0's
    # (0003425). To make the problem worse, they have bar code label different
    # to the coresponding value in MARC record.
    #
    # Some libraries even have those characters append to the end of their bar
    # codes: !@#$%^&*().
    #
    ## Remove all non-alphanumeric characters
    #$barcode =~ s/[^\w\-]//g;
    $barcode =~ s/(^[\s]+|[\s]+$)//;

    my $typeId;
    ( $f852, $typeId ) = mc21_importItemType( $dbh, $f852 );

    my $callNumber = getCallNumber($f852);
    my $price      = $f852->subfield('9');

    #Wed, Jun 20, 2012 @ 16:00:06 EDT
    # add sort call number by LCC and dewey info to item
    #
    my $cnSort_dewey = cn_getCallNumSortByDewey($callNumber);
    my $cnSort_lcc   = cn_getCallNumSortByLcc($callNumber);

    $sth = $dbh->prepare(<<_STH_);
insert into opl_item
set barcode    = ?,
    rid        = ?,
    typeId     = ?,
    callNumber = ?,
    dateImport = now(),
    modDate    = now(),
    price      = ?,
    callNumSort_dewey =?,
    callNumSort_lcc =?

_STH_
    while (
        !$sth->execute(
            $barcode, $rid,          $typeId, $callNumber,
            $price,   $cnSort_dewey, $cnSort_lcc
        )
      )
    {
        if ( $barcode =~ m/^TMP\_[\d]*$/ ) {    # duplicate tmp barcode
            $barcode = mc21_maxBarcodeTmp($dbh);
        }
        else {                                  # duplicate real barcode
            $barcode = mc21_maxBarcodeDup( $dbh, $barcode );
        }
    }
    colStat_updateItemStats( $dbh, $barcode, 1, $todayStr );

    $sth->finish;

    $f852->update( 'p' => $barcode );
    sql_saveHoldingInfo( $dbh, $f852 );

    #    return ($f852, $barcode_tmp);
    return $f852;
}

#---------------------------------------------------------------
sub getCallNumber {
    my ($holding) = @_;

    my $callNumber =
        $holding->subfield('k') . ' '
      . $holding->subfield('h') . ' '
      . $holding->subfield('i') . ' '
      . $holding->subfield('m');
    $callNumber =~ s/ +/ /g;
    $callNumber =~ s/(^ | $)//g;

    ($callNumber) || ( $callNumber = '' );

    return $callNumber;
}

#---------------------------------------------------------------
sub mc21_importItemType {
    my ( $dbh, $f852 ) = @_;

    my $sth;
    my $typeId = $f852->subfield('3');
    unless ($typeId) {
        $typeId = $f852->subfield('k');
        if ($typeId) {
            $f852->add_subfields( '3' => $typeId );
        }
    }
    if ($typeId) {
        mxml_addItemType( $dbh, $typeId );
    }
    else {
        my $defaultType = 0;
        ( $typeId, $defaultType ) = $dbh->selectrow_array(<<_SQL_);
select  id, defaultType
from    opl_itemType t left outer join opl_item i on i.typeId = t.id 
group by typeId 
order by defaultType desc, count(barcode) desc 
limit 1
_SQL_
        if ( !$defaultType ) {
            my $sql = <<_SQL_;
update  opl_itemType
set     defaultType = 1
where   id = ?
_SQL_
            $dbh->do( $sql, undef, $typeId );
        }

        $f852->add_subfields( '3' => $typeId );
    }

    return ( $f852, $typeId );
}

#---------------------------------------------------------------
sub autoMerge {
    my ( $dbh, $marc, $import, $unionImport, $sth_cMerged ) = @_;

    my $holding_op = $import->{'holding_op'};
    my $sth        = $dbh->prepare(<<_STH_);
update  opl_marcImport
set     countMergedHolding = countMergedHolding + 1,
        dateImport = now()
where   iid = $import->{'iid'}
_STH_

    # First, merge record by barcode
    my $barcode;
    my $identifier = '';
    foreach my $h ( $marc->field('852') ) {
        $barcode = $h->subfield('p') || next;

        my $r = getRecordByBarCode( $dbh, $barcode );
        if ($r) {
            $identifier = 'barcode';
            if ( isMergeable( $dbh, $r, $marc, $import->{'mergeMode'}, 
                    $identifier ) ) {
                if ( $holding_op eq 'update' ) {
                    $r = updateHolding( $dbh, $r, $h, $unionImport );
                }

                #Tue, Feb 08, 2011 @ 14:20:35 EST
                my @f = ($h);
                $marc->delete_fields(@f);

                $r = updateRecord( $dbh, $r, $marc, $import );

                my @f005 = $r->field('005');
                $r->delete_fields(@f005);
                my @fields = $r->fields();
                my $fRequired = MARC::Field->new( '005', date_f005() );
                $r->insert_fields_after( $fields[0], $fRequired );

                writeToFile( marc => $r, dbh => $dbh );
                $marc->delete_fields($h);
                $sth->execute();
            }

            #else:
            # if unmergeable, skip it. Holding will be imported as a duplicate
            # later
        }
        else {

            # delete current holding in SQL database.
            purgeHolding( $dbh, $barcode );
        }
    }

    $sth->finish;

    if ( !$marc->field('852') ) {
        $sth_cMerged->execute();
        return;
    }

    my $ridGroups = srch_getIdenticalRIDs( $dbh, $marc );
    if ($ridGroups) {
        my $rv = mergeRecord( $dbh, $ridGroups, $marc, $import, $unionImport,$identifier );
        if ( $rv == 1 ) {
            $sth_cMerged->execute();
            return;
        }
        elsif ( $rv == 2 ) {
            mc21_addListDuplicate( $dbh, $import->{'iid'}, $marc );
            return;
        }
    }
    return $marc;
}

#---------------------------------------------------------------
sub getRecordByRid {
    my ($rid) = @_;

    my $xml = util_getXmlRecord($rid) || return;
    my $marc = Opals::Marc::Record::newFromXml($xml);

    return $marc;
}

#---------------------------------------------------------------
sub getRecordByBarCode {
    my ( $dbh, $barcode ) = @_;

    my $sql = <<_SQL_;
select  rid
from    opl_item
where   barcode = ?
_SQL_
    my ($rid) = $dbh->selectrow_array( $sql, undef, $barcode );

    if ( !$rid ) {
        return;
    }

    return getRecordByRid($rid);
}

#---------------------------------------------------------------
# Tue, Dec 04, 2012 @ 11:54:20 EST
# ctho:
# - ebook import merge is in strict mode.
# - records merge only if record types are the same and neither has any 007s.
# - $identifier: 'barcode' or anything not 'barcode'.
sub isMergeable {
    my ( $dbh, $rec1, $rec2, $mergeMode, $identifier ) = @_;
  
    # Mon, Apr 03, 2017 @ 11:55:01 EDT
    # always mergeable if it's re-import  && identifier is barcode
    #
    return 1 if( $mergeMode eq 're-import' && $identifier eq 'barcode');

    if ( $mergeMode eq 'strict' || $identifier ne 'barcode' ) {
        my $recType_1 = _getRecType($rec1);
        my $recType_2 = _getRecType($rec2);

        if ($mergeMode eq 'strict' || 
            $recType_1 eq 'ebook' || 
            $recType_2 eq 'ebook') {
            if ($recType_1 ne $recType_2) {
                return;
            }
        }

        # Check fields 007
        if ($mergeMode eq 'strict') {
            foreach my $r ( $rec1, $rec2 ) {
                return if $r->field('007');
            }
        }
    }

    # Compare title (case-insensitive)
    my $title1 = lc( util_removeChar( $rec1->subfield( '245', 'a' ) ) );
    my $title2 = lc( util_removeChar( $rec2->subfield( '245', 'a' ) ) );

    ($title1) = $dbh->selectrow_array( 'select ?', undef, $title1 );
    ($title2) = $dbh->selectrow_array( 'select ?', undef, $title2 );

    if ( $title1 ne $title2 ) {
        return;
    }

    return 1;
}
#---------------------------------------------------------------
sub unionExportFilter{
    my($dbh,%unionImport)=@_;
    my $autoUpdateUnion = Opals::Context->preference('autoUpdateUnion');
    if($autoUpdateUnion ne '1'){
        return ();
    }
    my $unionExpExclTypeStr = Opals::Context->preference('unionExportExcludeTypes');
    my $unionExpExclType={};
    foreach my $type(split(/,/,$unionExpExclTypeStr)){
       $unionExpExclType->{$type}=1;
    }

    my $sth=$dbh->prepare("select recFormat from opl_marcRecord where rid=?");
    foreach my $rid(keys %unionImport){
        $sth->execute($rid);
        if(my ($recType)= $sth->fetchrow_array){
            if($unionExpExclType->{$recType}){
                delete $unionImport{$rid};
            }
        }
    }
    return %unionImport;
}
#---------------------------------------------------------------
#sub isMergeable {
#    my ( $dbh, $rec1, $rec2, $mergeMode ) = @_;
#
## Wed, Jul 04, 2012 @ 16:16:53 EDT
## if 2 records have different type and one of them is ebook, then they are not mergeable
##
#    my $recType_1 = _getRecType($rec1);
#    my $recType_2 = _getRecType($rec2);
#    if ( $recType_1 ne $recType_2
#        && ( $recType_1 eq 'ebook' || $recType_2 eq 'ebook' ) ) {
#        return 0;
#    }
## END Wed, Jul 04, 2012 @ 16:16:53 EDT
#
#    if ( $mergeMode eq 'strict' ) {
#        # Check record type and fields 007
#        my $bookTypes = 'at';
#        foreach my $r ( $rec1, $rec2 ) {
#            my $type = substr( $r->leader(), 6, 1 );
#            if ( $bookTypes !~ m/$type/ || $r->field('007') ) {
#                return;
#            }
#        }
#    }
#
#    # Compare title (case-insensitive)
#    my $title1 = lc( util_removeChar( $rec1->subfield( '245', 'a' ) ) );
#    my $title2 = lc( util_removeChar( $rec2->subfield( '245', 'a' ) ) );
#
#    ($title1) = $dbh->selectrow_array( 'select ?', undef, $title1 );
#    ($title2) = $dbh->selectrow_array( 'select ?', undef, $title2 );
#
#    if ( $title1 ne $title2 ) {
#        return;
#    }
#
#    return 1;
#}

#---------------------------------------------------------------
sub _getRecType {
    my ($marc) = @_;
    my ( $leader, $cf006, $cf007, $cf008 ) = ( '', '', '', '' );
    if ( $marc->leader ) {
        $leader = $marc->leader;
    }
    if ( $marc->field('006') ) {
        my @f = $marc->field('006');
        $cf006 = $f[0]->data();
    }
    if ( $marc->field('007') ) {
        my @f = $marc->field('007');
        $cf007 = $f[0]->data();
    }
    if ( $marc->field('008') ) {
        my @f = $marc->field('008');
        $cf008 = $f[0]->data();
    }
    return srch_getRecType( $leader, $cf006, $cf007, $cf008 );

}

#---------------------------------------------------------------
sub _updateMarc2Ebook {
    my ($marc) = @_;
    if ( $marc->leader && length( $marc->leader ) > 8 ) {
        my $ldr = $marc->leader;
        substr( $ldr, 6, 2 ) = "am";
        $marc->leader($ldr);
    }
    my $cf_006 = "m               ";
    if ( $marc->field('006') ) {
        my @f      = $marc->field('006');
        my $cf_006 = $f[0]->data();
        substr( $cf_006, 0, 1 ) = 'm';
        $marc->delete_fields(@f);
    }
    my $cf = MARC::Field->new( '006', $cf_006 );

    $marc->insert_fields_ordered( ($cf) );

    my $cf_007 = "cr      ";
    if ( $marc->field('007') ) {
        my @f      = $marc->field('007');
        my $cf_007 = $f[0]->data();
        substr( $cf_007, 0, 2 ) = 'cr';
        $marc->delete_fields(@f);
    }
    $cf = MARC::Field->new( '007', $cf_007 );
    $marc->insert_fields_ordered( ($cf) );

    if ( $marc->field('008') ) {
        my @f     = $marc->field('008');
        my $cf008 = $f[0]->data();
        substr( $cf008, 23, 1 ) = 's';
        $f[0]->update($cf008);
    }

    return $marc;
}

#---------------------------------------------------------------
sub updateHolding {
    my ( $dbh, $rec, $holding, $unionImport ) = @_;

    my $barcode = $holding->subfield('p');
    if ( !$barcode ) {
        return $rec;
    }

    my @holdings = $rec->field('852');

    foreach my $h (@holdings) {
        if ( $h->subfield('p') ne $barcode ) {
            next;
        }

        my $rid = getRidFromMarc($rec);
        $unionImport->{$rid}->{$barcode} = 1;

        my @f = ($h);
        $rec->delete_fields(@f);

        my $itemType = $h->subfield('3');
        $holding->delete_subfield( code => '3' );
        $holding->add_subfields( '3' => $itemType );

        @f = ($holding);
        $rec->insert_fields_ordered(@f);

        sql_updateHolding( $dbh, $holding );

        last;
    }

    # Should the record be written right away?
    #writeToFile(marc => $rec);

    return $rec;
}

#---------------------------------------------------------------
sub sql_updateHolding {
    my ( $dbh, $holding ) = @_;

    my $sql = <<_SQL_;
update  opl_item
set     callNumber = ?,
        price = ?,
        modDate= now()
where   barcode = ?
_SQL_

    my $barcode = $holding->subfield('p');
    my $price   = $holding->subfield('9');
    ($price) || ( $price = '' );
    my @param = ( getCallNumber($holding), $price, $barcode );
    $dbh->do( $sql, undef, @param );

    #    $sql = <<_SQL_;
    #insert
    #into    opl_itemstatus
    #set     barcode = ?,
    #        ondate = now(),
    #        status = ?,
    #        note = 'merged'
    #_SQL_
    #    my $status = 1;#ITEM_ACTIVE; #Opals::Constant
    #    @param = ($barcode, $status);
    #    $dbh->do($sql, undef, @param);
    #my $status = 1;    #ITEM_ACTIVE
    my ($status)=$dbh->selectrow_array("select status from opl_itemstatus 
                                        where barcode=? && (note is null || note not  regexp 'merged|purge')  
                                        order by id desc limit 1",undef,$barcode);
    $status=1 if(!defined $status);
    mxml_updateItemStatus( $dbh, $barcode, $status, 'merged' );

    sql_saveHoldingInfo( $dbh, $holding );
}

#---------------------------------------------------------------
sub sql_saveHoldingInfo {
    my ( $dbh, $holding ) = @_;

    my $barcode = $holding->subfield('p');
    my $prefix = $holding->subfield('k') || "";
    # Save holding data into database
    my $sql = <<_STH_;
delete from opl_itemInfo
where   barcode = ?
_STH_
    my @param = ($barcode);
    $dbh->do( $sql, undef, @param );

    my $sth = $dbh->prepare(<<_STH_);
insert into opl_itemInfo
set     barcode    = ?,
        sf852Code  = ?,
        sf852Data  = ?
_STH_

    my $sth_updateItemStats=$dbh->prepare("update opl_itemStats set prefix= ? where barcode=?");
    foreach my $sf ( $holding->subfields ) {

        # Previously, only non-barcode sub-fields are saved.
        #if ($sf->[0] && $sf->[0] ne 'p' && $sf->[1]) {
        #}
        $sth->execute( $barcode, $sf->[0], $sf->[1] );
    }

    $sth_updateItemStats->execute($prefix,$barcode);
    $sth->finish;
    $sth_updateItemStats->finish;
}

#---------------------------------------------------------------
sub updateRecord {
    my ( $dbh, $target, $new_record, $import ) = @_;

    my @new_fields;

    # Getting list of ISBNs from both records
    my $f020s            = get_f020($target);
    my $f020s_new_record = get_f020($new_record);
    foreach my $isbn ( keys %{$f020s_new_record} ) {
        $f020s->{$isbn} = $f020s_new_record->{$isbn};
    }

    if ($import->{'mergeMode'} eq 're-import' #Mon, Apr 18, 2016 @ 12:11:13 EDT
        || computeScore($new_record) >= computeScore($target) ) {
        my $f001     = $target->field('001');
        my @holdings = $target->field('852');

        # Deleting all fields
        my @fields = $target->fields();
        $target->delete_fields(@fields);

        # Adding all fields from new record excepts 852
        #@fields = $new_record->field('852');
        #$new_record->delete_fields(@fields);
        @fields = $new_record->fields();
        my @no852=();
        foreach my $f(@fields){
            if($f->tag() ne '852'){
               push @no852,$f;
            }
        }
        $target->insert_fields_ordered(@no852);

        # Then removing new field 001
        @new_fields = $target->field('001');
        $target->delete_fields(@new_fields);

        # and all new holdings
        # Tue, Feb 08, 2011 @ 14:02:50 EST
        #@new_fields = $target->field('852');
        #$target->delete_fields(@new_fields);

        # Adding back fields 001 and holdings
        $target->insert_fields_ordered($f001);
        $target->insert_fields_ordered(@holdings);

        # Should the record be written right away?
        #writeToFile(marc => $target);
    }

    # Removing all ISBNs
    @new_fields = $target->field('020');
    $target->delete_fields(@new_fields);

    # Adding back list of merged ISBNs
    my @isbns;
    foreach my $isbn ( keys %{$f020s} ) {
        push @isbns, $f020s->{$isbn};
    }
    $target->insert_fields_ordered(@isbns);

    # Saving to SQL database
    sql_saveRecord( $dbh, $target, $import );

    return $target;
}

#---------------------------------------------------------------
sub getRidFromMarc {
    my ($marc) = @_;

    if ( !$marc ) {
        return;
    }

    my $f001 = $marc->field('001');
    if ( !$f001 ) {
        return;
    }

    return $f001->data();
}

#---------------------------------------------------------------
sub sql_saveRecord {
    my ( $dbh, $marc, $import ) = @_;

    my $rid = getRidFromMarc($marc) || return;

    # Saving to SQL database
    sql_saveRecordInfo( $dbh, $marc );
    mxml_saveRecordIdentifier( $dbh, $marc );

    my ( $xml, $cFixed );
    $xml = MARC::File::XML::record($marc);
    $xml = util_filterMarcXml($xml);

    # Fix record
    #( $xml, $cFixed ) = mxml_fixXmlRecord($xml);

    #add subjects to SQL database
    #mxml_updateSubjectsList( $dbh, undef, $xml );

    # add record data to SQL database
    #mxml_updateRecordIndex( $dbh, $rid, $xml );

    #Wed, Nov 25, 2009 @ 12:19:42 EST
    #add ARL info to database
    #mxml_updateARIndex( $dbh, $rid, $xml );

    # Thu, Feb 26, 2009 @ 09:00:53 EST
    # add record to new item list
    if ( $import->{'addToNewItemList'} ) {
        mxml_newItem( $dbh, $rid, $import->{'newItemExpDate'} );
    }
}

#---------------------------------------------------------------
sub get_f020 {
    my ($marc) = @_;

    my ( $f020s, $isbn_obj, $isbn13, $data );
    foreach my $f ( $marc->field('020') ) {
        $data = $f->subfield('a');
        $data =~ s/[\- ]+//g;
        if ( $data =~ m/(^|[\D])((\d{3})?\d{9}[0-9xX])([\D]|$)/ ) {
            $data = $2;

            #print "ISBN: $data\n";
        }
        else {
            next;
        }

        $isbn_obj = Business::ISBN->new($data) || next;
        if($isbn_obj->is_valid()){
            $isbn_obj->fix_checksum;
            $isbn13         = $isbn_obj->as_isbn13;
            $data           = $isbn13->as_string( [] );
        }
        $f020s->{$data} = $f;
    }

    return $f020s;
}

#---------------------------------------------------------------
sub purgeHolding {
    my ( $dbh, $barcode ) = @_;

    my ($uuid)    = $dbh->selectrow_array("select uuid()");
    my $purged_bc = 'PURGED_' . $barcode . '_' . $uuid;
    my $sql       = <<_SQL_;
update  opl_item
set     barcode = ?,
        available = 0
where   barcode = ?
_SQL_
    my @param = ( $purged_bc, $barcode );
    $dbh->do( $sql, undef, @param );

    $sql = <<_SQL_;
update  opl_itemInfo
set     barcode = ?
where   barcode = ?
_SQL_
    $dbh->do( $sql, undef, @param );

    #    $sql = <<_SQL_;
    #insert
    #into    opl_itemstatus
    #set     barcode = ?,
    #        ondate = now(),
    #        status = ?,
    #        note = ?
    #_SQL_
    #    my $status = 7;#ITEM_PURGED; #Opals::Constant
    #    @param = ($purged_bc, $status, $barcode);
    #    $dbh->do($sql, undef, @param);

    #   above section replaced by function call below.
    my $status = 7;    #ITEM_PURGED;
    mxml_updateItemStatus( $dbh, $purged_bc, $status, $barcode );
}

#
#
#sub getIdentifiers {
#    my ($marc, $tag, $code) = @_;
#
#    my ($sfData, $data, $isbn_obj, $isbn13);
#    my @fields = $marc->field($tag);
#    foreach my $f (@fields) {
#        $data = $f->subfield($code);
#        if ($data) {
#            if ($tag eq '020' && $code eq 'a') {
#                $isbn_obj = Business::ISBN->new($data) || next;
#                $isbn13 = $isbn_obj->as_isbn13;
#                $data = $isbn13->as_string([]);
#            }
#            elsif ($tag eq '035' && $code eq 'a' &&
#                    $data !~ m/^\(OCoLC\)[1-9]/) {
#                next;
#            }
#
#            $sfData->{$data} = 1;
#        }
#    }
#
#    if (scalar(keys %{$sfData}) == 0) {
#        return;
#    }
#
#    return $sfData;
#}
#
#
#sub getIdenticalRIDs {
#    my ($dbh, $marc) = @_;
#
#    my $ridGroups;
#    my ($tag, $code);
#    foreach my $id (@Opals::Search::RECORD_IDENTIFIERS) {
#        $tag = $id->{'tag'};
#        $code = $id->{'code'};
#
#        my $sf_data = getIdentifiers($marc, $tag, $code) || next;
#
#        my $dataList = join(',', keys %{$sf_data});
#        $dataList =~ s/,/','/g;
#        $dataList =~ s/(^|$)/'/g;
#        my $sql = <<_SQL_;
#select  distinct rid
#from    opl_recordIdentifier
#where   tag = '$tag'
#     && code = '$code'
#     && data in ($dataList)
#_SQL_
#        $ridGroups->{$tag . $code} =
#                $dbh->selectall_arrayref($sql, {Slice => {}});
#    }
#
#    return $ridGroups;
#}

=item
return value:
 - 0: un-mergeable and no duplicate identifier
 - 1: merged
 - 2: un-mergeable and has duplicate identifier
=cut

sub mergeRecord {
    my ( $dbh, $ridGroups, $marc, $import, $unionImport,$identifier ) = @_;

    my $hasDuplicateIdentifier = 0;

    if ( !$ridGroups ) {
        return $hasDuplicateIdentifier;
    }

    my $rid;
    #my $identifier = '';
    foreach my $id (@Opals::Search::RECORD_IDENTIFIERS) {
        my $sf = $id->{'tag'} . $id->{'code'};

        foreach my $row ( @{ $ridGroups->{$sf} } ) {
            $rid = $row->{'rid'};
            my $rec = getRecordByRid($rid);

            if ( !$rec || !$rec->fields() || scalar( $rec->fields() ) == 0 ) {
                next;
            }

            if ( !isMergeable( $dbh, $rec, $marc, $import->{'mergeMode'}, 
                        $identifier ) ) {
                my $recType_1 = _getRecType($rec);
                my $recType_2 = _getRecType($marc);
                if ( $recType_1 ne 'ebook' && $recType_2 ne 'ebook' ) {
                    $hasDuplicateIdentifier = 2;
                }
                next;
            }

            # Importing holdings first
            foreach my $f852 ( $marc->field('852') ) {
                if ( !$f852->subfield('p') ) {
                    my $barcode = bcm_getNextPendingBc_import( $dbh, $import->{'iid'} );
                    if($barcode && $barcode ne ''){
                        $barcode = uc($barcode);
                        $f852->update( 'p' => $barcode );
                    }
                    else{
                        $marc->delete_fields($f852);
                        next;
                    }
                }

                my $f852_new =
                  mc21_importItem( $dbh, $rid, $f852, $import->{'iid'} );
                if ($f852_new) {
                    $rec->insert_fields_ordered($f852_new);
                    $marc->delete_fields($f852);
                    $unionImport->{$rid}->{ $f852_new->subfield('p') } = 1;
                }
            }

            # then merging bibliographic record.
            $rec = updateRecord( $dbh, $rec, $marc, $import );
            writeToFile( marc => $rec, dbh => $dbh );

            return 1;
        }
    }

    return $hasDuplicateIdentifier;
}

#sub addRecord {
#    my ($marc) = @_;
#}

#---------------------------------------------------------------
sub computeScore {
    my ($marc) = @_;
    my $scoreTbl = [
        { tag => '260', sfCode => 'a', score      => 1, repeatable => 0 },
        { tag => '260', sfCode => 'b', score      => 1, repeatable => 0 },
        { tag => '260', sfCode => 'c', score      => 1, repeatable => 0 },
        { tag => '300', sfCode => 'a', score      => 1, repeatable => 0 },
        { tag => '500', score  => 15,  repeatable => 1 },
        { tag => '504', score  => 15,  repeatable => 1 },
        { tag => '505', score  => 15,  repeatable => 1 },
        { tag => '520', score  => 15,  repeatable => 1 },
        { tag => '521', score  => 10,  repeatable => 1 },
        { tag => '526', score  => 10,  repeatable => 1 },
        { tag => '600', score  => 4,   repeatable => 1 },
        { tag => '610', score  => 4,   repeatable => 1 },
        { tag => '611', score  => 4,   repeatable => 1 },
        { tag => '630', score  => 4,   repeatable => 1 },
        { tag => '648', score  => 4,   repeatable => 1 },
        { tag => '650', score  => 4,   repeatable => 1 },
        { tag => '651', score  => 4,   repeatable => 1 },
        { tag => '653', score  => 4,   repeatable => 1 },
        { tag => '654', score  => 4,   repeatable => 1 },
        { tag => '655', score  => 4,   repeatable => 1 },
        { tag => '656', score  => 4,   repeatable => 1 },
        { tag => '657', score  => 4,   repeatable => 1 },
        { tag => '658', score  => 4,   repeatable => 1 },
        { tag => '662', score  => 4,   repeatable => 1 },
        { tag => '700', score  => 4,   repeatable => 1 },
        { tag => '856', sfCode => '3', score      => 5, repeatable => 0 },
        { tag => '856', sfCode => 'u', score      => 5, repeatable => 1 }

    ];
    my $score = 0;
    my @fields;
    my @subfields;
    foreach my $row (@$scoreTbl) {
        my $tag = $row->{'tag'};
        @fields = $marc->field($tag);
        my $sfCode = $row->{'sfCode'};
        my $points = $row->{'score'};
        my $rpt    = $row->{'repeatable'};

        foreach my $f (@fields) {
            if ( !defined $sfCode ) {
                $score += $points;
            }
            else {
                @subfields = $f->subfield($sfCode);
                foreach my $sf (@subfields) {
                    $score += $points;
                    last if ( !$rpt );
                }
            }
            last if ( !$rpt );
        }
    }

    return $score;
}

#---------------------------------------------------------------
sub mc21_addListDuplicate {
    my ( $dbh, $iid, $marc ) = @_;

    #
    #    my $criteria = srch_identicalCriteria($marc);
    #    my @recordList = srch_checkLocalDatabase($dbh, $criteria);

    my $pending;

    #    if (scalar(@recordList) > 0) {
    my $xml = MARC::File::XML::record($marc);
    $xml = util_filterMarcXml($xml);

    my $sth = $dbh->prepare(<<_STH_);
insert into opl_marcDuplicate
set iid     = ?,
    content = ?
_STH_

    $pending = $sth->execute( $iid, $xml );
    $sth->finish;

    #    }

    #    return ($marc, $pending);
    return $pending;
}

#---------------------------------------------------------------
sub _getExport {
    my ($dbh,$eid) = @_;
    #eType: hitlist| importDateRange | ridRange | modDateRange | all
    # Get export request
    my $req = mc21_getExport($dbh,$eid);
    return unless $req;
    my $eid      = $req->{'eid'};
    my $expParams= decode_json($req->{'expParams'});
    #$exportHoldingOpt : 0 all holding, 1 selected holding only.
    my $exportHoldingOpt=$expParams->{'eCriteria'}->{'exportHoldingOpt'}|| 0;
    my $sql="";
    if(defined $expParams->{'filter'}->{'incItemType'} && scalar(@{$expParams->{'filter'}->{'incItemType'}})>0){
        $exportHoldingOpt=1;
    }
    #import
    if($expParams->{'type'} eq  'importDateRange'){
        $sql="select  i.rid,i.barcode,i.typeId,m.recFormat
             from    opl_item i inner join opl_marcRecord m using(rid)
             where   dateImport between \"$expParams->{'eCriteria'}->{'from'}\" and 
                                 date_add(\"$expParams->{'eCriteria'}->{'to'}\", interval 1 day) &&
                     barcode not regexp '^\_\_\_'" ;
     }
    #modDate
    elsif($expParams->{'type'} eq  'modDateRange'){
        $sql="select  i.rid,i.barcode,i.typeId,m.recFormat
             from     opl_item i inner join opl_marcRecord m using(rid)
             where    barcode not regexp '^\_\_\_' &&
                      m.modDate between \"$expParams->{'eCriteria'}->{'from'}\" and 
                                 date_add(\"$expParams->{'eCriteria'}->{'to'}\}, interval 1 day)" ;
    }
    #RID range                     
    elsif($expParams->{'type'} eq  'ridRange'){
        $sql="select  i.rid,i.barcode,i.typeId,m.recFormat
             from    opl_item i inner join opl_marcRecord m using(rid)
             where   i.rid between $expParams->{'eCriteria'}->{'from'} and $expParams->{'eCriteria'}->{'to'} &&
                     barcode not regexp '^\_\_\_'" ;

    }
    #hitlist
    elsif($expParams->{'type'} eq  'hitlist'){
       $sql="select  i.rid,i.barcode,i.typeId,m.recFormat 
             from    opl_item i inner join opl_ridBcdHitlistExport h using(barcode)
                     inner join opl_marcRecord m on m.rid=h.rid 
             where   eid = $eid";

       if($exportHoldingOpt && $expParams->{'eCriteria'}->{'from'} && $expParams->{'eCriteria'}->{'to'}){
            $sql .= " && i.modDate between \"$expParams->{'eCriteria'}->{'from'}\" and 
                                 date_add(\"$expParams->{'eCriteria'}->{'to'}\", interval 1 day)";
     }

    }
    #entire collection
    else{
        $sql="select  i.rid,i.barcode,i.typeId,m.recFormat
             from    opl_item i inner join opl_marcRecord m using(rid)
             where   barcode not regexp '^\_\_\_'" ;

    }

    #exclRecFormat| incItemType
    my $exclRecFormat={};
    foreach my $type(@{$expParams->{'filter'}->{'exclRecFormat'}}){
        $exclRecFormat->{$type}=1;
    }
    my $incItemType=undef;
    foreach my $type(@{$expParams->{'filter'}->{'incItemType'}}){
        $incItemType->{$type}=1;
    }
    my $export={eid=>$eid,
                exportHoldingOpt=>$exportHoldingOpt,
                ridList=>{}
                };
    my $sth = $dbh->prepare($sql);
    $sth->execute();
    my $ridList={};
    while ( my $h = $sth->fetchrow_hashref ) {
        next if($exclRecFormat->{$h->{'recFormat'}});#filter out rec. media format
        if(!defined $incItemType || defined $incItemType->{$h->{'typeId'}}){
            $ridList->{ $h->{'rid'} }->{ $h->{'barcode'} } = 1;
        }
    }
    $sth->finish;
    $export->{'ridList'}=$ridList;
    return  $export;


}
#---------------------------------------------------------------
sub getExportPath{
    my $db_name = Opals::Context->config('db_name');
    my $imex    = Opals::Context->config('imex');
    my $exDir   = "$imex/export/$db_name";
    my $jBin    = `grep ^jBin /etc/opals/opalsrc | sed -re 's/^jBin=//'`;
    chomp $jBin;
    return $exDir;
}

#---------------------------------------------------------------
sub mc21_export {
    my ($dbh,$eid) = @_;
    my $zRoot     = Opals::Context->config('zRoot');
    my $zPort     = Opals::Context->config('zPort');
    my $zDatabase = Opals::Context->config('zDatabase');
    my $db_name = Opals::Context->config('db_name');
    my $imex    = Opals::Context->config('imex');
    my $exDir   = "$imex/export/$db_name";
    my $jBin    = `grep ^jBin /etc/opals/opalsrc | sed -re 's/^jBin=//'`;
    chomp $jBin;

    my $export =_getExport($dbh,$eid);
    return unless $export;
    my $eid = $export->{'eid'};
    my $exportHoldingOpt=$export->{'exportHoldingOpt'};
    my $ridList=$export->{'ridList'};


    my ( $in, $out,$log ) = ( "$exDir/$eid.xml", "$exDir/$eid.mrc","$exDir/$eid-e.log" );
    open XML, ">$in";
    open LOG,">$log";
    print XML "<collection>\n";
    my $xmlParser=XML::Parser->new();
    my ( $xml, $cFixed );
    my ( $cRecord, $cHolding, $cFixedRec ) = ( 0, 0, 0 );
    foreach my $rid ( sort keys %{$ridList} ) {
        my $dir = "$zRoot/$zPort/record/$zDatabase/" . ceil($rid/1000);
        ( $xml, $cFixed ) = mxml_exportRecord( $zRoot, $zPort, $zDatabase, $rid );
        my $rs=eval {
            $xmlParser->parsefile("$dir/$rid.xml");#validate $xml
            $cHolding += keys %{$ridList->{$rid}} ;
            $xml = mxml_exportHolding( $xml, $ridList->{$rid} ) if($exportHoldingOpt);
            $cRecord++;
            $cFixedRec++ if($cFixed);
            print XML $xml;
        };
        unless($rs){
            print LOG "$rid\n";
        }
    }
    print XML "\n<\/collection>\n";
    close XML;
my $eEncoding="UTF-8";
 if ($cRecord) {
        my $rootDir = Opals::Context->config('rootDir');

        ( $eEncoding eq 'UTF-8' ) || ( $eEncoding = 'ISO-8859-1' );

        system(
"LANG=en_US.UTF-8 $jBin/java -jar $rootDir/java/mconv.jar -e UTF-8 -g $eEncoding -s MARCXML -x MARC21 -i $in -o $out > $exDir/../export.log 2>&1"
        );
        chmod 0644, "$out";
    }

    $dbh->do(<<_STH_);
update  opl_marcExport
set     status = 'ready',
        dateFinish = now(),
        cRecord = $cRecord,
        cHolding = $cHolding,
        cFixedRec = $cFixedRec
where   eid = $eid
_STH_

    #open debug,">/tmp/aa22";print debug "[$eid] \n"; close debug;
}
#---------------------------------------------------------------
sub mc21_export_1 {
    my ($dbh) = @_;

    # Get export request
    my $request = mc21_getExport($dbh);
    return unless $request;

    #  $eRidList: added on 2007-09-12 for exporting records from list of rid
    my $eid             = $request->{'eid'};
    my $eType           = $request->{'eType'};
    my $eFrom           = $request->{'eFrom'};
    my $eTo             = $request->{'eTo'};
    my $eEncoding       = $request->{'eEncoding'};
    my $eRidList        = $request->{'ridList'};
       $eRidList        =~ s/\s//g;
       $eRidList        =~ s/,+/,/g;
       $eRidList        =~ s/^,|,$//g;
    my $exclRecFormat   = $request->{'exclRecFormat'};

    if ( $eType =~ m/^ridList_(r|h)$/ && !$request->{'ridList'} ) {
        $dbh->do(<<_STH_);
update  opl_marcExport
set     status = 'ready',
        dateFinish = now()
where   eid = $eid
_STH_

        return;
    }

    my $zRoot     = Opals::Context->config('zRoot');
    my $zPort     = Opals::Context->config('zPort');
    my $zDatabase = Opals::Context->config('zDatabase');

    my $db_name = Opals::Context->config('db_name');
    my $imex    = Opals::Context->config('imex');
    my $exDir   = "$imex/export/$db_name";
    my $jBin    = `grep ^jBin /etc/opals/opalsrc | sed -re 's/^jBin=//'`;
    my $rootDir = Opals::Context->config('rootDir');
    my ( $in, $out ) = ( "$exDir/$eid.xml", "$exDir/$eid.mrc" );

    chomp $jBin;

    #    # Clean up first: delete expired exports
    #    mc21_deleteExpiredExport($dbh, $exDir);

    $dbh->do(<<_STH_);
update  opl_marcExport
set     status = 'processing'
where   eid = $eid
_STH_

    my $query;
    if ( $eType eq 'date' ) {
        $query = <<_STH_;
select  i.rid, barcode,m.recFormat
from    opl_item i inner join opl_marcRecord m using(rid)
where   dateImport >= date(?) && 
        dateImport <= date_add(?, interval 1 day) &&
        barcode not regexp '^\_\_\_'
_STH_
    }
    elsif ( $eType eq 'modDate_r' ) {
        $query = <<_STH_;
select  i.rid, i.barcode,m.recFormat
from    opl_marcRecord m  inner join opl_item i on i.rid=m.rid
where   m.modDate >= date(?) && 
        m.modDate <= date_add(?, interval 1 day) &&
        barcode not regexp '^\_\_\_'
_STH_
    }

    elsif ( $eType eq 'modDate_h' ) {
        $query = <<_STH_;
select  i.rid, barcode ,m.recFormat
from    opl_item i inner join opl_marcRecord m using(rid)
where   i.modDate >= date(?) && 
        i.modDate <= date_add(?, interval 1 day) &&
        barcode not regexp '^\_\_\_'
_STH_
    }

    elsif ( $eType eq 'ridList_r' ) {
        $query = <<_STH_;
select  i.rid, barcode ,m.recFormat
from    opl_item  i inner join opl_marcRecord m using(rid)
where   i.rid in ($eRidList) && 
        barcode not regexp '^\_\_\_'
_STH_

    }

    elsif ( $eType eq 'ridList_h' ) {
        $query = <<_STH_;
select  i.rid, barcode ,m.recFormat
from    opl_item  i inner join opl_marcRecord m using(rid)
where   i.rid in ($eRidList) &&
        i.modDate >= date(?) &&
        i.modDate <= date_add(?, interval 1 day) &&
        barcode not regexp '^\_\_\_'
_STH_

    }

    elsif ( $eType =~ m/^rid$/i ) {
        $query = <<_STH_;
select  i.rid, barcode ,m.recFormat
from    opl_item  i inner join opl_marcRecord m using(rid)
where   i.rid >= ? && 
        i.rid <= ? &&
        barcode not regexp '^\_\_\_'
_STH_
    }
    elsif ( $eType eq 'hitlist' ) {
        $query = <<_STH_;
select  rid, barcode 
from    opl_ridBcdHitlistExport 
where   eid = $eid 

_STH_

    }
    else {    # export all records, all holdings
        $query = <<_STH_;
select  i.rid, barcode, m.recFormat
from    opl_item  i inner join opl_marcRecord m using(rid)
where   barcode not regexp '^\_\_\_' 
        && (m.tempIll is null || (incomplete='false' && tempIll<> 'temporary' && tempIll<> 'ILL') ) 
_STH_
    }

    my $sth = $dbh->prepare($query);
    if (   $eType eq 'date'
        || $eType eq 'rid'
        || $eType eq 'modDate_r'
        || $eType eq 'modDate_h'
        || $eType eq 'ridList_h' )
    {
        $sth->execute( $eFrom, $eTo ) || return;
    }
    elsif ( $eType eq 'ridList_r' ) {
        $sth->execute() || return;
    }
    else {
        $sth->execute() || return;
    }

    my $exclRecFormat_hash={};
    foreach my $type(split(/,/,$exclRecFormat)){
        $exclRecFormat_hash->{$type}=1;
    }

    my $export;
    while ( my $h = $sth->fetchrow_hashref ) {
        next if($exclRecFormat_hash->{$h->{'recFormat'}});
        $export->{ $h->{'rid'} }->{ $h->{'barcode'} } = 1;
    }
    $sth->finish;

    open XML, ">$exDir/$eid.xml";

    my ( $xml, $cFixed );
    my ( $cRecord, $cHolding, $cFixedRec ) = ( 0, 0, 0 );

    my $writeMode;
    print XML "<collection>\n";
    foreach my $rid ( sort keys %{$export} ) {
        print "$rid\n";
        ( $xml, $cFixed ) =
          mxml_exportRecord( $zRoot, $zPort, $zDatabase, $rid );
        next if ( !$xml );

        if (   $eType eq 'date'
            || $eType eq 'modDate_h'
            || $eType eq 'hitlist'
            || $eType eq 'ridList_h' )
        {
            $xml = mxml_exportHolding( $xml, $export->{$rid} );
        }
        $cRecord++;
        $cHolding += scalar( keys %{ $export->{$rid} } );
        if ($cFixed) {
            $cFixedRec++;

            #print "RID fixed: $rid\n";
        }
        print XML $xml;

        #print XML decode('utf8', $xml), "\n";
    }

    #    my $c = sprintf("%0.10d", $cRecord);
    #    print XML "<\/collection><!--$c-->";
    print XML "\n<\/collection>\n";
    close XML;

    if ($cRecord) {
        my $rootDir = Opals::Context->config('rootDir');

        ( $eEncoding eq 'UTF-8' ) || ( $eEncoding = 'ISO-8859-1' );

        system(
"LANG=en_US.UTF-8 $jBin/java -jar $rootDir/java/mconv.jar -e UTF-8 -g $eEncoding -s MARCXML -x MARC21 -i $exDir/$eid.xml -o $exDir/$eid.mrc > $exDir/../export.log 2>&1"
        );
        chmod 0644, "$exDir/$eid.mrc";
    }

    $dbh->do(<<_STH_);
update  opl_marcExport
set     status = 'ready',
        dateFinish = now(),
        cRecord = $cRecord,
        cHolding = $cHolding,
        cFixedRec = $cFixedRec
where   eid = $eid
_STH_
}

#sub mc21_deleteExpiredExport {
#    my ($dbh, $exDir) = @_;
#
#    my $sth = $dbh->prepare(<<_STH_);
#select  to_days(dateExpiry) - to_days(now())
#from    opl_marcExport
#where   eid = ?
#_STH_
#
#    my ($eid, $deltaExpiry);
#    open EID, "ls $exDir/*.mrc | ";
#    while (<EID>) {
#        $eid = $_;
#        $eid =~ m/([\d]+)\.mrc$/;
#        $eid = $1;
#        $sth->execute($eid) || last;
#        ($deltaExpiry) = $sth->fetchrow_array;
#        if ($deltaExpiry < 0) {
#            print "Delete $exDir/$eid.mrc\n";
#            unlink "$exDir/$eid.mrc";
#        }
#    }
#    close EID;
#    $sth->finish;
#}

#---------------------------------------------------------------
sub mc21_getExport {
    my ($dbh,$eid) = @_;
    my $export=undef;
    if(defined $eid){
        $export=$dbh->selectrow_hashref("select * from opl_marcExport where eid=$eid");
    }
    else{
        $export=$dbh->selectrow_hashref("select * from opl_marcExport  
                                        where status = 'waiting' && now() < dateExpiry 
                                         order by eid desc limit 1");
    }

    return $export;
}

#---------------------------------------------------------------
sub mc21_format {
    return (
        '001' => {
            'label' => 'CONTROL NUMBER (NR)',
            'rpt'   => 0,
        },
        '003' => {
            'label' => 'CONTROL NUMBER IDENTIFIER (NR)',
            'rpt'   => 0,
        },
        '005' => {
            'label' => 'DATE AND TIME OF LATEST TRANSACTION (NR)',
            'rpt'   => 0,
        },
        '006' => {
            'label' =>
'FIXED-LENGTH DATA ELEMENTS--ADDITIONAL MATERIAL CHARACTERISTICS--GENERAL INFORMATION (R)',
            'rpt' => 1,
        },
        '007' => {
            'label' =>
              'PHYSICAL DESCRIPTION FIXED FIELD--GENERAL INFORMATION (R)',
            'rpt' => 1,
        },
        '008' => {
            'label' => 'FIXED-LENGTH DATA ELEMENTS--GENERAL INFORMATION (NR)',
            'rpt'   => 0,
        },
        '010' => {
            'label' => 'LIBRARY OF CONGRESS CONTROL NUMBER (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '8'     => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'LC control number (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'NUCMC control number (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Canceled/invalid LC control number (R)',
                'rpt'   => 1,
            },
        },
        '013' => {
            'label' => 'PATENT CONTROL INFORMATION (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Number (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Country (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Type of number (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Date (R)',
                'rpt'   => 1,
            },
            'e' => {
                'label' => 'Status (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Party to document (R)',
                'rpt'   => 1,
            },
        },
        '015' => {
            'label' => 'NATIONAL BIBLIOGRAPHY NUMBER (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '2'     => {
                'label' => 'Source (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'National bibliography number (R)',
                'rpt'   => 1,
            },
        },
        '016' => {
            'label' => 'NATIONAL BIBLIOGRAPHIC AGENCY CONTROL NUMBER (R)',
            'rpt'   => 1,
            'ind_1' => 'National bibliographic agency',
            'ind_2' => 'Undefined',
            '2'     => {
                'label' => 'Source (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Record control number (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'Canceled or invalid record control number (R)',
                'rpt'   => 1,
            },
        },
        '017' => {
            'label' => 'COPYRIGHT OR LEGAL DEPOSIT NUMBER (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '2'     => {
                'label' => 'Source (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Copyright registration number (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Assigning agency (NR)',
                'rpt'   => 0,
            },
        },
        '018' => {
            'label' => 'COPYRIGHT ARTICLE-FEE CODE (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Copyright article-fee code (NR)',
                'rpt'   => 0,
            },
        },
        '020' => {
            'label' => 'INTERNATIONAL STANDARD BOOK NUMBER (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'International Standard Book Number (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Terms of availability (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'Canceled/invalid ISBN (R)',
                'rpt'   => 1,
            },
        },
        '022' => {
            'label' => 'INTERNATIONAL STANDARD SERIAL NUMBER (R)',
            'rpt'   => 1,
            'ind_1' => 'Level of international interest',
            'ind_2' => 'Undefined',
            '2'     => {
                'label' => 'Source (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
            'y' => {
                'label' => 'Incorrect ISSN (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Canceled ISSN (R)',
                'rpt'   => 1,
            },
        },
        '024' => {
            'label' => 'OTHER STANDARD IDENTIFIER (R)',
            'rpt'   => 1,
            'ind_1' => 'Type of standard number or code',
            'ind_2' => 'Difference indicator',
            '2'     => {
                'label' => 'Source of number or code (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Standard number or code (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Terms of availability (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' =>
                  'Additional codes following the standard number or code (NR)',
                'rpt' => 0,
            },
            'z' => {
                'label' => 'Canceled/invalid standard number or code (R)',
                'rpt'   => 1,
            },
        },
        '025' => {
            'label' => 'OVERSEAS ACQUISITION NUMBER (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '8'     => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Overseas acquisition number (R)',
                'rpt'   => 1,
            },
        },
        '026' => {
            'label' => 'FINGERPRINT IDENTIFIER (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '2'     => {
                'label' => 'Source (NR)',
                'rpt'   => 0,
            },
            '5' => {
                'label' => 'Institution to which field applies (R)',
                'rpt'   => 1,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'First and second groups of characters (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Third and fourth groups of characters (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Date (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Number of volume or part (R)',
                'rpt'   => 1,
            },
            'e' => {
                'label' => 'Unparsed fingerprint (NR)',
                'rpt'   => 0,
            },
        },
        '027' => {
            'label' => 'STANDARD TECHNICAL REPORT NUMBER (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Standard technical report number (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'Canceled/invalid number (R)',
                'rpt'   => 1,
            },
        },
        '028' => {
            'label' => 'PUBLISHER NUMBER (R)',
            'rpt'   => 1,
            'ind_1' => 'Type of publisher number',
            'ind_2' => 'Note/added entry controller',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Publisher number (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Source (NR)',
                'rpt'   => 0,
            },
        },
        '030' => {
            'label' => 'CODEN DESIGNATION (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'CODEN (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'Canceled/invalid CODEN (R)',
                'rpt'   => 1,
            },
        },
        '032' => {
            'label' => 'POSTAL REGISTRATION NUMBER (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Postal registration number (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Source (agency assigning number) (NR)',
                'rpt'   => 0,
            },
        },
        '033' => {
            'label' => 'DATE/TIME AND PLACE OF AN EVENT (R)',
            'rpt'   => 1,
            'ind_1' => 'Type of date in subfield $a',
            'ind_2' => 'Type of event',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Formatted date/time (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Geographic classification area code (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Geographic classification subarea code (R)',
                'rpt'   => 1,
            },
        },
        '034' => {
            'label' => 'CODED CARTOGRAPHIC MATHEMATICAL DATA (R)',
            'rpt'   => 1,
            'ind_1' => 'Type of scale',
            'ind_2' => 'Type of ring',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Category of scale (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Constant ratio linear horizontal scale (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Constant ratio linear vertical scale (R)',
                'rpt'   => 1,
            },
            'd' => {
                'label' => 'Coordinates--westernmost longitude (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Coordinates--easternmost longitude (NR)',
                'rpt'   => 0,
            },
            'f' => {
                'label' => 'Coordinates--northernmost latitude (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Coordinates--southernmost latitude (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Angular scale (R)',
                'rpt'   => 1,
            },
            'j' => {
                'label' => 'Declination--northern limit (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Declination--southern limit (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Right ascension--eastern limit (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Right ascension--western limit (NR)',
                'rpt'   => 0,
            },
            'p' => {
                'label' => 'Equinox (NR)',
                'rpt'   => 0,
            },
            's' => {
                'label' => 'G-ring latitude (R)',
                'rpt'   => 1,
            },
            't' => {
                'label' => 'G-ring longitude (R)',
                'rpt'   => 1,
            },
        },
        '035' => {
            'label' => 'SYSTEM CONTROL NUMBER (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'System control number (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'Canceled/invalid control number (R)',
                'rpt'   => 1,
            },
        },
        '036' => {
            'label' => 'ORIGINAL STUDY NUMBER FOR COMPUTER DATA FILES (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Original study number (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Source (agency assigning number) (NR)',
                'rpt'   => 0,
            },
        },
        '037' => {
            'label' => 'SOURCE OF ACQUISITION (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Stock number (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Source of stock number/acquisition (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Terms of availability (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Form of issue (R)',
                'rpt'   => 1,
            },
            'g' => {
                'label' => 'Additional format characteristics (R)',
                'rpt'   => 1,
            },
            'n' => {
                'label' => 'Note (R)',
                'rpt'   => 1,
            },
        },
        '038' => {
            'label' => 'RECORD CONTENT LICENSOR (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Record content licensor (NR)',
                'rpt'   => 0,
            },
        },
        '040' => {
            'label' => 'CATALOGING SOURCE (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Original cataloging agency (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Language of cataloging (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Transcribing agency (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Modifying agency (R)',
                'rpt'   => 1,
            },
            'e' => {
                'label' => 'Description conventions (NR)',
                'rpt'   => 0,
            },
        },
        '041' => {
            'label' => 'LANGUAGE CODE (R)',
            'rpt'   => 1,
            'ind_1' => 'Translation indication',
            'ind_2' => 'Source of code',
            '2'     => {
                'label' => 'Source of code (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' =>
                  'Language code of text/sound track or separate title (R)',
                'rpt' => 1,
            },
            'b' => {
                'label' =>
'Language code of summary or abstract/overprinted title or subtitle (R)',
                'rpt' => 1,
            },
            'd' => {
                'label' => 'Language code of sung or spoken text (R)',
                'rpt'   => 1,
            },
            'e' => {
                'label' => 'Language code of librettos (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Language code of table of contents (R)',
                'rpt'   => 1,
            },
            'g' => {
                'label' =>
'Language code of accompanying material other than librettos (R)',
                'rpt' => 1,
            },
            'h' => {
                'label' =>
'Language code of original and/or intermediate translations of text (R)',
                'rpt' => 1,
            },
        },
        '042' => {
            'label' => 'AUTHENTICATION CODE (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            'a'     => {
                'label' => 'Authentication code (R)',
                'rpt'   => 1,
            },
        },
        '043' => {
            'label' => 'GEOGRAPHIC AREA CODE (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '2'     => {
                'label' => 'Source of local code (R)',
                'rpt'   => 1,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Geographic area code (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Local GAC code (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'ISO code (R)',
                'rpt'   => 1,
            },
        },
        '044' => {
            'label' => 'COUNTRY OF PUBLISHING/PRODUCING ENTITY CODE (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '2'     => {
                'label' => 'Source of local subentity code (R)',
                'rpt'   => 1,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Local subentity code (R)',
                'rpt'   => 1,
            },
        },
        '045' => {
            'label' => 'TIME PERIOD OF CONTENT (NR)',
            'rpt'   => 0,
            'ind_1' => 'Type of time period in subfield $b or $c',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Time period code (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Formatted 9999 B.C. through C.E. time period (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Formatted pre-9999 B.C. time period (R)',
                'rpt'   => 1,
            },
        },
        '046' => {
            'label' => 'SPECIAL CODED DATES (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '2'     => {
                'label' => 'Source of date (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Type of date code (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Date 1 (B.C. date) (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Date 1 (C.E. date) (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Date 2 (B.C. date) (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Date 2 (C.E. date) (NR)',
                'rpt'   => 0,
            },
            'j' => {
                'label' => 'Date resource modified (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Beginning or single date created (NR)',
                'rpt'   => 0,
            },
            'l' => {
                'label' => 'Ending date created (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Beginning of date valid (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'End of date valid (NR)',
                'rpt'   => 0,
            },
        },
        '047' => {
            'label' => 'FORM OF MUSICAL COMPOSITION CODE (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '8'     => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Form of musical composition code (R)',
                'rpt'   => 1,
            },
        },
        '048' => {
            'label' => 'NUMBER OF MUSICAL INSTRUMENTS OR VOICES CODE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '8'     => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Performer or ensemble (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Soloist (R)',
                'rpt'   => 1,
            },
        },
        '050' => {
            'label' => 'LIBRARY OF CONGRESS CALL NUMBER (R)',
            'rpt'   => 1,
            'ind_1' => 'Existence in LC collection',
            'ind_2' => 'Source of call number',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Classification number (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Item number (NR)',
                'rpt'   => 0,
            },
        },
        '051' => {
            'label' =>
              'LIBRARY OF CONGRESS COPY, ISSUE, OFFPRINT STATEMENT (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '8'     => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Classification number (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Item number (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Copy information (NR)',
                'rpt'   => 0,
            },
        },
        '052' => {
            'label' => 'GEOGRAPHIC CLASSIFICATION (R)',
            'rpt'   => 1,
            'ind_1' => 'Code source',
            'ind_2' => 'Undefined',
            '2'     => {
                'label' => 'Code source (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Geographic classification area code (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Geographic classification subarea code (R)',
                'rpt'   => 1,
            },
            'd' => {
                'label' => 'Populated place name (R)',
                'rpt'   => 1,
            },
        },
        '055' => {
            'label' => 'CLASSIFICATION NUMBERS ASSIGNED IN CANADA (R)',
            'rpt'   => 1,
            'ind_1' => 'Existence in NLC collection',
            'ind_2' => 'Type, completeness, source of class/call number',
            '2'     => {
                'label' => 'Source of call/class number (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Classification number (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Item number (NR)',
                'rpt'   => 0,
            },
        },
        '060' => {
            'label' => 'NATIONAL LIBRARY OF MEDICINE CALL NUMBER (R)',
            'rpt'   => 1,
            'ind_1' => 'Existence in NLM collection',
            'ind_2' => 'Source of call number',
            '8'     => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Classification number (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Item number (NR)',
                'rpt'   => 0,
            },
        },
        '061' => {
            'label' => 'NATIONAL LIBRARY OF MEDICINE COPY STATEMENT (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '8'     => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Classification number (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Item number (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Copy information (NR)',
                'rpt'   => 0,
            },
        },
        '066' => {
            'label' => 'CHARACTER SETS PRESENT (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            'a'     => {
                'label' => 'Primary G0 character set (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Primary G1 character set (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Alternate G0 or G1 character set (R)',
                'rpt'   => 1,
            },
        },
        '070' => {
            'label' => 'NATIONAL AGRICULTURAL LIBRARY CALL NUMBER (R)',
            'rpt'   => 1,
            'ind_1' => 'Existence in NAL collection',
            'ind_2' => 'Undefined',
            '8'     => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Classification number (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Item number (NR)',
                'rpt'   => 0,
            },
        },
        '071' => {
            'label' => 'NATIONAL AGRICULTURAL LIBRARY COPY STATEMENT (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '8'     => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Classification number (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Item number (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Copy information (NR)',
                'rpt'   => 0,
            },
        },
        '072' => {
            'label' => 'SUBJECT CATEGORY CODE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Subject category code (NR)',
                'rpt'   => 0,
            },
            'x' => {
                'label' => 'Subject category code subdivision (R)',
                'rpt'   => 1,
            },
        },
        '074' => {
            'label' => 'GPO ITEM NUMBER (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '8'     => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'GPO item number (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'Canceled/invalid GPO item number (R)',
                'rpt'   => 1,
            },
        },
        '080' => {
            'label' => 'UNIVERSAL DECIMAL CLASSIFICATION NUMBER (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '2'     => {
                'label' => 'Edition identifier (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Universal Decimal Classification number (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Item number (NR)',
                'rpt'   => 0,
            },
            'x' => {
                'label' => 'Common auxiliary subdivision (R)',
                'rpt'   => 1,
            },
        },
        '082' => {
            'label' => 'DEWEY DECIMAL CLASSIFICATION NUMBER (R)',
            'rpt'   => 1,
            'ind_1' => 'Type of edition',
            'ind_2' => 'Source of classification number',
            '2'     => {
                'label' => 'Edition number (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Classification number (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Item number (NR)',
                'rpt'   => 0,
            },
        },
        '084' => {
            'label' => 'OTHER CLASSIFICATION NUMBER (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '2'     => {
                'label' => 'Source of number (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Classification number (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Item number (NR)',
                'rpt'   => 0,
            },
        },
        '086' => {
            'label' => 'GOVERNMENT DOCUMENT CLASSIFICATION NUMBER (R)',
            'rpt'   => 1,
            'ind_1' => 'Number source',
            'ind_2' => 'Undefined',
            '2'     => {
                'label' => 'Number source (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Classification number (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'Canceled/invalid classification number (R)',
                'rpt'   => 1,
            },
        },
        '088' => {
            'label' => 'REPORT NUMBER (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Report number (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'Canceled/invalid report number (R)',
                'rpt'   => 1,
            },
        },
        '100' => {
            'label' => 'MAIN ENTRY--PERSONAL NAME (NR)',
            'rpt'   => 0,
            'ind_1' => 'Type of personal name entry element',
            'ind_2' => 'Undefined',
            '4'     => {
                'label' => 'Relator code (R)',
                'rpt'   => 1,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Personal name (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Numeration (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Titles and other words associated with a name (R)',
                'rpt'   => 1,
            },
            'd' => {
                'label' => 'Dates associated with a name (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Relator term (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Date of a work (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'j' => {
                'label' => 'Attribution qualifier (R)',
                'rpt'   => 1,
            },
            'k' => {
                'label' => 'Form subheading (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Language of a work (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Number of part/section of a work (R)',
                'rpt'   => 1,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'q' => {
                'label' => 'Fuller form of name (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title of a work (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Affiliation (NR)',
                'rpt'   => 0,
            },
        },
        '110' => {
            'label' => 'MAIN ENTRY--CORPORATE NAME (NR)',
            'rpt'   => 0,
            'ind_1' => 'Type of corporate name entry element',
            'ind_2' => 'Undefined',
            '4'     => {
                'label' => 'Relator code (R)',
                'rpt'   => 1,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' =>
                  'Corporate name or jurisdiction name as entry element (NR)',
                'rpt' => 0,
            },
            'b' => {
                'label' => 'Subordinate unit (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Location of meeting (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Date of meeting or treaty signing (R)',
                'rpt'   => 1,
            },
            'e' => {
                'label' => 'Relator term (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Date of a work (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Form subheading (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Language of a work (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Number of part/section/meeting (R)',
                'rpt'   => 1,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            't' => {
                'label' => 'Title of a work (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Affiliation (NR)',
                'rpt'   => 0,
            },
        },
        '111' => {
            'label' => 'MAIN ENTRY--MEETING NAME (NR)',
            'rpt'   => 0,
            'ind_1' => 'Type of meeting name entry element',
            'ind_2' => 'Undefined',
            '4'     => {
                'label' => 'Relator code (R)',
                'rpt'   => 1,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' =>
                  'Meeting name or jurisdiction name as entry element (NR)',
                'rpt' => 0,
            },
            'c' => {
                'label' => 'Location of meeting (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Date of meeting (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Subordinate unit (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Date of a work (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Form subheading (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Language of a work (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Number of part/section/meeting (R)',
                'rpt'   => 1,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'q' => {
                'label' =>
'Name of meeting following jurisdiction name entry element (NR)',
                'rpt' => 0,
            },
            't' => {
                'label' => 'Title of a work (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Affiliation (NR)',
                'rpt'   => 0,
            },
        },
        '130' => {
            'label' => 'MAIN ENTRY--UNIFORM TITLE (NR)',
            'rpt'   => 0,
            'ind_1' => 'Nonfiling characters',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Date of treaty signing (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Date of a work (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Form subheading (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Language of a work (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Medium of performance for music (R)',
                'rpt'   => 1,
            },
            'n' => {
                'label' => 'Number of part/section of a work (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Arranged statement for music (NR)',
                'rpt'   => 0,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Key for music (NR)',
                'rpt'   => 0,
            },
            's' => {
                'label' => 'Version (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title of a work (NR)',
                'rpt'   => 0,
            },
        },
        '210' => {
            'label' => 'ABBREVIATED TITLE (R)',
            'rpt'   => 1,
            'ind_1' => 'Title added entry',
            'ind_2' => 'Type',
            '2'     => {
                'label' => 'Source (R)',
                'rpt'   => 1,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Abbreviated title (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Qualifying information (NR)',
                'rpt'   => 0,
            },
        },
        '222' => {
            'label' => 'KEY TITLE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Nonfiling characters',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Key title (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Qualifying information (NR)',
                'rpt'   => 0,
            },
        },
        '240' => {
            'label' => 'UNIFORM TITLE (NR)',
            'rpt'   => 0,
            'ind_1' => 'Uniform title printed or displayed',
            'ind_2' => 'Nonfiling characters',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Date of treaty signing (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Date of a work (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Form subheading (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Language of a work (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Medium of performance for music (R)',
                'rpt'   => 1,
            },
            'n' => {
                'label' => 'Number of part/section of a work (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Arranged statement for music (NR)',
                'rpt'   => 0,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Key for music (NR)',
                'rpt'   => 0,
            },
            's' => {
                'label' => 'Version (NR)',
                'rpt'   => 0,
            },
        },
        '242' => {
            'label' => 'TRANSLATION OF TITLE BY CATALOGING AGENCY (R)',
            'rpt'   => 1,
            'ind_1' => 'Title added entry',
            'ind_2' => 'Nonfiling characters',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Title (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Remainder of title (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Statement of responsibility, etc. (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Number of part/section of a work (R)',
                'rpt'   => 1,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'y' => {
                'label' => 'Language code of translated title (NR)',
                'rpt'   => 0,
            },
        },
        '243' => {
            'label' => 'COLLECTIVE UNIFORM TITLE (NR)',
            'rpt'   => 0,
            'ind_1' => 'Uniform title printed or displayed',
            'ind_2' => 'Nonfiling characters',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Date of treaty signing (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Date of a work (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Form subheading (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Language of a work (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Medium of performance for music (R)',
                'rpt'   => 1,
            },
            'n' => {
                'label' => 'Number of part/section of a work (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Arranged statement for music (NR)',
                'rpt'   => 0,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Key for music (NR)',
                'rpt'   => 0,
            },
            's' => {
                'label' => 'Version (NR)',
                'rpt'   => 0,
            },
        },
        '245' => {
            'label' => 'TITLE STATEMENT (NR)',
            'rpt'   => 0,
            'ind_1' => 'Title added entry',
            'ind_2' => 'Nonfiling characters',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Title (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Remainder of title (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Statement of responsibility, etc. (NR)',
                'rpt'   => 0,
            },
            'f' => {
                'label' => 'Inclusive dates (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Bulk dates (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Form (R)',
                'rpt'   => 1,
            },
            'n' => {
                'label' => 'Number of part/section of a work (R)',
                'rpt'   => 1,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            's' => {
                'label' => 'Version (NR)',
                'rpt'   => 0,
            },
        },
        '246' => {
            'label' => 'VARYING FORM OF TITLE (R)',
            'rpt'   => 1,
            'ind_1' => 'Note/added entry controller',
            'ind_2' => 'Type of title',
            '5'     => {
                'label' => 'Institution to which field applies (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Title proper/short title (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Remainder of title (NR)',
                'rpt'   => 0,
            },
            'f' => {
                'label' => 'Date or sequential designation (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Display text (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Number of part/section of a work (R)',
                'rpt'   => 1,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
        },
        '247' => {
            'label' => 'FORMER TITLE (R)',
            'rpt'   => 1,
            'ind_1' => 'Title added entry',
            'ind_2' => 'Note controller',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Title (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Remainder of title (NR)',
                'rpt'   => 0,
            },
            'f' => {
                'label' => 'Date or sequential designation (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Number of part/section of a work (R)',
                'rpt'   => 1,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
        },
        '250' => {
            'label' => 'EDITION STATEMENT (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Edition statement (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Remainder of edition statement (NR)',
                'rpt'   => 0,
            },
        },
        '254' => {
            'label' => 'MUSICAL PRESENTATION STATEMENT (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Musical presentation statement (NR)',
                'rpt'   => 0,
            },
        },
        '255' => {
            'label' => 'CARTOGRAPHIC MATHEMATICAL DATA (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Statement of scale (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Statement of projection (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Statement of coordinates (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Statement of zone (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Statement of equinox (NR)',
                'rpt'   => 0,
            },
            'f' => {
                'label' => 'Outer G-ring coordinate pairs (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Exclusion G-ring coordinate pairs (NR)',
                'rpt'   => 0,
            },
        },
        '256' => {
            'label' => 'COMPUTER FILE CHARACTERISTICS (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Computer file characteristics (NR)',
                'rpt'   => 0,
            },
        },
        '257' => {
            'label' => 'COUNTRY OF PRODUCING ENTITY FOR ARCHIVAL FILMS (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Country of producing entity (NR)',
                'rpt'   => 0,
            },
        },
        '260' => {
            'label' => 'PUBLICATION, DISTRIBUTION, ETC. (IMPRINT) (R)',
            'rpt'   => 1,
            'ind_1' => 'Sequence of publishing statements',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Place of publication, distribution, etc. (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Name of publisher, distributor, etc. (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Date of publication, distribution, etc. (R)',
                'rpt'   => 1,
            },
            'e' => {
                'label' => 'Place of manufacture (NR)',
                'rpt'   => 0,
            },
            'f' => {
                'label' => 'Manufacturer (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Date of manufacture (NR)',
                'rpt'   => 0,
            },
        },
        '263' => {
            'label' => 'PROJECTED PUBLICATION DATE (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Projected publication date (NR)',
                'rpt'   => 0,
            },
        },
        '270' => {
            'label' => 'ADDRESS (R)',
            'rpt'   => 1,
            'ind_1' => 'Level',
            'ind_2' => 'Type of address',
            '4'     => {
                'label' => 'Relator code (R)',
                'rpt'   => 1,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Address (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'City (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'State or province (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Country (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Postal code (NR)',
                'rpt'   => 0,
            },
            'f' => {
                'label' => 'Terms preceding attention name (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Attention name (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Attention position (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Type of address (NR)',
                'rpt'   => 0,
            },
            'j' => {
                'label' => 'Specialized telephone number (R)',
                'rpt'   => 1,
            },
            'k' => {
                'label' => 'Telephone number (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Fax number (R)',
                'rpt'   => 1,
            },
            'm' => {
                'label' => 'Electronic mail address (R)',
                'rpt'   => 1,
            },
            'n' => {
                'label' => 'TDD or TTY number (R)',
                'rpt'   => 1,
            },
            'p' => {
                'label' => 'Contact person (R)',
                'rpt'   => 1,
            },
            'q' => {
                'label' => 'Title of contact person (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Hours (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Public note (R)',
                'rpt'   => 1,
            },
        },
        '300' => {
            'label' => 'PHYSICAL DESCRIPTION (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Extent (Pages) (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Other physical details (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Dimensions (R)',
                'rpt'   => 1,
            },
            'e' => {
                'label' => 'Accompanying material (NR)',
                'rpt'   => 0,
            },
            'f' => {
                'label' => 'Type of unit (R)',
                'rpt'   => 1,
            },
            'g' => {
                'label' => 'Size of unit (R)',
                'rpt'   => 1,
            },
        },
        '306' => {
            'label' => 'PLAYING TIME (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Playing time (R)',
                'rpt'   => 1,
            },
        },
        '307' => {
            'label' => 'HOURS, ETC. (R)',
            'rpt'   => 1,
            'ind_1' => 'Display constant controller',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Hours (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Additional information (NR)',
                'rpt'   => 0,
            },
        },
        '310' => {
            'label' => 'CURRENT PUBLICATION FREQUENCY (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Current publication frequency (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Date of current publication frequency (NR)',
                'rpt'   => 0,
            },
        },
        '321' => {
            'label' => 'FORMER PUBLICATION FREQUENCY (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Former publication frequency (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Dates of former publication frequency (NR)',
                'rpt'   => 0,
            },
        },
        '340' => {
            'label' => 'PHYSICAL MEDIUM (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Material base and configuration (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Dimensions (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Materials applied to surface (R)',
                'rpt'   => 1,
            },
            'd' => {
                'label' => 'Information recording technique (R)',
                'rpt'   => 1,
            },
            'e' => {
                'label' => 'Support (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Production rate/ratio (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Location within medium (R)',
                'rpt'   => 1,
            },
            'i' => {
                'label' => 'Technical specifications of medium (R)',
                'rpt'   => 1,
            },
        },
        '342' => {
            'label' => 'GEOSPATIAL REFERENCE DATA (R)',
            'rpt'   => 1,
            'ind_1' => 'Geospatial reference dimension',
            'ind_2' => 'Geospatial reference method',
            '2'     => {
                'label' => 'Reference method used (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Name (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Coordinate or distance units (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Latitude resolution (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Longitude resolution (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Standard parallel or oblique line latitude (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Oblique line longitude (R)',
                'rpt'   => 1,
            },
            'g' => {
                'label' =>
                  'Longitude of central meridian or projection center (NR)',
                'rpt' => 0,
            },
            'h' => {
                'label' =>
                  'Latitude of projection origin or projection center (NR)',
                'rpt' => 0,
            },
            'i' => {
                'label' => 'False easting (NR)',
                'rpt'   => 0,
            },
            'j' => {
                'label' => 'False northing (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Scale factor (NR)',
                'rpt'   => 0,
            },
            'l' => {
                'label' => 'Height of perspective point above surface (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Azimuthal angle (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' =>
'Azimuth measure point longitude or straight vertical longitude from pole (NR)',
                'rpt' => 0,
            },
            'o' => {
                'label' => 'Landsat number and path number (NR)',
                'rpt'   => 0,
            },
            'p' => {
                'label' => 'Zone identifier (NR)',
                'rpt'   => 0,
            },
            'q' => {
                'label' => 'Ellipsoid name (NR)',
                'rpt'   => 0,
            },
            'r' => {
                'label' => 'Semi-major axis (NR)',
                'rpt'   => 0,
            },
            's' => {
                'label' => 'Denominator of flattening ratio (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Vertical resolution (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Vertical encoding method (NR)',
                'rpt'   => 0,
            },
            'v' => {
                'label' =>
'Local planar, local, or other projection or grid description (NR)',
                'rpt' => 0,
            },
            'w' => {
                'label' =>
                  'Local planar or local georeference information (NR)',
                'rpt' => 0,
            },
        },
        '343' => {
            'label' => 'PLANAR COORDINATE DATA (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Planar coordinate encoding method (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Planar distance units (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Abscissa resolution (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Ordinate resolution (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Distance resolution (NR)',
                'rpt'   => 0,
            },
            'f' => {
                'label' => 'Bearing resolution (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Bearing units (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Bearing reference direction (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Bearing reference meridian (NR)',
                'rpt'   => 0,
            },
        },
        '351' => {
            'label' => 'ORGANIZATION AND ARRANGEMENT OF MATERIALS (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Organization (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Arrangement (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Hierarchical level (NR)',
                'rpt'   => 0,
            },
        },
        '352' => {
            'label' => 'DIGITAL GRAPHIC REPRESENTATION (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Direct reference method (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Object type (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Object count (R)',
                'rpt'   => 1,
            },
            'd' => {
                'label' => 'Row count (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Column count (NR)',
                'rpt'   => 0,
            },
            'f' => {
                'label' => 'Vertical count (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'VPF topology level (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Indirect reference description (NR)',
                'rpt'   => 0,
            },
            'q' => {
                'label' => 'Format of the digital image (R)',
                'rpt'   => 1,
            },
        },
        '355' => {
            'label' => 'SECURITY CLASSIFICATION CONTROL (R)',
            'rpt'   => 1,
            'ind_1' => 'Controlled element',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Security classification (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Handling instructions (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'External dissemination information (R)',
                'rpt'   => 1,
            },
            'd' => {
                'label' => 'Downgrading or declassification event (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Classification system (NR)',
                'rpt'   => 0,
            },
            'f' => {
                'label' => 'Country of origin code (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Downgrading date (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Declassification date (NR)',
                'rpt'   => 0,
            },
            'j' => {
                'label' => 'Authorization (R)',
                'rpt'   => 1,
            },
        },
        '357' => {
            'label' => 'ORIGINATOR DISSEMINATION CONTROL (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' =>
                  'Dates of publication and/or sequential designation (NR)',
                'rpt' => 0,
            },
            'z' => {
                'label' => 'Source of information (NR)',
                'rpt'   => 0,
            },
        },
        '440' => {
            'label' => 'SERIES STATEMENT/ADDED ENTRY--TITLE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Nonfiling characters',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Title (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Number of part/section of a work (R)',
                'rpt'   => 1,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'v' => {
                'label' => 'Volume number/sequential designation (NR)',
                'rpt'   => 0,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
        },
        '490' => {
            'label' => 'SERIES STATEMENT (R)',
            'rpt'   => 1,
            'ind_1' => 'Specifies whether series is traced',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Series statement (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Library of Congress call number (NR)',
                'rpt'   => 0,
            },
            'v' => {
                'label' => 'Volume number/sequential designation (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
        },
        '500' => {
            'label' => 'GENERAL NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '5' => {
                'label' => 'Institution to which field applies (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'General note (NR)',
                'rpt'   => 0,
            },
        },
        '501' => {
            'label' => 'WITH NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '5'     => {
                'label' => 'Institution to which field applies (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'With note (NR)',
                'rpt'   => 0,
            },
        },
        '502' => {
            'label' => 'DISSERTATION NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Dissertation note (NR)',
                'rpt'   => 0,
            },
        },
        '504' => {
            'label' => 'BIBLIOGRAPHY, ETC. NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Bibliography, etc. note (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Number of references (NR)',
                'rpt'   => 0,
            },
        },
        '505' => {
            'label' => 'FORMATTED CONTENTS NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Display constant controller',
            'ind_2' => 'Level of content designation',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Formatted contents note (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Statement of responsibility (R)',
                'rpt'   => 1,
            },
            't' => {
                'label' => 'Title (R)',
                'rpt'   => 1,
            },
        },
        '506' => {
            'label' => 'RESTRICTIONS ON ACCESS NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '5' => {
                'label' => 'Institution to which field applies (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Terms governing access (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Jurisdiction (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Physical access provisions (R)',
                'rpt'   => 1,
            },
            'd' => {
                'label' => 'Authorized users (R)',
                'rpt'   => 1,
            },
            'e' => {
                'label' => 'Authorization (R)',
                'rpt'   => 1,
            },
            'u' => {
                'label' => 'Uniform Resource Identifier (R)',
                'rpt'   => 1,
            },
        },
        '507' => {
            'label' => 'SCALE NOTE FOR GRAPHIC MATERIAL (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Representative fraction of scale note (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Remainder of scale note (NR)',
                'rpt'   => 0,
            },
        },
        '508' => {
            'label' => 'CREATION/PRODUCTION CREDITS NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Creation/production credits note (NR)',
                'rpt'   => 0,
            },
        },
        '510' => {
            'label' => 'CITATION/REFERENCES NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Coverage/location in source',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Name of source (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Coverage of source (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Location within source (NR)',
                'rpt'   => 0,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
        },
        '511' => {
            'label' => 'PARTICIPANT OR PERFORMER NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Display constant controller',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Participant or performer note (NR)',
                'rpt'   => 0,
            },
        },
        '513' => {
            'label' => 'TYPE OF REPORT AND PERIOD COVERED NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Type of report (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Period covered (NR)',
                'rpt'   => 0,
            },
        },
        '514' => {
            'label' => 'DATA QUALITY NOTE (NR)',
            'rpt'   => 0,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Attribute accuracy report (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Attribute accuracy value (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Attribute accuracy explanation (R)',
                'rpt'   => 1,
            },
            'e' => {
                'label' => 'Completeness report (NR)',
                'rpt'   => 0,
            },
            'f' => {
                'label' => 'Horizontal position accuracy report (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Horizontal position accuracy value (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Horizontal position accuracy explanation (R)',
                'rpt'   => 1,
            },
            'i' => {
                'label' => 'Vertical positional accuracy report (NR)',
                'rpt'   => 0,
            },
            'j' => {
                'label' => 'Vertical positional accuracy value (R)',
                'rpt'   => 1,
            },
            'k' => {
                'label' => 'Vertical positional accuracy explanation (R)',
                'rpt'   => 1,
            },
            'm' => {
                'label' => 'Cloud cover (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Uniform Resource Identifier (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Display note (R)',
                'rpt'   => 1,
            },
        },
        '515' => {
            'label' => 'NUMBERING PECULIARITIES NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Numbering peculiarities note (NR)',
                'rpt'   => 0,
            },
        },
        '516' => {
            'label' => 'TYPE OF COMPUTER FILE OR DATA NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Display constant controller',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Type of computer file or data note (NR)',
                'rpt'   => 0,
            },
        },
        '518' => {
            'label' => 'DATE/TIME AND PLACE OF AN EVENT NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Date/time and place of an event note (NR)',
                'rpt'   => 0,
            },
        },
        '520' => {
            'label' => 'SUMMARY, ETC. (R)',
            'rpt'   => 1,
            'ind_1' => 'Display constant controller',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Summary, etc. note (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Expansion of summary note (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Uniform Resource Identifier (R)',
                'rpt'   => 1,
            },
        },
        '521' => {
            'label' => 'TARGET AUDIENCE NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Display constant controller',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Target audience note (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Source (NR)',
                'rpt'   => 0,
            },
        },
        '522' => {
            'label' => 'GEOGRAPHIC COVERAGE NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Display constant controller',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Geographic coverage note (NR)',
                'rpt'   => 0,
            },
        },
        '524' => {
            'label' => 'PREFERRED CITATION OF DESCRIBED MATERIALS NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Display constant controller',
            'ind_2' => 'Undefined',
            '2'     => {
                'label' => 'Source of schema used (NR)',
                'rpt'   => 0,
            },
            '3' => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' =>
                  'Preferred citation of described materials note (NR)',
                'rpt' => 0,
            },
        },
        '525' => {
            'label' => 'SUPPLEMENT NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Supplement note (NR)',
                'rpt'   => 0,
            },
        },
        '526' => {
            'label' => 'STUDY PROGRAM INFORMATION NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Display constant controller',
            'ind_2' => 'Undefined',
            '5'     => {
                'label' => 'Institution to which field applies (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Program name (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Interest level (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Reading level (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Title point value (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Display text (NR)',
                'rpt'   => 0,
            },
            'x' => {
                'label' => 'Nonpublic note (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Public note (R)',
                'rpt'   => 1,
            },
        },
        '530' => {
            'label' => 'ADDITIONAL PHYSICAL FORM AVAILABLE NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Additional physical form available note (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Availability source (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Availability conditions (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Order number (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Uniform Resource Identifier (R)',
                'rpt'   => 1,
            },
        },
        '533' => {
            'label' => 'REPRODUCTION NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '7' => {
                'label' => 'Fixed-length data elements of reproduction (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Type of reproduction (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Place of reproduction (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Agency responsible for reproduction (R)',
                'rpt'   => 1,
            },
            'd' => {
                'label' => 'Date of reproduction (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Physical description of reproduction (NR)',
                'rpt'   => 0,
            },
            'f' => {
                'label' => 'Series statement of reproduction (R)',
                'rpt'   => 1,
            },
            'm' => {
                'label' =>
'Dates and/or sequential designation of issues reproduced (R)',
                'rpt' => 1,
            },
            'n' => {
                'label' => 'Note about reproduction (R)',
                'rpt'   => 1,
            },
        },
        '534' => {
            'label' => 'ORIGINAL VERSION NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Main entry of original (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Edition statement of original (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Publication, distribution, etc. of original (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Physical description, etc. of original (NR)',
                'rpt'   => 0,
            },
            'f' => {
                'label' => 'Series statement of original (R)',
                'rpt'   => 1,
            },
            'k' => {
                'label' => 'Key title of original (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Location of original (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Material specific details (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Note about original (R)',
                'rpt'   => 1,
            },
            'p' => {
                'label' => 'Introductory phrase (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title statement of original (NR)',
                'rpt'   => 0,
            },
            'x' => {
                'label' => 'International Standard Serial Number (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'International Standard Book Number (R)',
                'rpt'   => 1,
            },
        },
        '535' => {
            'label' => 'LOCATION OF ORIGINALS/DUPLICATES NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Additional information about custodian',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Custodian (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Postal address (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Country (R)',
                'rpt'   => 1,
            },
            'd' => {
                'label' => 'Telecommunications address (R)',
                'rpt'   => 1,
            },
            'g' => {
                'label' => 'Repository location code (NR)',
                'rpt'   => 0,
            },
        },
        '536' => {
            'label' => 'FUNDING INFORMATION NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Text of note (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Contract number (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Grant number (R)',
                'rpt'   => 1,
            },
            'd' => {
                'label' => 'Undifferentiated number (R)',
                'rpt'   => 1,
            },
            'e' => {
                'label' => 'Program element number (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Project number (R)',
                'rpt'   => 1,
            },
            'g' => {
                'label' => 'Task number (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Work unit number (R)',
                'rpt'   => 1,
            },
        },
        '538' => {
            'label' => 'SYSTEM DETAILS NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'System details note (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Display text (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Uniform Resource Identifier (R)',
                'rpt'   => 1,
            },
        },
        '540' => {
            'label' => 'TERMS GOVERNING USE AND REPRODUCTION NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '5' => {
                'label' => 'Institution to which field applies (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Terms governing use and reproduction (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Jurisdiction (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Authorization (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Authorized users (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Uniform Resource Identifier (R)',
                'rpt'   => 1,
            },
        },
        '541' => {
            'label' => 'IMMEDIATE SOURCE OF ACQUISITION NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '5' => {
                'label' => 'Institution to which field applies (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Source of acquisition (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Address (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Method of acquisition (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Date of acquisition (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Accession number (NR)',
                'rpt'   => 0,
            },
            'f' => {
                'label' => 'Owner (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Purchase price (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Extent (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Type of unit (R)',
                'rpt'   => 1,
            },
        },
        '544' => {
            'label' => 'LOCATION OF OTHER ARCHIVAL MATERIALS NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Relationship',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Custodian (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Address (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Country (R)',
                'rpt'   => 1,
            },
            'd' => {
                'label' => 'Title (R)',
                'rpt'   => 1,
            },
            'e' => {
                'label' => 'Provenance (R)',
                'rpt'   => 1,
            },
            'n' => {
                'label' => 'Note (R)',
                'rpt'   => 1,
            },
        },
        '545' => {
            'label' => 'BIOGRAPHICAL OR HISTORICAL DATA (R)',
            'rpt'   => 1,
            'ind_1' => 'Type of data',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Biographical or historical note (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Expansion (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Uniform Resource Identifier (R)',
                'rpt'   => 1,
            },
        },
        '546' => {
            'label' => 'LANGUAGE NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Language note (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Information code or alphabet (R)',
                'rpt'   => 1,
            },
        },
        '547' => {
            'label' => 'FORMER TITLE COMPLEXITY NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Former title complexity note (NR)',
                'rpt'   => 0,
            },
        },
        '550' => {
            'label' => 'ISSUING BODY NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Issuing body note (NR)',
                'rpt'   => 0,
            },
        },
        '552' => {
            'label' => 'ENTITY AND ATTRIBUTE INFORMATION NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Entity type label (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Entity type definition and source (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Attribute label (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Attribute definition and source (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Enumerated domain value (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Enumerated domain value definition and source (R)',
                'rpt'   => 1,
            },
            'g' => {
                'label' => 'Range domain minimum and maximum (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Codeset name and source (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Unrepresentable domain (NR)',
                'rpt'   => 0,
            },
            'j' => {
                'label' => 'Attribute units of measurement and resolution (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' =>
                  'Beginning date and ending date of attribute values (NR)',
                'rpt' => 0,
            },
            'l' => {
                'label' => 'Attribute value accuracy (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Attribute value accuracy explanation (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Attribute measurement frequency (NR)',
                'rpt'   => 0,
            },
            'o' => {
                'label' => 'Entity and attribute overview (R)',
                'rpt'   => 1,
            },
            'p' => {
                'label' => 'Entity and attribute detail citation (R)',
                'rpt'   => 1,
            },
            'u' => {
                'label' => 'Uniform Resource Identifier (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Display note (R)',
                'rpt'   => 1,
            },
        },
        '555' => {
            'label' => 'CUMULATIVE INDEX/FINDING AIDS NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Display constant controller',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Cumulative index/finding aids note (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Availability source (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Degree of control (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Bibliographic reference (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Uniform Resource Identifier (R)',
                'rpt'   => 1,
            },
        },
        '556' => {
            'label' => 'INFORMATION ABOUT DOCUMENTATION NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Display constant controller',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Information about documentation note (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'International Standard Book Number (R)',
                'rpt'   => 1,
            },
        },
        '561' => {
            'label' => 'OWNERSHIP AND CUSTODIAL HISTORY (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '5' => {
                'label' => 'Institution to which field applies (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'History (NR)',
                'rpt'   => 0,
            },
        },
        '562' => {
            'label' => 'COPY AND VERSION IDENTIFICATION NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '5' => {
                'label' => 'Institution to which field applies (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Identifying markings (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Copy identification (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Version identification (R)',
                'rpt'   => 1,
            },
            'd' => {
                'label' => 'Presentation format (R)',
                'rpt'   => 1,
            },
            'e' => {
                'label' => 'Number of copies (R)',
                'rpt'   => 1,
            },
        },
        '563' => {
            'label' => 'BINDING INFORMATION (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '5' => {
                'label' => 'Institution to which field applies (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Binding note (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Uniform Resource Identifier (R)',
                'rpt'   => 1,
            },
        },
        '565' => {
            'label' => 'CASE FILE CHARACTERISTICS NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Display constant controller',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Number of cases/variables (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Name of variable (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Unit of analysis (R)',
                'rpt'   => 1,
            },
            'd' => {
                'label' => 'Universe of data (R)',
                'rpt'   => 1,
            },
            'e' => {
                'label' => 'Filing scheme or code (R)',
                'rpt'   => 1,
            },
        },
        '567' => {
            'label' => 'METHODOLOGY NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Display constant controller',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Methodology note (NR)',
                'rpt'   => 0,
            },
        },
        '580' => {
            'label' => 'LINKING ENTRY COMPLEXITY NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Linking entry complexity note (NR)',
                'rpt'   => 0,
            },
        },
        '581' => {
            'label' => 'PUBLICATIONS ABOUT DESCRIBED MATERIALS NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Display constant controller',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Publications about described materials note (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'International Standard Book Number (R)',
                'rpt'   => 1,
            },
        },
        '583' => {
            'label' => 'ACTION NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '2'     => {
                'label' => 'Source of term (NR)',
                'rpt'   => 0,
            },
            '3' => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '5' => {
                'label' => 'Institution to which field applies (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Action (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Action identification (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Time/date of action (R)',
                'rpt'   => 1,
            },
            'd' => {
                'label' => 'Action interval (R)',
                'rpt'   => 1,
            },
            'e' => {
                'label' => 'Contingency for action (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Authorization (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Jurisdiction (R)',
                'rpt'   => 1,
            },
            'i' => {
                'label' => 'Method of action (R)',
                'rpt'   => 1,
            },
            'j' => {
                'label' => 'Site of action (R)',
                'rpt'   => 1,
            },
            'k' => {
                'label' => 'Action agent (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Status (R)',
                'rpt'   => 1,
            },
            'n' => {
                'label' => 'Extent (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Type of unit (R)',
                'rpt'   => 1,
            },
            'u' => {
                'label' => 'Uniform Resource Identifier (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'Nonpublic note (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Public note (R)',
                'rpt'   => 1,
            },
        },
        '584' => {
            'label' => 'ACCUMULATION AND FREQUENCY OF USE NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '5' => {
                'label' => 'Institution to which field applies (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Accumulation (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Frequency of use (R)',
                'rpt'   => 1,
            },
        },
        '585' => {
            'label' => 'EXHIBITIONS NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '5' => {
                'label' => 'Institution to which field applies (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Exhibitions note (NR)',
                'rpt'   => 0,
            },
        },
        '586' => {
            'label' => 'AWARDS NOTE (R)',
            'rpt'   => 1,
            'ind_1' => 'Display constant controller',
            'ind_2' => 'Undefined',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Awards note (NR)',
                'rpt'   => 0,
            },
        },
        '600' => {
            'label' => 'SUBJECT ADDED ENTRY--PERSONAL NAME (R)',
            'rpt'   => 1,
            'ind_1' => 'Type of personal name entry element',
            'ind_2' => 'Thesaurus',
            '2'     => {
                'label' => 'Source of heading or term (NR)',
                'rpt'   => 0,
            },
            '3' => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '4' => {
                'label' => 'Relator code (R)',
                'rpt'   => 1,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Personal name (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Numeration (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Titles and other words associated with a name (R)',
                'rpt'   => 1,
            },
            'd' => {
                'label' => 'Dates associated with a name (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Relator term (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Date of a work (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'j' => {
                'label' => 'Attribution qualifier (R)',
                'rpt'   => 1,
            },
            'k' => {
                'label' => 'Form subheading (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Language of a work (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Medium of performance for music (R)',
                'rpt'   => 1,
            },
            'n' => {
                'label' => 'Number of part/section of a work (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Arranged statement for music (NR)',
                'rpt'   => 0,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'q' => {
                'label' => 'Fuller form of name (NR)',
                'rpt'   => 0,
            },
            'r' => {
                'label' => 'Key for music (NR)',
                'rpt'   => 0,
            },
            's' => {
                'label' => 'Version (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title of a work (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Affiliation (NR)',
                'rpt'   => 0,
            },
            'v' => {
                'label' => 'Form subdivision (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'General subdivision (R)',
                'rpt'   => 1,
            },
            'y' => {
                'label' => 'Chronological subdivision (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Geographic subdivision (R)',
                'rpt'   => 1,
            },
        },
        '610' => {
            'label' => 'SUBJECT ADDED ENTRY--CORPORATE NAME (R)',
            'rpt'   => 1,
            'ind_1' => 'Type of corporate name entry element',
            'ind_2' => 'Thesaurus',
            '2'     => {
                'label' => 'Source of heading or term (NR)',
                'rpt'   => 0,
            },
            '3' => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '4' => {
                'label' => 'Relator code (R)',
                'rpt'   => 1,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' =>
                  'Corporate name or jurisdiction name as entry element (NR)',
                'rpt' => 0,
            },
            'b' => {
                'label' => 'Subordinate unit (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Location of meeting (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Date of meeting or treaty signing (R)',
                'rpt'   => 1,
            },
            'e' => {
                'label' => 'Relator term (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Date of a work (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Form subheading (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Language of a work (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Medium of performance for music (R)',
                'rpt'   => 1,
            },
            'n' => {
                'label' => 'Number of part/section/meeting (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Arranged statement for music (NR)',
                'rpt'   => 0,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Key for music (NR)',
                'rpt'   => 0,
            },
            's' => {
                'label' => 'Version (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title of a work (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Affiliation (NR)',
                'rpt'   => 0,
            },
            'v' => {
                'label' => 'Form subdivision (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'General subdivision (R)',
                'rpt'   => 1,
            },
            'y' => {
                'label' => 'Chronological subdivision (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Geographic subdivision (R)',
                'rpt'   => 1,
            },
        },
        '611' => {
            'label' => 'SUBJECT ADDED ENTRY--MEETING NAME (R)',
            'rpt'   => 1,
            'ind_1' => 'Type of meeting name entry element',
            'ind_2' => 'Thesaurus',
            '2'     => {
                'label' => 'Source of heading or term (NR)',
                'rpt'   => 0,
            },
            '3' => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '4' => {
                'label' => 'Relator code (R)',
                'rpt'   => 1,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' =>
                  'Meeting name or jurisdiction name as entry element (NR)',
                'rpt' => 0,
            },
            'c' => {
                'label' => 'Location of meeting (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Date of meeting (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Subordinate unit (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Date of a work (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Form subheading (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Language of a work (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Number of part/section/meeting (R)',
                'rpt'   => 1,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'q' => {
                'label' =>
'Name of meeting following jurisdiction name entry element (NR)',
                'rpt' => 0,
            },
            's' => {
                'label' => 'Version (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title of a work (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Affiliation (NR)',
                'rpt'   => 0,
            },
            'v' => {
                'label' => 'Form subdivision (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'General subdivision (R)',
                'rpt'   => 1,
            },
            'y' => {
                'label' => 'Chronological subdivision (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Geographic subdivision (R)',
                'rpt'   => 1,
            },
        },
        '630' => {
            'label' => 'SUBJECT ADDED ENTRY--UNIFORM TITLE (R)',
            'rpt'   => 1,
            'ind_1' => 'Nonfiling characters',
            'ind_2' => 'Thesaurus',
            '2'     => {
                'label' => 'Source of heading or term (NR)',
                'rpt'   => 0,
            },
            '3' => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Date of treaty signing (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Date of a work (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Form subheading (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Language of a work (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Medium of performance for music (R)',
                'rpt'   => 1,
            },
            'n' => {
                'label' => 'Number of part/section of a work (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Arranged statement for music (NR)',
                'rpt'   => 0,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Key for music (NR)',
                'rpt'   => 0,
            },
            's' => {
                'label' => 'Version (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title of a work (NR)',
                'rpt'   => 0,
            },
            'v' => {
                'label' => 'Form subdivision (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'General subdivision (R)',
                'rpt'   => 1,
            },
            'y' => {
                'label' => 'Chronological subdivision (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Geographic subdivision (R)',
                'rpt'   => 1,
            },
        },
        '648' => {
            'label' => 'SUBJECT ADDED ENTRY--CHRONOLOGICAL TERM (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Thesaurus',
            '2'     => {
                'label' => 'Source of heading or term (NR)',
                'rpt'   => 0,
            },
            '3' => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Chronological term (NR)',
                'rpt'   => 0,
            },
            'v' => {
                'label' => 'Form subdivision (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'General subdivision (R)',
                'rpt'   => 1,
            },
            'y' => {
                'label' => 'Chronological subdivision (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Geographic subdivision (R)',
                'rpt'   => 1,
            },
        },
        '650' => {
            'label' => 'SUBJECT ADDED ENTRY--TOPICAL TERM (R)',
            'rpt'   => 1,
            'ind_1' => 'Level of subject',
            'ind_2' => 'Thesaurus',
            '2'     => {
                'label' => 'Source of heading or term (NR)',
                'rpt'   => 0,
            },
            '3' => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Topical term (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' =>
                  'Topical term following geographic name entry element (NR)',
                'rpt' => 0,
            },
            'c' => {
                'label' => 'Location of event (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Active dates (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Relator term (NR)',
                'rpt'   => 0,
            },
            'v' => {
                'label' => 'Form subdivision (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'General subdivision (R)',
                'rpt'   => 1,
            },
            'y' => {
                'label' => 'Chronological subdivision (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Geographic subdivision (R)',
                'rpt'   => 1,
            },
        },
        '651' => {
            'label' => 'SUBJECT ADDED ENTRY--GEOGRAPHIC NAME (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Thesaurus',
            '2'     => {
                'label' => 'Source of heading or term (NR)',
                'rpt'   => 0,
            },
            '3' => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Geographic name (NR)',
                'rpt'   => 0,
            },
            'v' => {
                'label' => 'Form subdivision (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'General subdivision (R)',
                'rpt'   => 1,
            },
            'y' => {
                'label' => 'Chronological subdivision (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Geographic subdivision (R)',
                'rpt'   => 1,
            },
        },
        '653' => {
            'label' => 'INDEX TERM--UNCONTROLLED (R)',
            'rpt'   => 1,
            'ind_1' => 'Level of index term',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Uncontrolled term (R)',
                'rpt'   => 1,
            },
        },
        '654' => {
            'label' => 'SUBJECT ADDED ENTRY--FACETED TOPICAL TERMS (R)',
            'rpt'   => 1,
            'ind_1' => 'Level of subject',
            'ind_2' => 'Undefined',
            '2'     => {
                'label' => 'Source of heading or term (NR)',
                'rpt'   => 0,
            },
            '3' => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Non-focus term (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Facet/hierarchy designation (R)',
                'rpt'   => 1,
            },
            'v' => {
                'label' => 'Form subdivision (R)',
                'rpt'   => 1,
            },
            'y' => {
                'label' => 'Chronological subdivision (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Geographic subdivision (R)',
                'rpt'   => 1,
            },
        },
        '655' => {
            'label' => 'INDEX TERM--GENRE/FORM (R)',
            'rpt'   => 1,
            'ind_1' => 'Type of heading',
            'ind_2' => 'Thesaurus',
            '2'     => {
                'label' => 'Source of term (NR)',
                'rpt'   => 0,
            },
            '3' => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '5' => {
                'label' => 'Institution to which field applies (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Genre/form data or focus term (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Non-focus term (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Facet/hierarchy designation (R)',
                'rpt'   => 1,
            },
            'v' => {
                'label' => 'Form subdivision (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'General subdivision (R)',
                'rpt'   => 1,
            },
            'y' => {
                'label' => 'Chronological subdivision (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Geographic subdivision (R)',
                'rpt'   => 1,
            },
        },
        '656' => {
            'label' => 'INDEX TERM--OCCUPATION (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Source of term',
            '2'     => {
                'label' => 'Source of term (NR)',
                'rpt'   => 0,
            },
            '3' => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Occupation (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Form (NR)',
                'rpt'   => 0,
            },
            'v' => {
                'label' => 'Form subdivision (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'General subdivision (R)',
                'rpt'   => 1,
            },
            'y' => {
                'label' => 'Chronological subdivision (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Geographic subdivision (R)',
                'rpt'   => 1,
            },
        },
        '657' => {
            'label' => 'INDEX TERM--FUNCTION (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Source of term',
            '2'     => {
                'label' => 'Source of term (NR)',
                'rpt'   => 0,
            },
            '3' => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Function (NR)',
                'rpt'   => 0,
            },
            'v' => {
                'label' => 'Form subdivision (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'General subdivision (R)',
                'rpt'   => 1,
            },
            'y' => {
                'label' => 'Chronological subdivision (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Geographic subdivision (R)',
                'rpt'   => 1,
            },
        },
        '658' => {
            'label' => 'INDEX TERM--CURRICULUM OBJECTIVE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '2'     => {
                'label' => 'Source of term or code (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Main curriculum objective (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Subordinate curriculum objective (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Curriculum code (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Correlation factor (NR)',
                'rpt'   => 0,
            },
        },
        '690' => {
            'label' => 'SUBJECT ADDED ENTRY--TOPICAL TERM (R)',
            'rpt'   => 1,
            'ind_1' => 'Level of subject',
            'ind_2' => 'Thesaurus',
            '2'     => {
                'label' => 'Source of heading or term (NR)',
                'rpt'   => 0,
            },
            '3' => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Local Subject Headings (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' =>
                  'Topical term following geographic name entry element (NR)',
                'rpt' => 0,
            },
            'c' => {
                'label' => 'Location of event (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Active dates (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Relator term (NR)',
                'rpt'   => 0,
            },
            'v' => {
                'label' => 'Form subdivision (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'General subdivision (R)',
                'rpt'   => 1,
            },
            'y' => {
                'label' => 'Chronological subdivision (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Geographic subdivision (R)',
                'rpt'   => 1,
            },
        },
        '700' => {
            'label' => 'ADDED ENTRY--PERSONAL NAME (R)',
            'rpt'   => 1,
            'ind_1' => 'Type of personal name entry element',
            'ind_2' => 'Type of added entry',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '4' => {
                'label' => 'Relator code (R)',
                'rpt'   => 1,
            },
            '5' => {
                'label' => 'Institution to which field applies (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Personal name (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Numeration (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Titles and other words associated with a name (R)',
                'rpt'   => 1,
            },
            'd' => {
                'label' => 'Dates associated with a name (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Relator term (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Date of a work (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Form subheading (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Language of a work (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Medium of performance for music (R)',
                'rpt'   => 1,
            },
            'n' => {
                'label' => 'Number of part/section of a work (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Arranged statement for music (NR)',
                'rpt'   => 0,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'q' => {
                'label' => 'Fuller form of name (NR)',
                'rpt'   => 0,
            },
            'r' => {
                'label' => 'Key for music (NR)',
                'rpt'   => 0,
            },
            's' => {
                'label' => 'Version (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title of a work (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Affiliation (NR)',
                'rpt'   => 0,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
        },
        '710' => {
            'label' => 'ADDED ENTRY--CORPORATE NAME (R)',
            'rpt'   => 1,
            'ind_1' => 'Type of corporate name entry element',
            'ind_2' => 'Type of added entry',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '4' => {
                'label' => 'Relator code (R)',
                'rpt'   => 1,
            },
            '5' => {
                'label' => 'Institution to which field applies (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' =>
                  'Corporate name or jurisdiction name as entry element (NR)',
                'rpt' => 0,
            },
            'b' => {
                'label' => 'Subordinate unit (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Location of meeting (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Date of meeting or treaty signing (R)',
                'rpt'   => 1,
            },
            'e' => {
                'label' => 'Relator term (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Date of a work (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Form subheading (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Language of a work (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Medium of performance for music (R)',
                'rpt'   => 1,
            },
            'n' => {
                'label' => 'Number of part/section/meeting (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Arranged statement for music (NR)',
                'rpt'   => 0,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Key for music (NR)',
                'rpt'   => 0,
            },
            's' => {
                'label' => 'Version (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title of a work (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Affiliation (NR)',
                'rpt'   => 0,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
        },
        '711' => {
            'label' => 'ADDED ENTRY--MEETING NAME (R)',
            'rpt'   => 1,
            'ind_1' => 'Type of meeting name entry element',
            'ind_2' => 'Type of added entry',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '4' => {
                'label' => 'Relator code (R)',
                'rpt'   => 1,
            },
            '5' => {
                'label' => 'Institution to which field applies (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' =>
                  'Meeting name or jurisdiction name as entry element (NR)',
                'rpt' => 0,
            },
            'c' => {
                'label' => 'Location of meeting (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Date of meeting (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Subordinate unit (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Date of a work (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Form subheading (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Language of a work (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Number of part/section/meeting (R)',
                'rpt'   => 1,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'q' => {
                'label' =>
'Name of meeting following jurisdiction name entry element (NR)',
                'rpt' => 0,
            },
            's' => {
                'label' => 'Version (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title of a work (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Affiliation (NR)',
                'rpt'   => 0,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
        },
        '720' => {
            'label' => 'ADDED ENTRY--UNCONTROLLED NAME (R)',
            'rpt'   => 1,
            'ind_1' => 'Type of name',
            'ind_2' => 'Undefined',
            '4'     => {
                'label' => 'Relator code (R)',
                'rpt'   => 1,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Name (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Relator term (R)',
                'rpt'   => 1,
            },
        },
        '730' => {
            'label' => 'ADDED ENTRY--UNIFORM TITLE (R)',
            'rpt'   => 1,
            'ind_1' => 'Nonfiling characters',
            'ind_2' => 'Type of added entry',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '5' => {
                'label' => 'Institution to which field applies (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Date of treaty signing (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Date of a work (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Form subheading (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Language of a work (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Medium of performance for music (R)',
                'rpt'   => 1,
            },
            'n' => {
                'label' => 'Number of part/section of a work (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Arranged statement for music (NR)',
                'rpt'   => 0,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Key for music (NR)',
                'rpt'   => 0,
            },
            's' => {
                'label' => 'Version (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title of a work (NR)',
                'rpt'   => 0,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
        },
        '740' => {
            'label' => 'ADDED ENTRY--UNCONTROLLED RELATED/ANALYTICAL TITLE (R)',
            'rpt'   => 1,
            'ind_1' => 'Nonfiling characters',
            'ind_2' => 'Type of added entry',
            '5'     => {
                'label' => 'Institution to which field applies (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Uncontrolled related/analytical title (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Number of part/section of a work (R)',
                'rpt'   => 1,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
        },
        '752' => {
            'label' => 'ADDED ENTRY--HIERARCHICAL PLACE NAME (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Country (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'State, province, territory (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'County, region, islands area (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'City (NR)',
                'rpt'   => 0,
            },
        },
        '753' => {
            'label' => 'SYSTEM DETAILS ACCESS TO COMPUTER FILES (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Make and model of machine (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Programming language (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Operating system (NR)',
                'rpt'   => 0,
            },
        },
        '754' => {
            'label' => 'ADDED ENTRY--TAXONOMIC IDENTIFICATION (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '2'     => {
                'label' => 'Source of taxonomic identification (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Taxonomic name (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Taxonomic category (R)',
                'rpt'   => 1,
            },
            'd' => {
                'label' => 'Common or alternative name (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'Non-public note (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Public note (R)',
                'rpt'   => 1,
            },
        },
        '760' => {
            'label' => 'MAIN SERIES ENTRY (R)',
            'rpt'   => 1,
            'ind_1' => 'Note controller',
            'ind_2' => 'Display constant controller',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '7' => {
                'label' => 'Control subfield (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Main entry heading (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Edition (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Qualifying information (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Place, publisher, and date of publication (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Relationship information (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Physical description (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Display text (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Material-specific details (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Note (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Other item identifier (R)',
                'rpt'   => 1,
            },
            's' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title (NR)',
                'rpt'   => 0,
            },
            'w' => {
                'label' => 'Record control number (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
            'y' => {
                'label' => 'CODEN designation (NR)',
                'rpt'   => 0,
            },
        },
        '762' => {
            'label' => 'SUBSERIES ENTRY (R)',
            'rpt'   => 1,
            'ind_1' => 'Note controller',
            'ind_2' => 'Display constant controller',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '7' => {
                'label' => 'Control subfield (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Main entry heading (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Edition (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Qualifying information (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Place, publisher, and date of publication (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Relationship information (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Physical description (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Display text (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Material-specific details (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Note (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Other item identifier (R)',
                'rpt'   => 1,
            },
            's' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title (NR)',
                'rpt'   => 0,
            },
            'w' => {
                'label' => 'Record control number (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
            'y' => {
                'label' => 'CODEN designation (NR)',
                'rpt'   => 0,
            },
        },
        '765' => {
            'label' => 'ORIGINAL LANGUAGE ENTRY (R)',
            'rpt'   => 1,
            'ind_1' => 'Note controller',
            'ind_2' => 'Display constant controller',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '7' => {
                'label' => 'Control subfield (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Main entry heading (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Edition (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Qualifying information (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Place, publisher, and date of publication (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Relationship information (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Physical description (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Display text (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Series data for related item (R)',
                'rpt'   => 1,
            },
            'm' => {
                'label' => 'Material-specific details (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Note (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Other item identifier (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Report number (R)',
                'rpt'   => 1,
            },
            's' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Standard Technical Report Number (NR)',
                'rpt'   => 0,
            },
            'w' => {
                'label' => 'Record control number (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
            'y' => {
                'label' => 'CODEN designation (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'International Standard Book Number (R)',
                'rpt'   => 1,
            },
        },
        '767' => {
            'label' => 'TRANSLATION ENTRY (R)',
            'rpt'   => 1,
            'ind_1' => 'Note controller',
            'ind_2' => 'Display constant controller',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '7' => {
                'label' => 'Control subfield (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Main entry heading (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Edition (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Qualifying information (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Place, publisher, and date of publication (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Relationship information (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Physical description (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Display text (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Series data for related item (R)',
                'rpt'   => 1,
            },
            'm' => {
                'label' => 'Material-specific details (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Note (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Other item identifier (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Report number (R)',
                'rpt'   => 1,
            },
            's' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Standard Technical Report Number (NR)',
                'rpt'   => 0,
            },
            'w' => {
                'label' => 'Record control number (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
            'y' => {
                'label' => 'CODEN designation (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'International Standard Book Number (R)',
                'rpt'   => 1,
            },
        },
        '770' => {
            'label' => 'SUPPLEMENT/SPECIAL ISSUE ENTRY (R)',
            'rpt'   => 1,
            'ind_1' => 'Note controller',
            'ind_2' => 'Display constant controller',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '7' => {
                'label' => 'Control subfield (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Main entry heading (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Edition (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Qualifying information (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Place, publisher, and date of publication (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Relationship information (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Physical description (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Display text (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Series data for related item (R)',
                'rpt'   => 1,
            },
            'm' => {
                'label' => 'Material-specific details (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Note (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Other item identifier (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Report number (R)',
                'rpt'   => 1,
            },
            's' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Standard Technical Report Number (NR)',
                'rpt'   => 0,
            },
            'w' => {
                'label' => 'Record control number (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
            'y' => {
                'label' => 'CODEN designation (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'International Standard Book Number (R)',
                'rpt'   => 1,
            },
        },
        '772' => {
            'label' => 'SUPPLEMENT PARENT ENTRY (R)',
            'rpt'   => 1,
            'ind_1' => 'Note controller',
            'ind_2' => 'Display constant controller',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '7' => {
                'label' => 'Control subfield (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Main entry heading (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Edition (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Qualifying information (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Place, publisher, and date of publication (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Relationship information (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Physical description (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Display text (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Series data for related item (R)',
                'rpt'   => 1,
            },
            'm' => {
                'label' => 'Material-specific details (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Note (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Other item identifier (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Report number (R)',
                'rpt'   => 1,
            },
            's' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Standard Technical Report Number (NR)',
                'rpt'   => 0,
            },
            'w' => {
                'label' => 'Record control number (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
            'y' => {
                'label' => 'CODEN designation (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'International Standard Book Number (R)',
                'rpt'   => 1,
            },
        },
        '773' => {
            'label' => 'HOST ITEM ENTRY (R)',
            'rpt'   => 1,
            'ind_1' => 'Note controller',
            'ind_2' => 'Display constant controller',
            '3'     => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '7' => {
                'label' => 'Control subfield (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Main entry heading (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Edition (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Place, publisher, and date of publication (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Relationship information (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Physical description (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Display text (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Series data for related item (R)',
                'rpt'   => 1,
            },
            'm' => {
                'label' => 'Material-specific details (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Note (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Other item identifier (R)',
                'rpt'   => 1,
            },
            'p' => {
                'label' => 'Abbreviated title (NR)',
                'rpt'   => 0,
            },
            'q' => {
                'label' => 'Enumeration and first page (NR)',
                'rpt'   => 0,
            },
            'r' => {
                'label' => 'Report number (R)',
                'rpt'   => 1,
            },
            's' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Standard Technical Report Number (NR)',
                'rpt'   => 0,
            },
            'w' => {
                'label' => 'Record control number (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
            'y' => {
                'label' => 'CODEN designation (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'International Standard Book Number (R)',
                'rpt'   => 1,
            },
        },
        '774' => {
            'label' => 'CONSTITUENT UNIT ENTRY (R)',
            'rpt'   => 1,
            'ind_1' => 'Note controller',
            'ind_2' => 'Display constant controller',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '7' => {
                'label' => 'Control subfield (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Main entry heading (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Edition (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Qualifying information (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Place, publisher, and date of publication (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Relationship information (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Physical description (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Display text (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Series data for related item (R)',
                'rpt'   => 1,
            },
            'm' => {
                'label' => 'Material-specific details (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Note (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Other item identifier (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Report number (R)',
                'rpt'   => 1,
            },
            's' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Standard Technical Report Number (NR)',
                'rpt'   => 0,
            },
            'w' => {
                'label' => 'Record control number (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
            'y' => {
                'label' => 'CODEN designation (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'International Standard Book Number (R)',
                'rpt'   => 1,
            },
        },
        '775' => {
            'label' => 'OTHER EDITION ENTRY (R)',
            'rpt'   => 1,
            'ind_1' => 'Note controller',
            'ind_2' => 'Display constant controller',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '7' => {
                'label' => 'Control subfield (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Main entry heading (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Edition (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Qualifying information (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Place, publisher, and date of publication (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Language code (NR)',
                'rpt'   => 0,
            },
            'f' => {
                'label' => 'Country code (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Relationship information (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Physical description (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Display text (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Series data for related item (R)',
                'rpt'   => 1,
            },
            'm' => {
                'label' => 'Material-specific details (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Note (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Other item identifier (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Report number (R)',
                'rpt'   => 1,
            },
            's' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Standard Technical Report Number (NR)',
                'rpt'   => 0,
            },
            'w' => {
                'label' => 'Record control number (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
            'y' => {
                'label' => 'CODEN designation (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'International Standard Book Number (R)',
                'rpt'   => 1,
            },
        },
        '776' => {
            'label' => 'ADDITIONAL PHYSICAL FORM ENTRY (R)',
            'rpt'   => 1,
            'ind_1' => 'Note controller',
            'ind_2' => 'Display constant controller',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '7' => {
                'label' => 'Control subfield (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Main entry heading (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Edition (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Qualifying information (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Place, publisher, and date of publication (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Relationship information (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Physical description (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Display text (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Series data for related item (R)',
                'rpt'   => 1,
            },
            'm' => {
                'label' => 'Material-specific details (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Note (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Other item identifier (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Report number (R)',
                'rpt'   => 1,
            },
            's' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Standard Technical Report Number (NR)',
                'rpt'   => 0,
            },
            'w' => {
                'label' => 'Record control number (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
            'y' => {
                'label' => 'CODEN designation (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'International Standard Book Number (R)',
                'rpt'   => 1,
            },
        },
        '777' => {
            'label' => 'ISSUED WITH ENTRY (R)',
            'rpt'   => 1,
            'ind_1' => 'Note controller',
            'ind_2' => 'Display constant controller',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '7' => {
                'label' => 'Control subfield (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Main entry heading (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Edition (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Qualifying information (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Place, publisher, and date of publication (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Relationship information (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Physical description (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Display text (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Series data for related item (R)',
                'rpt'   => 1,
            },
            'm' => {
                'label' => 'Material-specific details (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Note (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Other item identifier (R)',
                'rpt'   => 1,
            },
            's' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title (NR)',
                'rpt'   => 0,
            },
            'w' => {
                'label' => 'Record control number (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
            'y' => {
                'label' => 'CODEN designation (NR)',
                'rpt'   => 0,
            },
        },
        '780' => {
            'label' => 'PRECEDING ENTRY (R)',
            'rpt'   => 1,
            'ind_1' => 'Note controller',
            'ind_2' => 'Type of relationship',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '7' => {
                'label' => 'Control subfield (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Main entry heading (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Edition (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Qualifying information (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Place, publisher, and date of publication (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Relationship information (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Physical description (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Display text (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Series data for related item (R)',
                'rpt'   => 1,
            },
            'm' => {
                'label' => 'Material-specific details (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Note (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Other item identifier (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Report number (R)',
                'rpt'   => 1,
            },
            's' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Standard Technical Report Number (NR)',
                'rpt'   => 0,
            },
            'w' => {
                'label' => 'Record control number (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
            'y' => {
                'label' => 'CODEN designation (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'International Standard Book Number (R)',
                'rpt'   => 1,
            },
        },
        '785' => {
            'label' => 'SUCCEEDING ENTRY (R)',
            'rpt'   => 1,
            'ind_1' => 'Note controller',
            'ind_2' => 'Type of relationship',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '7' => {
                'label' => 'Control subfield (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Main entry heading (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Edition (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Qualifying information (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Place, publisher, and date of publication (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Relationship information (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Physical description (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Display text (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Series data for related item (R)',
                'rpt'   => 1,
            },
            'm' => {
                'label' => 'Material-specific details (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Note (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Other item identifier (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Report number (R)',
                'rpt'   => 1,
            },
            's' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Standard Technical Report Number (NR)',
                'rpt'   => 0,
            },
            'w' => {
                'label' => 'Record control number (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
            'y' => {
                'label' => 'CODEN designation (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'International Standard Book Number (R)',
                'rpt'   => 1,
            },
        },
        '786' => {
            'label' => 'DATA SOURCE ENTRY (R)',
            'rpt'   => 1,
            'ind_1' => 'Note controller',
            'ind_2' => 'Display constant controller',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '7' => {
                'label' => 'Control subfield (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Main entry heading (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Edition (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Qualifying information (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Place, publisher, and date of publication (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Relationship information (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Physical description (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Display text (NR)',
                'rpt'   => 0,
            },
            'j' => {
                'label' => 'Period of content (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Series data for related item (R)',
                'rpt'   => 1,
            },
            'm' => {
                'label' => 'Material-specific details (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Note (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Other item identifier (R)',
                'rpt'   => 1,
            },
            'p' => {
                'label' => 'Abbreviated title (NR)',
                'rpt'   => 0,
            },
            'r' => {
                'label' => 'Report number (R)',
                'rpt'   => 1,
            },
            's' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Standard Technical Report Number (NR)',
                'rpt'   => 0,
            },
            'v' => {
                'label' => 'Source Contribution (NR)',
                'rpt'   => 0,
            },
            'w' => {
                'label' => 'Record control number (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
            'y' => {
                'label' => 'CODEN designation (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'International Standard Book Number (R)',
                'rpt'   => 1,
            },
        },
        '787' => {
            'label' => 'NONSPECIFIC RELATIONSHIP ENTRY (R)',
            'rpt'   => 1,
            'ind_1' => 'Note controller',
            'ind_2' => 'Display constant controller',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '7' => {
                'label' => 'Control subfield (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Main entry heading (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Edition (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Qualifying information (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Place, publisher, and date of publication (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Relationship information (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Physical description (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Display text (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Series data for related item (R)',
                'rpt'   => 1,
            },
            'm' => {
                'label' => 'Material-specific details (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Note (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Other item identifier (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Report number (R)',
                'rpt'   => 1,
            },
            's' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Standard Technical Report Number (NR)',
                'rpt'   => 0,
            },
            'w' => {
                'label' => 'Record control number (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'International Standard Serial Number (NR)',
                'rpt'   => 0,
            },
            'y' => {
                'label' => 'CODEN designation (NR)',
                'rpt'   => 0,
            },
            'z' => {
                'label' => 'International Standard Book Number (R)',
                'rpt'   => 1,
            },
        },
        '800' => {
            'label' => 'SERIES ADDED ENTRY--PERSONAL NAME (R)',
            'rpt'   => 1,
            'ind_1' => 'Type of personal name entry element',
            'ind_2' => 'Undefined',
            '4'     => {
                'label' => 'Relator code (R)',
                'rpt'   => 1,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Personal name (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Numeration (NR)',
                'rpt'   => 0,
            },
            'c' => {
                'label' => 'Titles and other words associated with a name (R)',
                'rpt'   => 1,
            },
            'd' => {
                'label' => 'Dates associated with a name (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Relator term (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Date of a work (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'j' => {
                'label' => 'Attribution qualifier (R)',
                'rpt'   => 1,
            },
            'k' => {
                'label' => 'Form subheading (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Language of a work (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Medium of performance for music (R)',
                'rpt'   => 1,
            },
            'n' => {
                'label' => 'Number of part/section of a work (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Arranged statement for music (NR)',
                'rpt'   => 0,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'q' => {
                'label' => 'Fuller form of name (NR)',
                'rpt'   => 0,
            },
            'r' => {
                'label' => 'Key for music (NR)',
                'rpt'   => 0,
            },
            's' => {
                'label' => 'Version (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title of a work (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Affiliation (NR)',
                'rpt'   => 0,
            },
            'v' => {
                'label' => 'Volume/sequential designation (NR)',
                'rpt'   => 0,
            },
        },
        '810' => {
            'label' => 'SERIES ADDED ENTRY--CORPORATE NAME (R)',
            'rpt'   => 1,
            'ind_1' => 'Type of corporate name entry element',
            'ind_2' => 'Undefined',
            '4'     => {
                'label' => 'Relator code (R)',
                'rpt'   => 1,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' =>
                  'Corporate name or jurisdiction name as entry element (NR)',
                'rpt' => 0,
            },
            'b' => {
                'label' => 'Subordinate unit (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Location of meeting (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Date of meeting or treaty signing (R)',
                'rpt'   => 1,
            },
            'e' => {
                'label' => 'Relator term (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Date of a work (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Form subheading (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Language of a work (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Medium of performance for music (R)',
                'rpt'   => 1,
            },
            'n' => {
                'label' => 'Number of part/section/meeting (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Arranged statement for music (NR)',
                'rpt'   => 0,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Key for music (NR)',
                'rpt'   => 0,
            },
            's' => {
                'label' => 'Version (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title of a work (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Affiliation (NR)',
                'rpt'   => 0,
            },
            'v' => {
                'label' => 'Volume/sequential designation (NR)',
                'rpt'   => 0,
            },
        },
        '811' => {
            'label' => 'SERIES ADDED ENTRY--MEETING NAME (R)',
            'rpt'   => 1,
            'ind_1' => 'Type of meeting name entry element',
            'ind_2' => 'Undefined',
            '4'     => {
                'label' => 'Relator code (R)',
                'rpt'   => 1,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' =>
                  'Meeting name or jurisdiction name as entry element (NR)',
                'rpt' => 0,
            },
            'c' => {
                'label' => 'Location of meeting (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Date of meeting (NR)',
                'rpt'   => 0,
            },
            'e' => {
                'label' => 'Subordinate unit (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Date of a work (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Form subheading (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Language of a work (NR)',
                'rpt'   => 0,
            },
            'n' => {
                'label' => 'Number of part/section/meeting (R)',
                'rpt'   => 1,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'q' => {
                'label' =>
'Name of meeting following jurisdiction name entry element (NR)',
                'rpt' => 0,
            },
            's' => {
                'label' => 'Version (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title of a work (NR)',
                'rpt'   => 0,
            },
            'u' => {
                'label' => 'Affiliation (NR)',
                'rpt'   => 0,
            },
            'v' => {
                'label' => 'Volume/sequential designation (NR)',
                'rpt'   => 0,
            },
        },
        '830' => {
            'label' => 'SERIES ADDED ENTRY--UNIFORM TITLE (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Nonfiling characters',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Uniform title (NR)',
                'rpt'   => 0,
            },
            'd' => {
                'label' => 'Date of treaty signing (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Date of a work (NR)',
                'rpt'   => 0,
            },
            'g' => {
                'label' => 'Miscellaneous information (NR)',
                'rpt'   => 0,
            },
            'h' => {
                'label' => 'Medium (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Form subheading (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Language of a work (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Medium of performance for music (R)',
                'rpt'   => 1,
            },
            'n' => {
                'label' => 'Number of part/section of a work (R)',
                'rpt'   => 1,
            },
            'o' => {
                'label' => 'Arranged statement for music (NR)',
                'rpt'   => 0,
            },
            'p' => {
                'label' => 'Name of part/section of a work (R)',
                'rpt'   => 1,
            },
            'r' => {
                'label' => 'Key for music (NR)',
                'rpt'   => 0,
            },
            's' => {
                'label' => 'Version (NR)',
                'rpt'   => 0,
            },
            't' => {
                'label' => 'Title of a work (NR)',
                'rpt'   => 0,
            },
            'v' => {
                'label' => 'Volume/sequential designation (NR)',
                'rpt'   => 0,
            },
        },
        '841' => {
            'label' => 'HOLDINGS CODED DATA VALUES (NR)',
            'rpt'   => 0,
        },
        '842' => {
            'label' => 'TEXTUAL PHYSICAL FORM DESIGNATOR (NR)',
            'rpt'   => 0,
        },
        '843' => {
            'label' => 'REPRODUCTION NOTE (R)',
            'rpt'   => 1,
        },
        '844' => {
            'label' => 'NAME OF UNIT (NR)',
            'rpt'   => 0,
        },
        '845' => {
            'label' => 'TERMS GOVERNING USE AND REPRODUCTION NOTE (R)',
            'rpt'   => 1,
        },
        '850' => {
            'label' => 'HOLDING INSTITUTION (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '8'     => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Holding institution (R)',
                'rpt'   => 1,
            },
        },
        '852' => {
            'label' => 'LOCATION (R)',
            'rpt'   => 1,
            'ind_1' => 'Shelving scheme',
            'ind_2' => 'Shelving order',
            '2'     => {
                'label' => 'Source of classification or shelving scheme (NR)',
                'rpt'   => 0,
            },
            '3' => {
                'label' =>
                  'Materials specified (Item type - Loan category) (NR)',
                'rpt' => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Sequence number (NR)',
                'rpt'   => 0,
            },
            '9' => {
                'label' => 'Price (NR)',
                'rpt'   => 0,
            },
            'a' => {
                'label' => 'Location (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Sublocation or collection (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Shelving location (R)',
                'rpt'   => 1,
            },
            'e' => {
                'label' => 'Address (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Coded location qualifier (R)',
                'rpt'   => 1,
            },
            'g' => {
                'label' => 'Non-coded location qualifier (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Classification part (Classification number) (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Item part (Author cutter) (R)',
                'rpt'   => 1,
            },
            'j' => {
                'label' => 'Shelving control number (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Call number prefix (R)',
                'rpt'   => 1,
            },
            'l' => {
                'label' => 'Shelving form of title (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Call number suffix (ex. V.1) (R)',
                'rpt'   => 1,
            },
            'n' => {
                'label' => 'Country code (NR)',
                'rpt'   => 0,
            },
            'p' => {
                'label' => 'Piece designation (Barcode) (NR)',
                'rpt'   => 0,
            },
            'q' => {
                'label' => 'Piece physical condition (NR)',
                'rpt'   => 0,
            },
            's' => {
                'label' => 'Copyright article-fee code (R)',
                'rpt'   => 1,
            },
            't' => {
                'label' => 'Copy number (NR)',
                'rpt'   => 0,
            },
            'x' => {
                'label' => 'Nonpublic note (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Public note (R)',
                'rpt'   => 1,
            },
        },
        '853' => {
            'label' => 'CAPTIONS AND PATTERN--BASIC BIBLIOGRAPHIC UNIT (R)',
            'rpt'   => 1,
        },
        '854' => {
            'label' => 'CAPTIONS AND PATTERN--SUPPLEMENTARY MATERIAL (R)',
            'rpt'   => 1,
        },
        '855' => {
            'label' => 'CAPTIONS AND PATTERN--INDEXES (R)',
            'rpt'   => 1,
        },
        '856' => {
            'label' => 'ELECTRONIC LOCATION AND ACCESS (R)',
            'rpt'   => 1,
            'ind_1' => 'Access method',
            'ind_2' => 'Relationship',
            '2'     => {
                'label' => 'Access method (NR)',
                'rpt'   => 0,
            },
            '3' => {
                'label' => 'Materials specified (NR)',
                'rpt'   => 0,
            },
            '6' => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
            '8' => {
                'label' => 'Field link and sequence number (R)',
                'rpt'   => 1,
            },
            'a' => {
                'label' => 'Host name (R)',
                'rpt'   => 1,
            },
            'b' => {
                'label' => 'Access number (R)',
                'rpt'   => 1,
            },
            'c' => {
                'label' => 'Compression information (R)',
                'rpt'   => 1,
            },
            'd' => {
                'label' => 'Path (R)',
                'rpt'   => 1,
            },
            'f' => {
                'label' => 'Electronic name (R)',
                'rpt'   => 1,
            },
            'h' => {
                'label' => 'Processor of request (NR)',
                'rpt'   => 0,
            },
            'i' => {
                'label' => 'Instruction (R)',
                'rpt'   => 1,
            },
            'j' => {
                'label' => 'Bits per second (NR)',
                'rpt'   => 0,
            },
            'k' => {
                'label' => 'Password (NR)',
                'rpt'   => 0,
            },
            'l' => {
                'label' => 'Logon (NR)',
                'rpt'   => 0,
            },
            'm' => {
                'label' => 'Contact for access assistance (R)',
                'rpt'   => 1,
            },
            'n' => {
                'label' => 'Name of location of host (NR)',
                'rpt'   => 0,
            },
            'o' => {
                'label' => 'Operating system (NR)',
                'rpt'   => 0,
            },
            'p' => {
                'label' => 'Port (NR)',
                'rpt'   => 0,
            },
            'q' => {
                'label' => 'Electronic format type (NR)',
                'rpt'   => 0,
            },
            'r' => {
                'label' => 'Settings (NR)',
                'rpt'   => 0,
            },
            's' => {
                'label' => 'File size (R)',
                'rpt'   => 1,
            },
            't' => {
                'label' => 'Terminal emulation (R)',
                'rpt'   => 1,
            },
            'u' => {
                'label' => 'Uniform Resource Identifier (R)',
                'rpt'   => 1,
            },
            'v' => {
                'label' => 'Hours access method available (R)',
                'rpt'   => 1,
            },
            'w' => {
                'label' => 'Record control number (R)',
                'rpt'   => 1,
            },
            'x' => {
                'label' => 'Nonpublic note (R)',
                'rpt'   => 1,
            },
            'y' => {
                'label' => 'Link text (R)',
                'rpt'   => 1,
            },
            'z' => {
                'label' => 'Public note (R)',
                'rpt'   => 1,
            },
        },
        '863' => {
            'label' =>
              'ENUMERATION AND CHRONOLOGY--BASIC BIBLIOGRAPHIC UNIT (R)',
            'rpt' => 1,
        },
        '864' => {
            'label' => 'ENUMERATION AND CHRONOLOGY--SUPPLEMENTARY MATERIAL (R)',
            'rpt'   => 1,
        },
        '865' => {
            'label' => 'ENUMERATION AND CHRONOLOGY--INDEXES (R)',
            'rpt'   => 1,
        },
        '866' => {
            'label' => 'TEXTUAL HOLDINGS--BASIC BIBLIOGRAPHIC UNIT (R)',
            'rpt'   => 1,
        },
        '867' => {
            'label' => 'TEXTUAL HOLDINGS--SUPPLEMENTARY MATERIAL (R)',
            'rpt'   => 1,
        },
        '868' => {
            'label' => 'TEXTUAL HOLDINGS--INDEXES (R)',
            'rpt'   => 1,
        },
        '876' => {
            'label' => 'ITEM INFORMATION--BASIC BIBLIOGRAPHIC UNIT (R)',
            'rpt'   => 1,
        },
        '877' => {
            'label' => 'ITEM INFORMATION--SUPPLEMENTARY MATERIAL (R)',
            'rpt'   => 1,
        },
        '878' => {
            'label' => 'ITEM INFORMATION--INDEXES (R)',
            'rpt'   => 1,
        },
        '880' => {
            'label' => 'ALTERNATE GRAPHIC REPRESENTATION (R)',
            'rpt'   => 1,
            'ind_1' => 'Same as associated field',
            'ind_2' => 'Same as associated field',
            '6'     => {
                'label' => 'Linkage (NR)',
                'rpt'   => 0,
            },
        },
        '886' => {
            'label' => 'FOREIGN MARC INFORMATION FIELD (R)',
            'rpt'   => 1,
            'ind_1' => 'Type of field',
            'ind_2' => 'Undefined',
            '2'     => {
                'label' => 'Source of data (NR)',
                'rpt'   => 0,
            },
            'a' => {
                'label' => 'Tag of the foreign MARC field (NR)',
                'rpt'   => 0,
            },
            'b' => {
                'label' => 'Content of the foreign MARC field (NR)',
                'rpt'   => 0,
            },
        },
        '887' => {
            'label' => 'NON-MARC INFORMATION FIELD (R)',
            'rpt'   => 1,
            'ind_1' => 'Undefined',
            'ind_2' => 'Undefined',
            '2'     => {
                'label' => 'Source of data (NR)',
                'rpt'   => 0,
            },
            'a' => {
                'label' => 'Content of non-MARC field (NR)',
                'rpt'   => 0,
            },
        },
    );
}

1;
