Barry,
Mitch Turitz already gave you a pointer to the MARC record structure
specification. After you've digested that the basic process is something
like this. Assuming you have read in a big chunk of a file of MARC
records into a VB variable:
1. get the next record from the file by looking for an end-of-record
character -- hex 1D
2. get the record leader by reading the first 24 bytes. Bytes 5, 6,
and 7 (starting from 0) contain the record status, type of record, and
bibliographic level codes respectively. These may determine how/whether
you process the rest of the record.
3. from byte 24 to the first field terminator (hex 1E) is the
directory. It is a series of 12 character entries for each field in the
MARC record. You chunk through each 12 character directory entry to
"reassemble" the record. In a directory entry the first three bytes
contain the tag, the next four bytes contain the length of the field and
the last five bytes contain the starting character position (relative to
the base address of the data portion--everything following the directory--
of the record).
4. As you process each directory entry you can do whatever data
manipulation you want based on the tag, indicators, and subfield codes in
that field. This sounds deceptively easy--but it's actually where you're
likely to run into the many disjuncts between the MARC record structure
and traditional databases. It's likely that you'll only be able to
partially map the fields to your local structure, but you might come up
with something useful.
There's many other thorny problems out there, especially issues like
character sets--if you have any diacritics or special characters you'll
have to process the data almost character by character to get it into what
your PC program expects.
Dick Thaxter
On Thu, 2 Nov 2000, Barry Stubbs wrote:
> I am writing a Visual Basic program to import MARC records into our library
> database. Can someone point me to a place where I might find the
> established programming logic on writing a program to convert these
> records. I appreciate any help given.
>
> Barry Stubbs
> Windham School District
>
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*==*=*=*=*=*=*=*=*=*=*=*=*=*=*
* Dick Thaxter [log in to unmask] 202 707-7208 *
* Automation Specialist *
* Motion Picture, Broadcasting & Recorded Sound Division *
* Library of Congress *
* The usual disclaimers apply *
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
|