Access Keys:
Skip to content (Access Key - 0)
My Area (Access Key - 2)


Toggle Sidebar
Your Rating: Results: PatheticBadOKGoodOutstanding! 21 rates
Labels:
basic basic Delete
marc marc Delete
export export Delete
marcxml marcxml Delete
iso2709 iso2709 Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Multipurpose MARC Export Script

Tags: , , , ,
Last Updated: Jul 08, 2010 13:14


  • Description

    marc_export.pl is a small multipurpose script that can be used to export MARC records from Voyager according to different criteria (bib id list, bib id range, list of identifiers etc.). It can do a bit of on-the-fly record manipulation and output the records in ISO2709 (the classic MARC exchange format) or MARCXML.


  • Author: Ere Maijala
  • Additional author(s):
  • Institution: None
  • Year: 2010
  • License: MPL 1.1 / GPL 2.0
  • Short description: Use, modification and distribution of the code are permitted provided the copyright notice, list of conditions and disclaimer appear in all related material.
  • Link to terms: MPL 1.1, GPL 2.0
  • Skill required for using this code: basic

State

Stable

Programming language

Perl

Software requirements

Voyager, read-only access to Oracle

Using the following Ex Libris open interfaces

None.

Download

Version 1.2

Changes

Version 1.2, 8 July 2010

  • First public release

Release notes

-

Installation instructions

The script doesn't need much installation. Just copy to server, make it executable (chmod +x marc_export.pl) and run it without parameters for a quick help. If it doesn't work, check that it didn't accidentally get Windows line-endings and that the Oracle path in ORACLE_HOME is correct.

Usage

marc_export.pl will examine all the bib records in the database (unless first_id and/or last_id are specified). It's not fast, but this keeps it relatively simple.

The only mandatory parameters are:

Parameter Description
output_file Name of the output file
user Oracle read-only user (e.g. ro_xxxdb)
password Oracle read-only user's password

Without any further parameters the script will export all records in ISO2709 format. The following parameters can be used to control the output:

Parameter Description
format Output format, one of: iso2709 (default, the MARC exchange format), marcxml or bib_id (only bib record id's)
marcxml_namespace Namespace declaration to use when exporting records in MARCXML format

To export records according to a list of bib id's, create a file of id's (one per line), and use the enter the file name in the id_file parameter.

To export records according to a bib id range, use either or both first_id and last_id parameters.

To export records according to field contents, e.g. when you have a list of ISBN's in a file, you can use the following parameters:

Parameter Description
field The field to be examined, e.g. 022
subfield The subfield to be examined, e.g. a
field_file File containing the values that will be searched for in the records
case_sensitive A boolean flag making the field contents comparison case-sensitive (default is case-insensitive)
ignore_punctuation A boolean flag making the field contents comparison ignore punctuation characters
report A file name where the export writes a report of field contents that have been found in multiple records or no records at all
field_comparison The method used when comparing the field contents with the values in the field_file. Possible choices are: exact (match the full subfield), beginning (match the beginning of the subfield), substring (match anywhere in the subfield), end (match the end of the subfield) or regexp (lines in field_file are treated as regular expressions)

It is also possible to add a field to the outputted records. In this case the field_file must contain the string to search for, a pipe character and the string to be added to the record. Parameters add_field
and add_subfield specify the field code and subfield to be added. This can be used to do generic additions to records, e.g.

or record-specific identifiers, e.g.

Note that the longer the file containing the field contents, the slower the export as each record will be checked for a match in any of the values.

Examples

Export records in MARCXML format according to a list ISBN's (match the beginning, as there might be something like (pbk) in the end) and write a report into report.txt:

Export record 10000 - 12000:

Export records according to field 015a and add field 500 to the outputted records:

TO DO list

More options as needed.

Known issues

The export is slow. To keep it simple, it doesn't use any indexes or such.


Comments

Page Attachments

File NameCommentSizeNumber of Downloads
marc_export.plMARC export script v1.220 kB668

Added by Ere Maijala on Jul 08, 2010 13:09, last edited by Ere Maijala on Jul 08, 2010 13:14

Adaptavist Theme Builder Powered by Atlassian Confluence