marc_export: Exporting Bibliographic Records into MARC files

The following procedure explains how to export Evergreen bibliographic records into MARC files using the marc_export support script. All steps should be performed by the opensrf user from your Evergreen server.

Note

Processing time for exporting records depends on several factors such as the number of records you are exporting. It is recommended that you divide the export ID files (records.txt) into a manageable number of records if you are exporting a large number of records.

  1. Create a text file list of the Bibliographic record IDs you would like to export from Evergreen. One way to do this is using SQL:

    SELECT DISTINCT bre.id FROM biblio.record_entry AS bre
        JOIN asset.call_number AS acn ON acn.record = bre.id
        WHERE bre.deleted='false' and owning_lib=101 \g /home/opensrf/records.txt;

    This query creates a file called records.txt containing a column of distinct IDs of items owned by the organizational unit with the id 101.

  2. Navigate to the support-scripts folder

    cd /home/opensrf/Evergreen-ILS*/Open-ILS/src/support-scripts/
  3. Run marc_export, using the ID file you created in step 1 to define which files to export. The following example exports the records into MARCXML format.

    cat /home/opensrf/records.txt | ./marc_export --store -i -c /openils/conf/opensrf_core.xml \
        -x /openils/conf/fm_IDL.xml -f XML --timeout 5 > exported_files.xml

Note

marc_export does not output progress as it executes.

Options

The marc_export support script includes several options. You can find a complete list by running ./marc_export -h. A few key options are also listed below:

--descendants and --library

The marc_export script has two related options, --descendants and --library. Both options take one argument of an organizational unit

The --library option will export records with holdings at the specified organizational unit only. By default, this only includes physical holdings, not electronic ones (also known as located URIs).

The descendants option works much like the --library option except that it is aware of the org. tree and will export records with holdings at the specified organizational unit and all of its descendants. This is handy if you want to export the records for all of the branches of a system. You can do that by specifying this option and the system’s shortname, instead of specifying multiple --library options for each branch.

Both the --library and --descendants options can be repeated. All of the specified org. units and their descendants will be included in the output. You can also combine --library and --descendants options when necessary.

--since

You can use the --since option to export records modified after a certain date and time.

--store

By default, marc_export will use the reporter storage service, which should work in most cases. But if you have a separate reporter database and you know you want to talk directly to your main production database, then you can set the --store option to cstore or storage.

--uris

The --uris option (short form: -u) allows you to export records with located URIs (i.e. electronic resources). When used by itself, it will export only records that have located URIs. When used in conjunction with --items, it will add records with located URIs but no items/copies to the output. If combined with a --library or --descendants option, this option will limit its output to those records with URIs at the designated libraries. The best way to use this option is in combination with the --items and one of the --library or --descendants options to export all of a library’s holdings both physical and electronic.