The following will show you how to get your marc records in Marc21 852 format into koha 2.0.1 My MICROLIF Marc21 852 holdings had no item types and no branch data. When I would load my records into Koha 2.0.1 I had no item count in opac search. Thanks to alot of help from the Koha team Rach, Chris, Paul. And the mailing list, esp. Steve and Owen, I was able to see that three things are required to get an item count in opac.

  1. Defined item type
  2. Branch ID
  3. Branch Holding

If you choose to use the standard template of the installer [1]MARC21 these three variables are defined under the koha-admin→parameters→Links Koha-Marc DB→Biblioitems→itemtype=300f {type of item}, Koha-admin→parameters→Links Koha-Marc DB→items→homebranch=952b, holdingbranch=952d settings. My marc records

  1. use 852 holdings not 952
  2. no item type found
  3. 852b six characters not four
  4. no 852d tag

This design will fix the above problems in a limited way. I choose one item type 'BK' for book. The main branch and holding branch are the same. This method has been tested on a small library with 8,000+ biblios and 10,500 holdings.

Requirements: NewToCompilingPerlModules this will provide command line tools to change marc2xml and xml2marc There are several dependencies to MARC-XML, make sure to read your makefile results and load them first: MARC-Record-1.39_02 XML-NamespaceSupport-1.09 XML-SAX-0.12

once loaded $marc2xml MICROLIF >stage1.xml this will put your Marc21 852 holdings into xml format. $sed 's/code=“b”>Whatever You have In This Field</code=“b”>Four Letter Capitalized matching 852a</g' stage1.xml >stage2.xml (this will match 852b and change it to the four letter code you want for your library).

$sed 's,code=“b”>Four Letter Capitalized<,code=“b”Four Letter Capitalized</subfield>\n<subfield code=“d”>Four Letter Capitalized</subfield>,g' stage2.xml >stage3.xml (matches 852b replaces 852b with same and adds 852d with same four digit alpha code for your holding branch on a newline)

Read your stage3.xml file using less and see that the changes are correct. The command would be $less stage3.xml I noticed the 852d tag using GNU sed version 4.1.4 added an extra /subfield end so: sed 's, </subfield>/subfield>,</subfield>,g' will match </subfield>/subfield> and repace it with </subfield>

the next one is a little tricky because there a spaces in the tag. It's a good idea to study the structure of the first line of the datafield tag 300 and type it correctly. Spaces of course must be included and exact.

$sed 's,<datafield tag=“300” ind1=” ” ind2=” ”>,<datafield tag=“300” ind1= ” ” ind2= ” ”>\n<subfield code =“f”>BK</subfield>,g' stage3.xml >stage4.xml (matches the first line of the 300 tag and globally places a 300f subtag= BK representing book for Koha biblioitem.itemtype) This is executed on stage3.xml, the product is stage4.xml.

$sed 's/tag=“852”/tag=“952”/g' stage4.xml >stage5.xml (globally replace all tags 852 to 952) It's a good idea to check each step by using less from the CLI $less stage4.xml $xml2marc stage4.xml >goodmarc (takes product and returns marc21 952 corrected for koha bulkmarcimport) this process is time consummming around 1.5 hours on P2 450mhz 256mb for 8000+ biblios. You can check the progress by doing $ls -l from the CLI in your working directory.

Before import go to parameters and enter library branch and holding branch to whatever four letter alpha you used to define 952b and 952d. Also set up the item type to BK. When you parameters macr-check there should be no errors. Now import goodmarc using ./bulkmarcimport -file /home/where/ever/you/have/your/goodmarc

Luckily I have only magazine as a secondary itemtype. I can go into the admin funtions and change the item type for each magazine to MAG I found that using this method there are a few hundred titles that show no item count, around 5%. These items can be loaned as all biblio info exists.However, the on-loan tag will not appear on a opac search. I need to find the reason these titles are showing no item count. Found it… there was no 852b tag to match, change and add an 852d tag. A contigency I had not forseen but correctable. I'll probably use a script like the one which adds 300f tags globally.

Michael Reavey

here.txt · Last modified: 2009/06/14 23:03 by mrtumtum
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki