btorder.pl: Automatic Generation of Sirsi Unicorn Order Records

btorder.pl is a Perl script that manipulates MARC records downloaded from the Baker & Taylor Title Source II web site.  It modifies the MARC records and creates Sirsi Unicorn format order records.  The bib and order records can be batch loaded into a Sirsi Unicorn database.  Library staff save time by not having to manually create order records.
 

Installation

Install Perl if necessary (5.004 or greater required)
Install MARC.pm Perl module
Install Date::Manip Perl module
Configure TS II as indicated below
Read Acquisition Records Formats: Format for Order Records in the Sirsi Record Formatting Manual
Download btorder.tar.gz, and edit scripts for local policies (view the main script)
 

Perl

Sirsi ships Perl with Unicorn versions 2000 and up.  It is probably better not to add custom modules to the Sirsi-installed Perl.  Use or install Perl someplace else on your system, or on another system.  The btorder.pl script that creates the bib and order records need not reside your Unicorn server.  The btorderload.pl script that loads the orders does need to be on your Unicorn system, but it doesn't require any custom modules, so could point to the Sirsi installed Perl. 
 

Creating a Custom Profile in Title Source II

Login to Title Source II.  Select System Setup -- Admin -- MARC Profile List--Add 

Give your profile a name and a description. 

Make the following selections: 

Add 901 a Database Element Line Notes
Add 901 x Database Element Cart Name
Add 901 y Database Element List Price
Add 901 z Database Element Order Qty 
We also have the following fields in our profile, which are not necessary to use this script: 
Delete 090 *
Delete 510 *
Add 590 a User Defined BTEBIS Cart
Add 590 b Database Element Cart Name

Guidelines for Line Notes in TS-II

In the TS-II line notes we put information on Sirsi Fund IDs, Holding Codes and number of copies, as well as general notes.  The following tables describe subfield codes and how to use them.
 
MARC record TS-II name SIRSI name
901 a line notes (see line notes values, below)
901 x cart name order ID
901 y list price total price
901 z order qty total copies
 

Line Notes Subfields

Subfield    Name Example
$a Fund ID $a History
$b Holding Code $b Main-Ref
$c Fund Copies $c 1
$d Dist. Copies $d 2
$e Notes $e A note.

 
Examples of valid syntax Notes
History All copies ordered encumbered against History Fund, all copies distributed to the default location.  Initial $a is optional.
$a History  $e Replacement copy. Same as above, with the $a and a note. $e must be at end and can be of any (reasonable) length, but is not repeatable.
$a History $c 1  Same as above, $c is not needed in this case
History $b Sci-Stacks All copies ordered encumbered against History Fund, all distributed to Science Stacks
History $c 3 $b main-stacks $d 1 $b RefMain $d 1 $b RefScience $d 1  History fund, 3 copies: 1 to Main stacks, 1 to RefMain and 1 to RefScience
History $c 1 $b main-stacks $d 1 $a RefFund $c 2 $b RefMain $d 1 $b RefScience$d 1 History fund, 1 copy, to go to main-stacks. For the RefFund, 2 copies, one to go to RefMain location, one to go to RefScience location.

 
Examples of invalid syntax Notes
$a History $a English Fund copies, dist copies and holding codes must be specified if more than one fund code
$a History $c 1 $a English $b Ref $d 1 No holding code or dist copies for first fund code.  These must be specified when more than one fund code is used.
$a History $e Here is a note $c 1 $e must be at end
$b Main No fund code. Fund code is required and must always be the first element.

 

Create Bibload Template

In Workflows, schedule a bibload report with the following choices and save it as a template. 

Here are the changes to make from the default bibload choices:
 

For Unicorn 98/99 For Unicorn 2000+
Load Mode: Create Title control number matching rule: c (rule 1: create, do not load matches)
Title control number: i (for ISBN) Title control number source: i (for ISBN)
Copy Processing: n Copy Processing: n
Call number load rules: ASIS,099,,N (As-is, 099, All, First) Call number load rules: ASIS,099,,N
(As-is, 099, All, First)
Immediate indexing: y File Format: MARC

 

