MARC21_utf8_flag_fix.pl - Repair missing leader position 9 value ("a" for MARC21 - UTF8).


MARC21_utf8_flag_fix.pl [ -h | -m ] [ -v ] [ -d ] [ -s ] [ -l N ] [ -o N ] [ -f ]

 Help Options:
   -h --help -?   Brief help message
   -m --man       Full documentation, same as --help --verbose
      --version   Prints version info

 Feedback Options:
   -d --dump      Dump MARCXML of biblioitems processed, default OFF
   -s --summary   Print initial summary of good and bad biblioitems counted, default ON
   -v --verbose   Increase verbosity of output, default OFF

 Run Options:
   -f --fix       Save repaired leaders to biblioitems.marcxml, 
   -l --limit     Number of biblioitems to display or fix
   -o --offset    Number of biblioitems to skip (not displayed or fixed)



This is the most important option. Without it, the script just tells you about the problem records. With --fix, the script fixes the same records.


Like a LIMIT statement in SQL, this constrains the number of records targeted by the script to an integer N. The default is to target all records with bad leaders.


Like an OFFSET statement in SQL, this tells the script to skip N of the targeted records. The default is 0, i.e. skip none of them.

The binary ON/OFF options can be negated like: --nosummary Do not display summary. --nodump Do not dump MARCXML. --nofix Do not change any records. This is the default mode.


Koha expects to have all MARXML records internalized in UTF-8 encoding. This presents a problem when records have been inserted with the leader/09 showing blank for MARC8 encoding. This script is used to determine the extent of the problem and to fix the affected leaders.

As the name suggests, this script is only useful for MARC21 and will die for marcflavour UNIMARC.

Run MARC21_utf8_flag_fix.pl the first time with no options, and assuming you agree that the leaders presented need fixing, run it again with --fix.



In the most basic form, displays summary of biblioitems examined and the leader from any found without /09 = a.

MARC21_utf8_flag_fix.pl --fix

Fixes the same biblioitems, displaying summary and each leader before/after change.

MARC21_utf8_flag_fix.pl --limit=3 --offset=15 --nosummary --dump

Dumps MARCXML from the 16th, 17th and 18th bad records found.

MARC21_utf8_flag_fix.pl -l 3 -o 15 -s 0 -d

Same thing as previous example in terse form.


Allow biblionumbers to be piped into STDIN as the selection mechanism.