home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / mac / hypercar / 4976 < prev    next >
Encoding:
Text File  |  1993-01-28  |  11.0 KB  |  331 lines

  1. Newsgroups: comp.sys.mac.hypercard
  2. 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
  3. From: Eric Lease Morgan <eric_morgn@ncsu.edu>
  4. Subject: a MARC reader with HyperCard
  5. Message-ID: <1993Jan28.212930.4093@ncsu.edu>
  6. X-Xxmessage-Id: <A78DBC48D001184D@ericmorgan.lib.ncsu.edu>
  7. X-Xxdate: Thu, 28 Jan 93 16:37:28 GMT
  8. Sender: news@ncsu.edu (USENET News System)
  9. Organization: NCSU Libraries
  10. X-Useragent: Nuntius v1.1.1d12
  11. Date: Thu, 28 Jan 1993 21:29:30 GMT
  12. Lines: 317
  13.  
  14. > Does anyone know if a public (or commercial?) Hypercard programm exist
  15. for
  16. import[ing] of MARC-format bibliographic data?
  17.  
  18. Yes. I have written such a program. I call it the MARC Reader with
  19. Find. Below is the text of an article I wrote. This article describes
  20. the heart of the MARC Reader with Find.If you want the stack the mail
  21. me. I don't have an FTP site. One thing my program does not do is
  22. read strings of MARC records; my program only reads individual records.
  23.  
  24. Eric Lease Morgan, Systems Librarian
  25. NCSU Libraries
  26. Box 7111, Room 2316
  27. Raleigh, NC 27695-7111
  28. (919) 515-6182
  29. eric_morgan@ncsu.edu
  30.  
  31. ===== the article =====
  32.  
  33. The MARC Reader: a HyperCard script to demystify the MARC record
  34.  
  35. By Eric Lease Morgan, Systems Librarian,
  36. D.H. Hill Library, North Carolina State University, Raleigh, North
  37. Carolina, 27601.
  38.  
  39. The purpose of this article is to demystify the MARC record and list a
  40. short
  41. HyperCard script that translates a MARC record into an easy-to-read
  42. format.
  43. Furthermore, this article demonstrates that advanced library applications
  44. can be
  45. created with simple, readily-available tools; with HyperCard and a bit of
  46. investigation any librarian can create their own electronic card catalog.
  47.  
  48. About the MARC record
  49.  
  50. Since the late '60s, when cataloging information was stored on tape, the
  51. MARC record
  52. has been the standard format for transferring cataloging information.
  53. ("MARC" is an
  54. acronym for machine readable cataloging.) Even though it has been a
  55. standard for more
  56. than two decades, the majority of librarians do not know how to read it.
  57.  
  58. On one hand, the confusion about the MARC record is comprehensible. At
  59. first glance,
  60. an unformatted MARC record looks like computer garbage or
  61. telecommunications line
  62. noise.
  63.  
  64. After further investigation, the MARC record is a highly structured piece
  65. of
  66. information. It is like a sentence with a subject, predicate, objects,
  67. separated with
  68. commas, semicolons, and one period. In data structure language, the MARC
  69. record is a
  70. hybrid sequential/random access record.
  71.  
  72. The structure of a MARC record
  73.  
  74. The MARC record is made up of three parts: the leader, the directory, the
  75. bibliographic data. The leader (or subject in our analogy) is always
  76. represented by
  77. the first 24 characters of each record. The numbers and letters within
  78. the leader
  79. describe the record's characteristics. For example, the length of the
  80. record is in
  81. positions 1 to 5. The type of material the record represents (authority,
  82. bibliographic, holdings, et cetera) is signified by the character at
  83. position 7. More
  84. importantly, the characters from positions 13 to 17 represent the base.
  85. The base is a
  86. number pointing to the position in the record where the bibliographic
  87. information
  88. begins. See Figure 1.
  89.  
  90. The directory is the second part of a MARC record. (It is the predicate
  91. in our
  92. analogy.) The directory describes the record's bibliographic information
  93. with
  94. directory entries. Each entry lists the types of bibliographic
  95. information (items
  96. called "tags"), how long the bibliographic information is, and where the
  97. information
  98. is stored in relation to the base. The end of the directory and all
  99. variable length
  100. fields are marked with a special character, the ASCII character 30.
  101.  
  102. The last part of a MARC record is the bibliographic information. (It is
  103. the object in
  104. our sentence analogy.) It is simply all the information (and more) on a
  105. catalog card.
  106. Each part of the bibliographic information is separated from the rest
  107. with the ASCII
  108. character 30. Within most of the bibliographic fields are indicators and
  109. subfields
  110. describing in more detail the fields themselves. The subfields are
  111. delimited from the
  112. rest of the field with the ASCII character 31.
  113.  
  114. The end of a MARC record is punctuated with an end-of-record mark, ASCII
  115. character
  116. 29. The ASCII characters 31, 30, and 29 represent our commas, semicolons,
  117. and
  118. periods, respectively.
  119.  
  120. The script
  121.  
  122. The appendix lists a script from a HyperCard program I call "The MARC
  123. Reader". It:
  124.  
  125. 1 reads a single MARC record,
  126. 2 displays the raw data in a field,
  127. 3 parses out the leader, length, and base,
  128. 4 reads the directory and puts it into another field, and
  129. 5 reads and displays the bibliographic data in an easy-to-read format.
  130.  
  131. The fundamental purpose of The MARC Reader is to demystify the MARC
  132. record. It is
  133. based on Frederick J. Raithel's article in Small Computers in Libraries 1
  134. and Walt
  135. Crawford's tome, MARC for Library Use: Understanding Integrated USMARC .2
  136. (Note: The
  137. MARC Reader is designed to read a single, stand-alone MARC record. Many
  138. times MARC
  139. records are concatenated together. You can easily modify The MARC Reader
  140. to contend
  141. with this contingency.) 
  142.  
  143. This is how to get The MARC Reader to work for you. You will need
  144. HyperCard 2.0 and
  145. at least one MARC record. Then:
  146.  
  147. 1 Create a new HyperCard 2.0 stack.
  148. 2 Create two scrolling card fields.
  149. 3 Name the first card field "theField". Set its font to something like
  150. Monaco 9. Size
  151. it to take up most of the screen.
  152. 4 Name the second card field "theDirectory". Hide it.
  153. 5 Create a card button called "Read MARC" and enter the script from the
  154. appendix into
  155. this button.
  156.  
  157. After clicking "Read MARC" and selecting a MARC record, the file will be
  158. reformatted
  159. and look something like Figure 2.
  160.  
  161. The MARC Reader represents the beginning of an automated catalog. With
  162. this program
  163. and your data it would be a trivial matter to create new cards for each
  164. new record
  165. and parse the data into individual fields. This exciting exercise is left
  166. up to you.
  167.  
  168. References
  169.  
  170.     1. Raithel, F.J., "READMARC: A simple BASIC program to read MARC
  171. bibliographic
  172. records," Small Computers in Libraries (April 1987):33U36.
  173.     2. Walt Crawford, MARC for Library Use: Understanding Integrated USMARC,
  174. Second
  175. edition. New York: G.K. Hall & Co., 1989.
  176.  
  177.  
  178. PUT FIGURE 1 HERE.
  179.  
  180. Figure 1. This is MARC record in raw, communications format. The leader
  181. is contained
  182. in the first 24 characters. The directory starts at the 25th character
  183. and continues
  184. until the "ocm". The bibliographic section begins after the directory and
  185. continues
  186. to the end of the example. The mysterious looking rectangles represent
  187. the field
  188. delimiters, ASCII codes 29, 30, and 31.
  189.  
  190.  
  191. PUT FIGURE 2 HERE.
  192.  
  193. Figure 2. After running the script contained in the button "Read MARC"
  194. your MARC
  195. record will look something like the above illustration. This is called a
  196. tagged
  197. format.
  198.  
  199.  
  200. Appendix: The MARC Reader script
  201.  
  202. on mouseUp
  203.   
  204.   -- initialize some variables
  205.   put the numToChar of 29 into endOfFile       -- ASCII 29 is the end of
  206. file mark
  207.   put the numToChar of 30 into endOfField      -- ASCII 30 is the end of
  208. subfield mark
  209.   put the numToChar of 31 into endOfSubfield   -- ASCII 31 is the end of
  210. file mark
  211.   put 24 into thePointer                       -- the begining of the
  212. directory
  213.   put empty into card field theField           -- a window to see the
  214. record
  215.   put empty into card field theDirectory       -- a storage place for the
  216. directory data
  217.   
  218.   -- retrieve the raw data
  219.   answer file "What record do you want to read?"
  220.   if it is empty then exit mouseUp
  221.   put it into theFile
  222.   open file theFile
  223.   read from file theFile until endOfFile
  224.   put it into theRawData
  225.   close file theFile
  226.   
  227.   lock screen
  228.   set cursor to watch
  229.   
  230.   put return & "This is MARC record, " & theFile & "." & return  into
  231. card field theField
  232.   
  233.   -- read and display the raw data
  234.   put return & "This is the raw data." & return after card field theField
  235.   put theRawData after card field theField
  236.   
  237.   -- read and display the LEADER. it is stored in the first 24 characters
  238.   repeat with i = 1 to 24
  239.     put char i of theRawData after theLeader
  240.   end repeat
  241.   put return & return & "The leader is " & theLeader after card field
  242. theField
  243.   
  244.   -- read and display the LENGTH. it is stored in the first five
  245. characters
  246.   repeat with i = 1 to 5
  247.     put char i of theRawData after theLength
  248.   end repeat
  249.   put return & "The length is " & the value of (theLength) after card
  250. field theField
  251.   
  252.   -- read and display the BASE. it is stored in characters 13 through 17
  253.   repeat with i = 13 to 17
  254.     put char i of theRawData after theBase
  255.   end repeat
  256.   put the value of (theBase) into theBase
  257.   put return & "The base is " & theBase after card field theField
  258.   
  259.   -- read and display the directory
  260.   put "Reading the directoryUplease wait."
  261.   put return & return & "MARC tag    Field offset     Offset" after card
  262. field theField
  263.   put return &          "UUUUUUUU    UUUUUUUUUUUU     UUUUUU" after card
  264. field theField
  265.   
  266.   repeat forever
  267.     
  268.     -- read the tag
  269.     put empty into theTag
  270.     repeat with i = 1 to 3
  271.       if theCharacter is endOfField then exit repeat
  272.       add 1 to thePointer
  273.       put char thePointer of theRawData into theCharacter
  274.       put theCharacter after theTag
  275.     end repeat
  276.     
  277.     -- exit the repeat loop if the end of field mark was found
  278.     if theCharacter is endOfField then exit repeat
  279.     put return & theTag after card field theField
  280.     
  281.     -- read the field offset
  282.     put empty into theFieldOffset
  283.     repeat with i = 1 to 4
  284.       if theCharacter is endOfField then exit repeat
  285.       add 1 to thePointer
  286.       put char thePointer of theRawData into theCharacter
  287.       put theCharacter after theFieldOffset
  288.     end repeat
  289.     put "         " & theFieldOffset after card field theField
  290.     
  291.     -- read the offset
  292.     put empty into theOffset
  293.     repeat with i = 1 to 5
  294.       if theCharacter is endOfField then exit repeat
  295.       add 1 to thePointer
  296.       put char thePointer of theRawData into theCharacter
  297.       put theCharacter after theOffset
  298.     end repeat
  299.     put "             " & theOffset after card field theField
  300.     
  301.     -- store the directory
  302.     put theTag & "," & theFieldOffset & "," & theOffset & return after
  303. card field theDirectory
  304.     
  305.   end repeat
  306.   
  307.   -- read and display the bibliographic data
  308.   put "Reading the bibliographic dataUplease wait."
  309.   put return & return & "This is the bibliographic data." & return &
  310. return after card field theField
  311.   put the number of lines in card field theDirectory into theNumberOfLines
  312.   repeat with i = 1 to theNumberOfLines
  313.     put item 1 of line i of card field theDirectory into theTag
  314.     put the value of (item 2 of line i of card field theDirectory) into
  315. theFieldOffset
  316.     put the value of (item 3 of line i of card field theDirectory) +
  317. theBase into theOffset
  318.     put empty into theExtractedData
  319.     repeat with j = 1 to theFieldOffset
  320.       put char j + theOffset of theRawData after theExtractedData
  321.     end repeat
  322.     put theTag & "  " & theExtractedData & return after card field
  323. theField
  324.   end repeat
  325.   
  326.   put return & return & return after card field theField
  327.   
  328.   hide message
  329.   
  330. end mouseUp
  331.