Edit the script

Edit btorder.pl and btorderload.pl, making changes as indicated for your local site..
 
 

Using the script


Create a cart in TS-II.  The cart name you choose will become the Sirsi order ID. It should be not longer than 20 characters. 

Add records to the cart.  Add Line notes to each record, using the guidelines above.
Select MARC Download.  Select the Profile you have created.  Save the file. 

Use FTP or Sirsi Workflows MarcImport utility to transfer the file to your Sirsi system. 

Run the btorder.pl script on the file: 
btorder.pl marc-filename
This will create modified bib records and neworder records. 

Note any errors or warnings. 
Errors indicate important fields missing from the MARC records, you will need to go back to the TS-II cart to correct these. 
Warnings can be corrected by editing the neworderfile that the script creates. 

Run the bibload template report that you created on the modified bib records file (not the original bib records file!)
Examine the bibload report logs.  If records bounce it is usually because they match an existing record in your database. You can still load the orders file.  The order records which match the bib records that bounced will also fail to load (because the bib record with the same call number will not be found)  Or you can edit the cart on TS-II to remove the problem bib records. Or you can edit the neworderfile and remove the order records. 

Run btorderload.pl on the neworder file with the -t for test parameter.  This will check the validity of the input records without making any changes to your database. 

btorderload.pl -t example-neworder

Examine the file order.rpt for error messages.  Usually errors will be because of typos or misspellings in Fund ID names or Holding codes.  If there are errors, edit the neworder file and correct the errors.  Re-run btorderload.pl with the -t parameter until there are no errors.  Then run it without the -t parameter to load the order records into your database.

selected info from the order.rpt file, showing no errors: 

  441 line(s) read.
  21 order record(s) read.
  1 new order record(s) created.
  20 existing order record(s) updated.
  21 orderline record(s) created.

example error messages from loadorder: 

**Cannot link order to fund: fund ID not found
(followed by the offending order)
**Fund ID text too long in input record
(followed by the offending order)
  567 line(s) read.
  27 order record(s) read.
  3 bad input record(s) encountered.
  1 new order record(s) created.
  23 existing order record(s) updated.
  24 orderline record(s) created.

After all order records are loaded, examine the loaded bib and order records in Workflows.  Congratulations!
 

Notes


This script should work with all versions of Unicorn since U98.x

The script does not implement all fields described in the Record Formatting Manual, but it should be relatively easy to extend it to meet local needs. 

I have not tried the script with a Windows NT Sirsi server (don't have one!) 

If you have a large number of files from TS-II you can concatenate them into one file before processing (as long as they are all for the same vendor)

If you order from vendors other than Baker & Taylor, you can still use TS-II and this script to load bib and order records.  Create a cart, download the records, and use the -v for vendor command-line parameter in the btorder.pl script. 

This could be made into a Unicorn custom report or two. 

The script could be modified to work with OCLC or any other MARC record producing service instead of TS-II. 

A similar script has been written by staff at the University of Virginia Library, see their page Yankee to Sirsi Catalog and Order Loading Automation for more information.

Sirsi is planning on introducing a feature in Unicorn 2003, "Flexible MARC (9XX) Order Loading" that will apparently be similar to the function of this script.

Please let me know if you have any comments, suggestions, etc. 
 
 

Acknowledgments

Migell Acosta of the Santa Monica Public Library thought this process up. He wrote scripts in awk and MS-Access to create Sirsi order records for the B&T CD-ROM product.  He also taught me most everything I know about Sirsi. Thanks, Migell! 

Thank you also to Sirsi for a fine hackable library automation system and to Baker & Taylor for a book ordering tool that spits out configurable MARC records. 

last updated Oct. 30, 2002
Steve Hunt, Santa Monica College Library