I think I figured out what was causing this. (I still don't understand what is actually happening, but this made it work like I expected.)
The copy of the bib records that I have are in a text file. At some point, some MARC-8 or UTF-8 characters got transcribed to multiple ASCII characters. Some of them are in the Leader bits 20-23. That causes the leader to expand one or two characters, throwing everything from there off. I thought that the directory would correct that (unless the directory is corrupted), but I guess only if it starts at bit 24 like it's supposed to. Here's a sample from a problem record: 01545cam a2200433 a 45’000100060000000500170000600800410002301000170006401500150008101900230009602000290011902000320014802000230018002000250020302900180022803500230024604000 The accent (grave?) character in the line is the problem. The attached file has three records. I hope it keeps the damaged record if you want to look at it. It's the middle record, 001: 30778. Ultimately, the problem was in my RegEx that I wrote to convert those characters to the correct number of bits. My substitution did not work the way I expected it to. substr($line,20,4)=~s/45(?:[0\D\s]){1,3}/4500/; ($line is a line from the text file holding a complete bib record.) I failed to consider the case where this would end up inserting an extra 0. ("45A00" The A should be removed not replaced.) Suggestions? Thanks to all who have tried to help. Mike On Mon, May 23, 2011 at 5:28 AM, Paul Hoffman <nkui...@nkuitse.com> wrote: > On Sat, May 21, 2011 at 04:10:49PM -0500, Mike Barrett wrote: > > When I run the code below, it works fine for a couple thousand MARC > records, > > then starts this: > > str outside of string at C:/Perl64/lib/bytes_heavy.pl line 11. > > of uninitialized value in integer eq (==) at > > C:/Perl64/site/lib/MARC/File/USMARC.pm line 175. > > of uninitialized value $tagdata in substr at > > C:/Perl64/site/lib/MARC/File/USMARC.pm line 178. > > str outside of string at C:/Perl64/lib/bytes_heavy.pl line 11. > > Are those the exact error messages? > > > It does that a few dozen times, then finally dies with: > > str outside of string at C:/Perl64/lib/bytes_heavy.pl line 11. > > of uninitialized value in integer eq (==) at > > C:/Perl64/site/lib/MARC/File/USMARC.pm line 175. > > of uninitialized value $tagdata in substr at > > C:/Perl64/site/lib/MARC/File/USMARC.pm line 178. > > of uninitialized value $tagdata in split at > > C:/Perl64/site/lib/MARC/File/USMARC.pm line 195. > > of uninitialized value $indicators in concatenation (.) or string at > > C:/Perl64/site/lib/MARC/File/USMARC.pm line 200. > > 't call method "as_string" on an undefined value at getsomefields.plline > > 25. > > Sorry, I can't help with the Perl code, but it sounds to me like a bad > record. > > > Here's the record it appears to have choked on while pulling the 245: > > Could you please repost the record as an attachment? > > Paul. > > -- > Paul Hoffman <nkui...@nkuitse.com> >
00945nam a2200301 a 45000010006000000050017000060080041000230100017000640200025000810350020001060350014001260400018001400430012001580490022001700500022001920820032002141000019002462450102002652500012003672600038003793000028004175000033004455040032004785000020005105360047005306500047005777000019006243077719991129184505.0870429s1988 nyu b 00110 eng a 87045059 a0060158107 :c$35.00 a(OCoLC)15696071 9AAB7723AM aDLCcDLCdTXA an-us--- aTXAMc[A11088911]0 aKF4772b.K35 19880 a342.73/0853a347.30285321910aKalven, Harry.12aA worthy tradition :bfreedom of speech in America /cHarry Kalven, Jr. ; edited by Jamie Kalven. a1st ed.0 aNew York :bHarper & Row,cc1988. axxxii, 698 p. ;c25 cm. a"An Edward Burlingame book." aBibliography: p. [611]-672. aIncludes index. aIn memory of Dr. Robert Wick August, 1998. 0aFreedom of speechzUnited StatesxHistory.10aKalven, Jamie. 01545cam a2200433 a 45Â00010006000000050017000060080041000230100017000640150015000810190023000960200029001190200032001480200023001800200025002030290018002280350023002460400028002690490009002970500023003060820019003291000032003482450057003802600089004373000033005264900042005595040054006016500031006556500024006866530043007106500033007538300050007868560090008368560089009269450014010159460010010299470017010399490043010569940012010993077820090323060612.0860417s1987 enka b 000 0 eng a 86009919 aGB86-15655 a13671604a59106563 a0470203552 (U.S. : pbk.) a9780470203552 (U.S. : pbk.) a0335150969 (pbk) : a9780335150960 (pbk.)1 aUKMbb8615655 a(OCoLC)ocm13524607 aDLCcDLCdUKMdUBAdOCL aTXAM00aQE501.3b.M42 198700a551/.022/22191 aMcClay, K. R.q(Kenneth R.)14aThe mapping of geological structures /cK.R. McClay. aMilton Keynes, England :bOpen University Press ;aNew York :bHalsted Press,c1987. avi, 161 p. :bill. ;c18 cm.1 aGeological Society of London handbook aIncludes bibliographical references (p. 151-152). 0aGeology, StructuralvMaps. 0aGeological mapping. aGeological featuresaMapping - Manuals 7aGeologia Estrutural2larpcal 0aGeological Society of London handbook series.413Table of contents onlyuhttp://www.loc.gov/catdir/enhancements/fy0607/86009919-t.html423Publisher descriptionuhttp://www.loc.gov/catdir/enhancements/fy0607/86009919-d.html aPromptCat aqatar aQ14800014030 aupdated-AC Qatarbhc2009/3/23eagreen a92bTXA 01509cam a2200337 a 45000010006000000050017000060080041000230100017000640200038000810350020001190350014001390400018001530430021001710490022001920500024002140820016002381000058002542450148003122600061004603000096005214900037006175000032006545000076006865040047007625000020008096510060008296510055008896000097009446000092010418300038011333077920091204094922.0860725r19861926hk af b 00110aeng a 86018139 a0195838432 (U.S) :c$32.00 (est.) a(OCoLC)14067988 9AAB7725AM aDLCcDLCdTXA aa-cc-suaa-ii--- aTXAMc[A11088660]0 aDS793.S62bS57 19860 a915.1/62191 aSkrine, C. P.q(Clarmont Percival),cSir,d1888-1974.10aChinese central Asia :ban account of travels in Northern Kashmir and Chinese Turkestan /cC.P. Skrine ; with an introduction by Alistair Lamb. aHong Kong ;aNew York :bOxford University Press,c1986. axviii, [iii]-xvi, 306 p., [40] leaves of plates (some folded) :bill. (some col.) ;c23 cm.1 aOxford in Asia hardback reprints aMap on front lining papers. aReprint. Originally published: London : Methuen, 1926. With new introd. aBibliography: p. [xvii]-xviii (1st group). aIncludes index. 0aXinjiang Uygur Zizhiqu (China)xDescription and travel. 0aJammu and Kashmir (India)xDescription and travel.10aSkrine, C. P.q(Clarmont Percival),cSir,d1888-1974xTravelzChinazXinjiang Uygur Zizhiqu.10aSkrine, C. P.q(Clarmont Percival),cSir,d1888-1974xTravelzIndiazJammu and Kashmir. 0aOxford in Asia hardback reprints.