home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.hypercard
- Path: sparky!uunet!pageworks.com!world!eff!news.oc.com!lgc.com!cs.utexas.edu!uwm.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!paladin.american.edu!gatech!concert!rock!taco!ericmorgan.lib.ncsu.edu!eric_morgn
- From: Eric Lease Morgan <eric_morgn@ncsu.edu>
- Subject: a MARC reader with HyperCard
- Message-ID: <1993Jan28.212930.4093@ncsu.edu>
- X-Xxmessage-Id: <A78DBC48D001184D@ericmorgan.lib.ncsu.edu>
- X-Xxdate: Thu, 28 Jan 93 16:37:28 GMT
- Sender: news@ncsu.edu (USENET News System)
- Organization: NCSU Libraries
- X-Useragent: Nuntius v1.1.1d12
- Date: Thu, 28 Jan 1993 21:29:30 GMT
- Lines: 317
-
- > Does anyone know if a public (or commercial?) Hypercard programm exist
- for
- import[ing] of MARC-format bibliographic data?
-
- Yes. I have written such a program. I call it the MARC Reader with
- Find. Below is the text of an article I wrote. This article describes
- the heart of the MARC Reader with Find.If you want the stack the mail
- me. I don't have an FTP site. One thing my program does not do is
- read strings of MARC records; my program only reads individual records.
-
- Eric Lease Morgan, Systems Librarian
- NCSU Libraries
- Box 7111, Room 2316
- Raleigh, NC 27695-7111
- (919) 515-6182
- eric_morgan@ncsu.edu
-
- ===== the article =====
-
- The MARC Reader: a HyperCard script to demystify the MARC record
-
- By Eric Lease Morgan, Systems Librarian,
- D.H. Hill Library, North Carolina State University, Raleigh, North
- Carolina, 27601.
-
- The purpose of this article is to demystify the MARC record and list a
- short
- HyperCard script that translates a MARC record into an easy-to-read
- format.
- Furthermore, this article demonstrates that advanced library applications
- can be
- created with simple, readily-available tools; with HyperCard and a bit of
- investigation any librarian can create their own electronic card catalog.
-
- About the MARC record
-
- Since the late '60s, when cataloging information was stored on tape, the
- MARC record
- has been the standard format for transferring cataloging information.
- ("MARC" is an
- acronym for machine readable cataloging.) Even though it has been a
- standard for more
- than two decades, the majority of librarians do not know how to read it.
-
- On one hand, the confusion about the MARC record is comprehensible. At
- first glance,
- an unformatted MARC record looks like computer garbage or
- telecommunications line
- noise.
-
- After further investigation, the MARC record is a highly structured piece
- of
- information. It is like a sentence with a subject, predicate, objects,
- separated with
- commas, semicolons, and one period. In data structure language, the MARC
- record is a
- hybrid sequential/random access record.
-
- The structure of a MARC record
-
- The MARC record is made up of three parts: the leader, the directory, the
- bibliographic data. The leader (or subject in our analogy) is always
- represented by
- the first 24 characters of each record. The numbers and letters within
- the leader
- describe the record's characteristics. For example, the length of the
- record is in
- positions 1 to 5. The type of material the record represents (authority,
- bibliographic, holdings, et cetera) is signified by the character at
- position 7. More
- importantly, the characters from positions 13 to 17 represent the base.
- The base is a
- number pointing to the position in the record where the bibliographic
- information
- begins. See Figure 1.
-
- The directory is the second part of a MARC record. (It is the predicate
- in our
- analogy.) The directory describes the record's bibliographic information
- with
- directory entries. Each entry lists the types of bibliographic
- information (items
- called "tags"), how long the bibliographic information is, and where the
- information
- is stored in relation to the base. The end of the directory and all
- variable length
- fields are marked with a special character, the ASCII character 30.
-
- The last part of a MARC record is the bibliographic information. (It is
- the object in
- our sentence analogy.) It is simply all the information (and more) on a
- catalog card.
- Each part of the bibliographic information is separated from the rest
- with the ASCII
- character 30. Within most of the bibliographic fields are indicators and
- subfields
- describing in more detail the fields themselves. The subfields are
- delimited from the
- rest of the field with the ASCII character 31.
-
- The end of a MARC record is punctuated with an end-of-record mark, ASCII
- character
- 29. The ASCII characters 31, 30, and 29 represent our commas, semicolons,
- and
- periods, respectively.
-
- The script
-
- The appendix lists a script from a HyperCard program I call "The MARC
- Reader". It:
-
- 1 reads a single MARC record,
- 2 displays the raw data in a field,
- 3 parses out the leader, length, and base,
- 4 reads the directory and puts it into another field, and
- 5 reads and displays the bibliographic data in an easy-to-read format.
-
- The fundamental purpose of The MARC Reader is to demystify the MARC
- record. It is
- based on Frederick J. Raithel's article in Small Computers in Libraries 1
- and Walt
- Crawford's tome, MARC for Library Use: Understanding Integrated USMARC .2
- (Note: The
- MARC Reader is designed to read a single, stand-alone MARC record. Many
- times MARC
- records are concatenated together. You can easily modify The MARC Reader
- to contend
- with this contingency.)
-
- This is how to get The MARC Reader to work for you. You will need
- HyperCard 2.0 and
- at least one MARC record. Then:
-
- 1 Create a new HyperCard 2.0 stack.
- 2 Create two scrolling card fields.
- 3 Name the first card field "theField". Set its font to something like
- Monaco 9. Size
- it to take up most of the screen.
- 4 Name the second card field "theDirectory". Hide it.
- 5 Create a card button called "Read MARC" and enter the script from the
- appendix into
- this button.
-
- After clicking "Read MARC" and selecting a MARC record, the file will be
- reformatted
- and look something like Figure 2.
-
- The MARC Reader represents the beginning of an automated catalog. With
- this program
- and your data it would be a trivial matter to create new cards for each
- new record
- and parse the data into individual fields. This exciting exercise is left
- up to you.
-
- References
-
- 1. Raithel, F.J., "READMARC: A simple BASIC program to read MARC
- bibliographic
- records," Small Computers in Libraries (April 1987):33U36.
- 2. Walt Crawford, MARC for Library Use: Understanding Integrated USMARC,
- Second
- edition. New York: G.K. Hall & Co., 1989.
-
-
- PUT FIGURE 1 HERE.
-
- Figure 1. This is MARC record in raw, communications format. The leader
- is contained
- in the first 24 characters. The directory starts at the 25th character
- and continues
- until the "ocm". The bibliographic section begins after the directory and
- continues
- to the end of the example. The mysterious looking rectangles represent
- the field
- delimiters, ASCII codes 29, 30, and 31.
-
-
- PUT FIGURE 2 HERE.
-
- Figure 2. After running the script contained in the button "Read MARC"
- your MARC
- record will look something like the above illustration. This is called a
- tagged
- format.
-
-
- Appendix: The MARC Reader script
-
- on mouseUp
-
- -- initialize some variables
- put the numToChar of 29 into endOfFile -- ASCII 29 is the end of
- file mark
- put the numToChar of 30 into endOfField -- ASCII 30 is the end of
- subfield mark
- put the numToChar of 31 into endOfSubfield -- ASCII 31 is the end of
- file mark
- put 24 into thePointer -- the begining of the
- directory
- put empty into card field theField -- a window to see the
- record
- put empty into card field theDirectory -- a storage place for the
- directory data
-
- -- retrieve the raw data
- answer file "What record do you want to read?"
- if it is empty then exit mouseUp
- put it into theFile
- open file theFile
- read from file theFile until endOfFile
- put it into theRawData
- close file theFile
-
- lock screen
- set cursor to watch
-
- put return & "This is MARC record, " & theFile & "." & return into
- card field theField
-
- -- read and display the raw data
- put return & "This is the raw data." & return after card field theField
- put theRawData after card field theField
-
- -- read and display the LEADER. it is stored in the first 24 characters
- repeat with i = 1 to 24
- put char i of theRawData after theLeader
- end repeat
- put return & return & "The leader is " & theLeader after card field
- theField
-
- -- read and display the LENGTH. it is stored in the first five
- characters
- repeat with i = 1 to 5
- put char i of theRawData after theLength
- end repeat
- put return & "The length is " & the value of (theLength) after card
- field theField
-
- -- read and display the BASE. it is stored in characters 13 through 17
- repeat with i = 13 to 17
- put char i of theRawData after theBase
- end repeat
- put the value of (theBase) into theBase
- put return & "The base is " & theBase after card field theField
-
- -- read and display the directory
- put "Reading the directoryUplease wait."
- put return & return & "MARC tag Field offset Offset" after card
- field theField
- put return & "UUUUUUUU UUUUUUUUUUUU UUUUUU" after card
- field theField
-
- repeat forever
-
- -- read the tag
- put empty into theTag
- repeat with i = 1 to 3
- if theCharacter is endOfField then exit repeat
- add 1 to thePointer
- put char thePointer of theRawData into theCharacter
- put theCharacter after theTag
- end repeat
-
- -- exit the repeat loop if the end of field mark was found
- if theCharacter is endOfField then exit repeat
- put return & theTag after card field theField
-
- -- read the field offset
- put empty into theFieldOffset
- repeat with i = 1 to 4
- if theCharacter is endOfField then exit repeat
- add 1 to thePointer
- put char thePointer of theRawData into theCharacter
- put theCharacter after theFieldOffset
- end repeat
- put " " & theFieldOffset after card field theField
-
- -- read the offset
- put empty into theOffset
- repeat with i = 1 to 5
- if theCharacter is endOfField then exit repeat
- add 1 to thePointer
- put char thePointer of theRawData into theCharacter
- put theCharacter after theOffset
- end repeat
- put " " & theOffset after card field theField
-
- -- store the directory
- put theTag & "," & theFieldOffset & "," & theOffset & return after
- card field theDirectory
-
- end repeat
-
- -- read and display the bibliographic data
- put "Reading the bibliographic dataUplease wait."
- put return & return & "This is the bibliographic data." & return &
- return after card field theField
- put the number of lines in card field theDirectory into theNumberOfLines
- repeat with i = 1 to theNumberOfLines
- put item 1 of line i of card field theDirectory into theTag
- put the value of (item 2 of line i of card field theDirectory) into
- theFieldOffset
- put the value of (item 3 of line i of card field theDirectory) +
- theBase into theOffset
- put empty into theExtractedData
- repeat with j = 1 to theFieldOffset
- put char j + theOffset of theRawData after theExtractedData
- end repeat
- put theTag & " " & theExtractedData & return after card field
- theField
- end repeat
-
- put return & return & return after card field theField
-
- hide message
-
- end mouseUp
-