How can I add a MARC tag called SYS to a set of MARC records?

I want to loop through a set of MARC records, extract the last nine characters of the 001 field, add a new field to each record called SYS, and output the resulting data to a new file. I have the following code snippet that does the work:

# read each record
while (my $record = $batch->next()) {

        # get 001 field
        my $field = $record->field('001')->as_string;
        
        # create a system number, the last nine characters of $field
        my $sysno = substr $field, -9, 9;
                
        # add a sys tag
        $record->append_fields(MARC::Field->new('SYS', $sysno));
        
        # write to STDOUT
        print $record->as_usmarc();

}

Alas, MARC::Field says I need to include a subfield in the SYS field, but that is not what I want. I want the SYS field to contain no indicators nor subfields. I want it to be just like normal MARC tags with values less than 010.

Besides the fact that the addition of a field named SYS may be a "feature" of my integrated library system, how can I add such a field to my data?

--
Eric Lease Morgan
Head, Digital Access and Information Architecture Department
University Libraries of Notre Dame

(574) 631-8604



Reply via email to