# in the following, tests 1-299 (not all numbers used) were derived from
#   a document provided by Library of Congress; tests 300-399 from the
#   cataloger's toolkit; tests 400- were made up out of thin air

[ForceRules]
# work involving 008/18-34 is properly llimited to
#   individual formats
87=U        008/06={bp}      F 008/18-22=_____
160=U       008/06={bp}      F 008/24-34=_______
# rule 161 asorbed into 160
#161 U      008/06={bp}      F 008/33-34=__
70=B        008/18-21!____   F <5:008/18-21>
76=P        008/18-21!____   F <9:008/18-21>
72=B        008/18-21=____   F <7>
260=F       008/23-27!_____  F <9:008/23-27>
74=B        008/24-27!____   F <5:008/24-27>
89=M        008/24-29!______ F <9:008/24-29>
91=M        008/30-31!__     F <5:008/30-31>
1=P         008/33=e OR 008/34=e F 000/06=f
83=P        008/33-34!__     F <9:008/33-34>
#
94=BDFMPSU  010/a            F <10:010/a,010/z>
95=BDFMPSU  010/b            F <10:010/b>
96=BDFMPSU  010/z            F <10:010/z>
# test 99 is LC-specific
#99 P       017/b!           F <37:017,|bU.S._Copyright_Office>
100=BDFMPSU 020/a            F <10:020/a,020/z>
101=BDFMPSU 020/z            F <10:020/z>
601=BDFMPSU 022/a            F <10:022/a,022/y>
602=BDFMPSU 022/y            F <10:022/y>
603=BDFMPSU 022/z            F <10:022/z>
# NOTE that the following rule assumes the NucCode property
117=BDFMPSU 040!             F <37:040,__,|a%%NUC|c%%NUC>
# NOTE that the following rule assumes the NucCode property
249=BDFMPSU 040/c!           F <37:040,|c%%NUC>
66=BDFMPSU  041              F <4:041,<,4>
65=BDFMPSU  041/a            F <2:008/35-37,041/a> 1:3
310=BDFMPSU 050:2=_          F 050:2=0
# rules 132, 163, 133, 135, 136, 137 and 145 are LC-specific
#132 BDFMU  050/a            F <21:050/a,[]>
#163 BDFMU  050/b            F <21:050/b,[]>
#133 DFM    050/u            F <22:050/u,<>>
#135 BDFMPU 051/c            F <23:051/c,_->
#136 BDFMPU 051/c            F <24:051/c>
#137 DFMPU  051/u            F <22:051/u,<>>
#145 BDFMPU 082              F <25:082,[]>
312=BDFMPSU 082:1=_          F 082:1=0
313=BDFMPSU 082:2=_          F 082:2=0
146=BDFMPSU 082/2! AND 000/17={_458} AND 000/18=a F <37:082,|221>
# rule 241 is LC-specific
#241 P      086/a            F <23:086/a,Supt._of_Docs._no.:>
# rule 152 is LC-specific
#152 BDFMPU 097              F <27:097>
410=BDFMPSU 100:2=0          F 100:2=_
411=BDFMPSU 110:2=0          F 110:2=_
311=BDFMPSU 111:2=0          F 111:2=_
412=BDFMPSU 130:2=0          F 130:2=_
# rule 164 is LC-specific
#164 BDFMPU 240              F <21:240,[]>
314=BDFMPSU 240:1=0          F 240:1=1          3:5 Check 240 1st indicator
155=BDFMPSU 245:1=1 AND 100! AND 110! AND 111! AND 130! F 245:1=0 3:5 245 1st indicator should be 0
# note that Exception 22 will have to have special handling for 245/h
#   (and others?) to allow for trailing punctuation in the subfield
#   is to be kept outside the brackets
167=BDFMPSU 245/h            F <22:245/h,[]>
315=BDFMPSU 246/i AND 246:2!_ F 246:2=_         3:5 246 $i means 2nd indicator should be blank
# we're not going to do this at Northwestern; we're not going to 
#   write the required code
#112 P      255              F <10:255>
316=BDFMPSU 260:1!_          F 260:1=_
317=BDFMPSU 260:2!_          F 260:2=_
421=BDFMPSU 350              F <27:350>
# rule 192 is LC-specific
#192 BDFMPU 400              F <21:400,()>
193=BDFMPSU 400              F <32:400>
# rule 196 is LC-specific
#196 BDFMPU 410              F <21:410,()>
194=BDFMPSU 410              F <32:410>
# rule 197 is LC-specific
#197 BDFMPU 411              F <21:411,()>
195=BDFMPSU 411              F <32:411>
# rule 198 is LC-specific
#198 BDFMPU 440              F <21:440,()>
# rule 201 is LC-specific
#201 BDFMPU 490              F <21:490,()>
# I don't believe we're going to need test 205 at NUL
#205 P      505 AND 000/18=a F <33:505>
208=BDFMPSU 510/c            F 510:1=4          3:5 510 $c means 1st indicator should be 4
216=BDFMPSU 600/2            F 600:2=7          3:5 600 $2 means 2nd indicator should be 7
219=BDFMPSU 610/2            F 610:2=7          3:5 610 $2 means 2nd indicator should be 7
222=BDFMPSU 611/2            F 611:2=7          3:5 611 $2 means 2nd indicator should be 7
226=BDFMPSU 630/2            F 630:2=7          3:5 630 $2 means 2nd indicator should be 7
229=BDFMPSU 650/2            F 650:2=7          3:5 650 $2 means 2nd indicator should be 7
232=BDFMPSU 651/2            F 651:2=7          3:5 651 $2 means 2nd indicator should be 7
319=BDFMPSU 700:2!{_2}       F 700:2=_
320=BDFMPSU 710:2!{_2}       F 710:2=_
321=BDFMPSU 711:2!{_2}       F 711:2=_
322=BDFMPSU 730:2!{_2}       F 730:2=_
323=BDFMPSU 740:2!{_2}       F 740:2=_

[TestRules]
# work involving 008/18-34 is properly limited to individual formats
# likewise, tests involving 000/06 (and sometimes 000/07) are de facto
#   limited to individual formats
3=P         000/06=e         T 008/33!e AND 008/34!e 9:9 'Special format characteristics' may not contain 'e'
# specification for Leader/06 added per communication from LC, 19991118
20=P        000/06=e AND 000/17-18=_a T 255       1:5 255 field required for AACR2 records with this 'Encoding level'
2=P         000/06=f         T 008/33=e OR 008/34=e 9:9 'Special format characteristics' must contain 'e'
168=M       000/06={ij}      T 245/h              1:5 245/h is required
303=M       000/06=j         T 008/30-31=__       0:5 'Literary text' must be blank for 'musical' sound recordings
14=P        000/07=a         T 580                1:5 580 field is required for component parts
16=DP       000/07={abd}     T 773                1:5 773 field is required for this 'Bib. level'
15=FM       000/07={ad}      T 773                1:5 773 field is required for this 'Bib. level'
4=DP        000/07={acdm}    T 008/06={bceikmnpqrst|} 1:5 'Date type' improper
6=P         000/07={acdm}    T 008/25!c           1:5 'Type of cartog. material' may not be 'c' for this 'Bib. level'
# naturally enough, if 000/07=b,s then the format cannot be B
# LC specified format as DP only
5=DFMPSU    000/07={bs}      T 008/06={cdu|}      1:5 'Date type' code improper
7=P         000/07={bs}      T 008/25=c           1:5 'Type of cartog. material' must be 'c' for this 'Bib. level'
# LC specified format as P only
11=DFMPSU   000/07={bs}      T 310                1:5 310 field required for this 'Bib. level'
# this is probably an LC-specific test
27=BDFMPSU  000/17=_         T 050                1:5 050 field required for this 'Encoding level'
# this is probably an LC-specific test, but it probably won't hurt
19=BDFMPSU  000/17=_ AND 000/18!a T 042!          1:5 042 field not allowed in non-AACR2 full-level records
265=BDFMPSU 000/17={_458} AND 000/18=a T 082/2 AND 082/2=21* 1:3 082 should have subfield $2 '21'
22=BDFMPSU  000/17={_7}      T 008/39=_           1:5 'Cat. source' must be 'blank' for this 'Encoding level'
# test 23 is LC-specific
#23 P       000/17=1         T 010/a=um*
# test 21 is LC-specific
#21 P       000/17=1         T 008/39=d
# test 25 is LC-specific
#25 P       000/17=1         T 042
# tests 17, 24 and 172 are LC-specific, but as they simply
#   require certain fields for certain low-level records, they will probably
#   not hurt anything
17=P        000/17={17}      T 000/18=a           1:5 'Rules' must be AACR2 for this 'Encoding level'
24=P        000/17={17}      T 034                1:5 034 field required for this 'Encoding level'
172=P       000/17={17}      T 255                1:5 255 field required for this 'Encoding level'
# test 37 is LC-specific
#37 P       000/17=7         T 957
# test 29 is LC-specific
#29 BDFMPSU 000/17=8         T 263
# test 31 is LC-specific
#31 B       000/17=8         T 263 OR 905
# tests 18 and 20 are LC-specific, but as they simply
#   require certain fields, they will probably not hurt anything
18=P        000/17-18=_a     T 034                1:5 034 field required for AACR2 records with this 'Encoding level'
# test 173 is LC-specific
#173 P      000/17-18=_a     T 957
# test 49 duplicates a test now part of the standard 008 validation routine
#49 BDFMPU  008              T <1:008/07-10,0123456789u> OR 008/07-10=____ OR 008/07-10=||||
# test 55 duplicates a test now part of the standard 008 validation routine
#55 BDFMPU  008              T <35>
# this is a format-specific test; probably not harmful
139=P       008              T 052          1:5 052 field required
266=BDFMPSU 008 AND 0008/18={aipr} T 260    1:5 260 field required
# as specified in test 5, 'b' isn't alowed for serials, anyway so unless
#   one of these codes is involved, we don't need to bother including
#   S in the formats for date checks
43=BDFMPU   008/06=b         T 008/07-14=________ 1:5 Both dates must be blank if 'Date type' is 'b'
343=BDFMPU  008/06=b         T 046         1:5 046 field required if 'Date type' is 'b'
50=BDFMPU   008/06={eqs}     T <1:008/07-10,0123456789u> 5:9 Date 1 contains invalid characters
42=BDFMPSU  008/06={cikpt}   T <1:008/07-14,0123456789u> 5:9 Date 2 contains invalid characters
47=BDFMPU   008/06=e         T <1:008/11-12,0123456789u> 5:9 Date 2 contains invalid characters
420=BDFMPU  008/06=e         T <1:008/13-14,0123456789u> OR 008/13-14=__ 5:9 Date 2 contains invalid characters
# test 59 is redundant with tests 47 plus 420
#59 BDFMPU  008/06=e         T <36>
86=P        008/06=e         T 008/33!e AND 008/34!e 9:9 'Special format characteristics' may not contain 'e'
45=BDFMPU   008/06={mr}      T <1:008/07-10,0123456789u> OR <1:008/11-14,0123456789u> 5:9 Dates improperly formatted
911=BDFMPU  008/06=m         T 008/07-10!____ AND 008/11-14!____ 5:9 Dates cannot be blank for date type m 
# LC's rule allowed either 8 "u"s or 8 blanks; but OCLCl enforces MARC: "u"s only if type=n
44=BDFMPU   008/06=n         T 008/07-14=uuuuuuuu 5:9 Dates contain invalid characters
#44 BDFMPU  008/06=n         T 008/07-14=uuuuuuuu OR 008/07-14=________ 5:9 Dates contain invalid characters
# the following is redundant with test 50, above
#48 BDFMPU  008/06=q         T <1:008/07-10,0123456789u> 5:9 Date 1 contains invalid characters
60=BDFMPU   008/06=q         T <1:008/11-14,0123456789u> OR 008/11-14=____ 5:9 Dates contain invalid characters
# the following is redundant with test 50, above
#46 BDFMPU  008/06=s         T <1:008/07-10,0123456789u> 5:9 Date 1 contains invalid characters
57=BDFMPU   008/06=s         T 008/11-14=____     5:9 Date 2 contains invalid characters
# since at NUL we're not allowing the fill character in the 008 anyway,
#   tests 53 and 61 may produce a redundant message
53=BDFMPU  008/07-10=||||    T 008/06=|           1:5 If Date 1 contains fill characters, Date type must also be fill character
61=BDFMPU  008/11-14=||||    T 008/06=|           1:5 If Date 2 contains fill characters, Date type must also be fill character
301=S       008/18={_bfmqz}  T 008/19={rx}        1:5 Regularity does not correspond to Frequency
302=S       008/18=u         T 008/19=u           1:5 Regularity does not correspond to Frequency
88=M        008/18-19=mu     T 047                1:5 047 field required if Type of composition is 'mu'
# since at NUL we're not allowing the fill character in the 008 anyway,
#   tests 71, 93, 75, 90 and 92 may produce a redundant message
71=B        <6:008/18-21,|>  T 008/18-21=||||     1:5 If any Illustration code is fill character, all must be fill
73=B        008/18-21!____ AND 008/18-21!|||| T <7> 1:5 300 field does not correspond to Illustration codes
# 008/23-27 are now obsolete in the visual materials format
#93 F       <6:008/23-27,|>  T 008/23-27=|||||
75=B        <6:008/24-27,|>  T 008/24-27=||||     1:5 If any Contents code is fill character, all must be fill
375=B       <6:008/24-27,bq>! T 504!              1:5 Contents code does not indicate bibliography, but 504 field is present
376=B       <6:008/24-27,n>  T <6:008/24-27,b>!   1:5 Contents code may not include 'b' if 'n' present
90=M        <6:008/24-29,|>  T 008/24-29=||||||   1:5 If any Accompanying material code is fill character, all must be fill
79=P        008/25={abce}    T 007/00=a           5:9 Type of cartographic material does not correspond with Bibliographic level
81=P        008/25=c         T 310                1:5 310 field required
80=P        008/25=d         T 007/00=d           1:5 007/d field required
92=M        008/30=| OR 008/31=| T 008/30-31=||   1:5 If any Literary text is fill character, both must be fill
304=B       008/33=1         T 008/34=_ OR 008/34=| 5:5 If this is Fiction, it can't also be Biography
372=B       008/34={ab}      T 600                1:5 600 field needed (to match Biography code)?
366=S       008/34=0         T 247!               5:9 247 field not allowed if Successive/Latest is 0
367=S       008/34=0 AND <14:1XX,<,1> T 550!      5:9 550 field not allowed without 1XX field
368=S       008/34=1         T 247 OR 550         5:9 Either 247 or 550 field required if Successive/Latest is 1
336=BDFMPSU 008/39=_         T 040/a=DLC*         1:5 040/a should begin DLC if Cataloging source is 'blank'
337=BDFMPSU 008/39=c         T 040/a!DLC          1:5 040/a should not be 'DLC' if Cataloging source is 'c'
69=P        008/39={cd}      T 040                5:9 040 field required
338=BDFMPSU 008/39=d         T 040/a!DLC*         5:9 040/a should not begin 'DLC' if Cataloging source is 'd'
# rule 335 is enforced by OCLC
335=BDFMPSU 008/39=u         T 040!               5:9 040 field not allowed if Cataloging source is 'u'
97=BDFMPSU  010              T 010/a OR 010/b OR 010/z 5:9 Subfield missing in 010 field
98=U        010/a            T 010/a!ms*          1:5 010/a may not begin 'ms'
102=BDFMPSU 020              T 020/a OR 020/c OR 020/z 5:9 Subfield $a, $c or $z required in 020 field
# 020/b, now obsolete, was only defined in BMU, so if present
#   in other records it should get complained about, anyway
103=BDFMPSU 020/b            T 000/18!a           1:5 020/b not allowed in AACR2 records
104=BDFMPSU 022              T 022/a OR 022/y OR 022/z 5:9 Subfield missing in 020 field
105=BDFMPSU 024              T 024/a OR 024/z     5:9 Subfield missing in 020 field
# 028/a is already mandatory for all formats at NUL; tests 261 and
#   262 may then be LC-specific
#261 M      028              T 028/a              
#262 BDFPU  028              T 028/a OR 028/b
# LC requires 033/a or 033/b in maps but a, b or c in other formats; this
#   doesn't seem unreasonable
106=BDFMSU  033              T 033/a OR 033/b OR 033/c 5:9 Subfield missing in 033 field
107=P       033              T 033/a OR 033/b     5:9 Subfield missing in 033 field
# 034/255 may indeed normally only be used in map records, but it seems
#   prudent to enforce this consistency everywhere
113=BDFMPSU 034              T <15:034,255>       5:9 255 required when 034 is present
# rule 108 cancelled; now handled as a coded subfield
#108 BDFMPSU 034/a           T 034/a=a OR 034/a=b OR 034/a=z 
115=BDFMPSU 035              T 035/a OR 035/z OR 035/9 5:9 Subfield missing in 035 field
# some "formats" may have summaries, librettos, etc, without having
#   a "main text" language--so we're differentiating here by format
120=DFM     041              T 041/a OR 041/b OR 041/d OR 041/e OR 041/f OR 041/g 5:98 Subfield missing in 041 field
121=BPUS    041              T 041/a              5:9 Subfield $a required in 041 field
64=BDFMPSU  041/a AND 008/35-37!||| T <2:008/35-37,041/a> 1:5 041 $a does not agree with Language code
342=BDFMPSU 041/d AND 008/35-37!||| T <2:008/35-37,041/d> 1:5 041 $d does not agree with Language code
339=BDFMPSU 041/h            T 041:1=1            5:9 041 $h calls for first indicator=1
# see the following parallel rule for books
340=DFMPSU  041:1=1          T 041/h              5:9 041 first indicator=1 calls for $h
# note in the following that for items cataloged through 1989, we
#   do not enforce the must-have-h rule, as LC didn't use $h in books records
#   until 1989
375=B       041:1=1 AND <11:1989,>> T 041/h       5:9 041 first indicator=1 calls for $h
# rule 26 appears LC-specific
#26 P       042              T 000/17!7
123=BDFMPSU 043              T 043/a OR 043/b    5:9 Subfield $a or $b required in 043
470=BDFMPSU 043/a            T <14:043/a,<=,3>      5:9 043 $a repeats too many times
124=BDFMPSU 044              T 044/a OR 044/b OR 044/c 5:9 044 requires $a, $b or $c
63=BDFMPSU  044/a AND 008/15-17!||| T <2:008/15-17,044/a> 5:9 044/a should match Country code
# for maps, LC does not require subfield $a in the 045 field
126=BDFMSU  045              T 045/a OR 045/b OR 045/c 5:9 045 requires $a or $b or $c
127=P       045              T 045/b OR 045/c     5:9 045 requires $b or $c
606=BDFMPSU 045:1=_          T 045/b! AND 045/c!  5:9 If 045 1st indicator blank, no $b or $c
604=BDFMPSU 045:1=1          T <14:045/b,>,1> OR <14:045/c,>,1> 5:9 If 045 1st indicator is 1, need multiple $b or $c
605=BDFMPSU 045:1=2          T <14:045/b,>,1> OR <14:045/c,>,1>  5:9 If 045 1st indicator is 2, need multiple $b or $c
607=BDFMPSU <14:045/b,>,1>   T 045:1=1 OR 045:1=2 5:9 If multiple $b in 045, 1st indicator must be 1 or 2
608=BDFMPSU <14:045/c,>,1>   T 045:1=1 OR 045:1=2 5:9 If multiple $c in 045, 1st indicator must be 1 or 2
800=BDFMPSU 045/a            T <10:045/a>         1:3 Improper 045 subfield $a
801=BDFMPSU 045/b            T <10:045/b>         1:3 Improper 045 subfield $b
802=BDFMPSU 045/c            T <10:045/c>         1:3 Improper 045 subfield $c
# 046/a now done as coded subfield
344=BDFMPSU 046              T 008/06=b           5:9 If 046 present, Date type must be 'b'
130=M       047              T 008/18-19=mu       5:9 If 047 present, Form of composition must be 'mu'
# $a is required in the 050 at NUL; this enforces an additional
#   requirement for maps only
134=P       050/a            T 050/b              5:9 Subfield $b required in 050 field
# 051 subfield $a was at one time not required; it is required in NUL's
#   tag table, but in bibsup.cfg it is marked as not required before 1980
# test 263 is probably LC-specific
#263 M      051              T 051/a
# this test is probably redundant, as $a and $c are required; escept $a isn't
#   required before 1980
#264 BFU    051              T 051/a OR 051/c
# this may be redundant with the above; 1980- will probably be AACR2 anyway
# remember that for P, $a is already required in all cases so it doesn't
#   need to be included here
138=BDFMSU  051 AND 000/18=a T 051/a AND 051/c    1:3 Subfields $a and $c required in 051 if AACR2
141=BDFMPSU 066              T 066/a OR 066/b OR 066/c 1:3 066 requires $a, $b or $c
142=BDFMPSU 072:2=7          T 072/2              5:9 If 072 2nd indicator is 7, $2 required
143=BDFMPSU 072/2            T 072:2=7            5:9 If 072 has $2, 2nd indicator mut be 7
144=BDFMPSU 074              T 074/a OR 074/z     5:9 074 requires $a or $z
701=BDFMPSU 082/2            T 082/2=11* OR 082/2=12* OR 082/2=13* OR 082/2=19* OR 082/2=20* OR 082/2=21* 5:9 082/2 contains unrecognized code
147=BDFMPSU 086              T 086/a OR 086/z     5:9 086 requires $a or $z
702=BDFMPSU 086:1={01}       T 086/2!             5:9 086/2 not permitted if 1st ind. is 0 or 1
149=BDFMPSU 088              T 088/a OR 088/z     5:9 088 requires $a or $z
# test 28 is probably LC-specific
#28 P       090              T 000/17!_
# at NUL, 090/a is already required; there doesn't seem to be any
#   point to requiring 090/b
#266 P      090              T 090/a AND 090/b
# this test is probably LC-specific
#267 P      097              T 097/a AND 097/b
153=BDFMPSU 100              T <14:1XX,<=,1>      9:9 Record may have only one 1XX field
345=BDFMPSU 100:1=3          T 000/18!a           5:9 100 1st indicator 3 not allowed if AACR2
346=BDFMPSU 100/b AND 000/18=a T 100:1=0          5:9 100 $b calls for 1st indicator 0
153=BDFMPSU 110              T <14:1XX,<=,1>      9:9 Record may have only one 1XX field
153=BDFMPSU 111              T <14:1XX,<=,1>      9:9 Record may have only one 1XX field
158=BDFMPSU 111/b            T 000/18!a           5:9 111 $b not allowed if AACR2
305=BDFMPSU 111:1=1          T 000/18!a           5:9 111 1st indicator 1 not allowed if AACR2
153=BDFMPSU 130              T <14:1XX,<=,1>      9:9 Record may have only one 1XX field
# it really doesn't seem to be necessary to include both
#   tests 8 and 10; one seems pretty much to do the work of
#   the other
#8 BDFMPU   222              T 000/07!{acdm}
10=BDFMPU   222              T 000/07={bs}        5:9 If 222 present, Bib level must be 'b' or 's'
154=BDFMPSU 240              T <14:1XX,>,0>       9:9 240 field requires 1XX
369=BDFMPSU 240              T 130! AND 243!      9:9 If 240 present then no 130 or 243
371=BDFMPSU 243              T <14:1XX,>,0>       9:9 243 field requires 1XX
370=BDFMPSU 243              T 130! AND 240!      9:9 If 243 present then no 130 or 240
347=BDFMPSU 243 AND 000/18=a T 243:2=0            5:9 243 2nd indicator not 0 if AACR2
# subfield $a is required for everything except archival stuff, which
#   must have either $a or $k
165=BDFMPS  245              T 245/a              9:9 245 requires $a
166=U       245              T 245/a OR 245/k     9:9 245 requires $a or $k
348=BDFMPSU 245 AND 000/18={ia} T 245/c           0:1 ISBD calls for 245/c?
# not entirely sure how far to extend this requirement for the
#   007.  shouldn't be required for computer files, which will have
#   have 245/h all the time
912=BDFMPSU 245:1=0          T <14:1XX,=,0>       3:5 Check 1st indicator in 245
913=BDFMPSU 245:1=1          T <14:1XX,=,1>       3:5 Check 1st indicator in 245
917=BDFMPSU 245/a=*_:*       T 245/b              3:5 245 needs $b code
915=BDFMPSU 245/a=*_/*       T 245/c              3:5 245 needs $c code
916=BDFMPSU 245/b=*_/*       T 245/c              3:5 245 needs $c code
919=BDFMPSU 245/b AND 000/18={iapr} T 245/a=*_:* OR 245/a=*_=* OR 245/a=*_;* OR 245/b=*_:* OR 245/h=*_:* OR 245/h=*_=* 3:5 Space-colon needed in 245?
918=BDFMPSU 245/c=*_:*       T 245/b              3:5 245 needs $b code
920=BDFMPSU 245/c AND 000/18={iapr} T 245/a=*_/* OR 245/b=*_/* OR 245/h=*_/* OR 245/n=*_/* OR 245/p=*_/* 3:5 Space-slash needed in 245?
41=BU       245/h            T 007                5:9 007 required to go with 245 $h
114=BDFMPSU 255              T <15:255,034>       5:9 Equal number of 034 and 255 required
# it's quite possible that only LC is interested in
#   this test; in any case, I'm not going to be doing
#   the programming
#174 P      255              T <30:255>
401=BDFMPSU 260              T 261! AND 262!      5:9 If 260 present, no 261 or 262
175=BDFMPSU 260/d            T 000/18!a           5:9 260 $d allowed only if AACR2
# by expanding test 350 to cover all formats, we are de facto
#   limiting the appearance of 260/d to "score" records, which
#   is the desired effect
350=BDFMPSU 260/d            T 000/06=c           5:9 260 $d only allowed in 'score' records
349=BDFMPSU 260/e OR 260/f OR 260/g T 000/18=a    1:3 If 260 $e, $f or $g, must be AACR2
402=BDFMPSU 261              T 260! AND 262!      5:9 If 261 present, no 260 or 262
351=BDFMPSU 261              T 000/18!a           5:9 261 not allowed if AACR2
403=BDFMPSU 262              T 260! AND 261!      5:9 If 262 present, no 260 or 261
352=BDFMPSU 262              T 000/18!a           5:9 262 not allowed if AACR2
176=BDFMPSU 263              T <10:263/a>         1:3 Improper format for 263 field
# rule 30 is probably LC-specific, but it won't be a bad idea to
#   complain if the 260 shows up unnecessarily
30=BDFMPSU  263              T 000/17=8           5:9 If 263 present, must be CIP
404=BDFMPSU 300              T 301! AND 305!      5:9 If 300 present, no 301 or 305
177=P       300              T 300/a AND 300/c    5:9 300 field requires $a and $c
710=BDFMPSU 300!             T 300!               1:3 Should record include a 300 field?
921=BDFMPSU 300/a=*_:*       T 300/b              3:5 300 needs $b code
923=BDFMPSU 300/a=*_;*       T 300/c              3:5 300 needs $c code
924=BDFMPSU 300/b AND 000/18={iapr} T 300/a=*_:*  3:5 Space-colon needed in 300?
922=BDFMPSU 300/b=*_;*       T 300/c              3:5 300 needs $c code
925=BDFMPSU 300/c AND 000/18={iapr} T 300/a=*_;* OR 300/b=*_;* 3:5 Space-semicolon needed in 300?
405=BDFMPSU 301              T 300! AND 305!      5:9 If 301 present, no 300 or 305
416=BDFMPSU 301              T 000/18!a           5:9 301 not allowed if AACR2
406=BDFMPSU 305              T 300! AND 301!      5:9 If 305 present, no 300 or 301
353=BDFMPSU 305              T 000/18!a           5:9 305 not allowed if AACR2
# LC's rule 13 is redundant with its own rule 12 as stated here
#13 P       310              T 000/07!{acdm}
# we'll leave "B" here so that 310 fields in book records may properly
#   be complained about
12=BDFMPSU  310              T 000/07={bs}        5:9 310 field only allowed if Bib level 'b' or 's'
82=P        310              T 008/25!{abde}      5:9 310 field not allowed if Type of cartog material not 'a' 'b' 'd' or 'e'
183=BDFMPSU 340              T 340/a OR 340/b OR 340/c OR 340/d OR 340/e OR 340/f OR 340/h OR 340/i 3:5 340 requires $a $b $c $d $e $f $h or $i
184=BDFMPSU 342              T 342/a OR 342/w     3:5 342 requires $a or $w
# since we're deleting the 350 field via a force rule, there doesn't
#   seem to be much point in enforcing any of the rules regarding the 350
#185 D      350              T 350/a OR 350/b
#186 D      350              T 000/07={sb}
#187 B      350              T 000/18!a
188=BDFMPSU 351              T 351/a OR 351/b OR 351/c  3:5 351 field requires $a $b or $c
189=BDFMPSU 352              T 352/a OR 352/i     3:5 352 field requires $a or $i
# test 9 achieves the same result as 191   
#9 P        362              T 000/07!{acdm}      
191=BDFMPSU 362              T 000/07={bs}        5:9 362 field only allowed if Bib level 'b' or 's'
245=P       362              T 008/25!{abde}      5:9 362 field only allowed if Type of cartog material not 'a' 'b' 'd' or 'e'
354=BDFMPSU 362:1=0          T <14:362:1=0,<=,1>  5:9 No more than 1 formatted 362 field per record
38=BDFMPSU  400              T 000/18!a           5:9 400 not allowed if AACR2
923=BDFMPSU 400/t=*_;*       T 400/v              3:5 400 needs $v code
360=BDFMPSU 400/b AND 000/18=a T 400:1=0          5:9 400 $b calls for 1st indicator 0
156=BDFMPSU 400:2=1          T 100                5:9 400 calls for 100 field
440=BDFMPSU 400/x            T 000/18={ai}        5:9 400 $x only if ISBD or AACR2
610=BDFMPSU 400/x            T <10:400/x>         3:5 Invalid ISSN in 400 field
39=BDFMPSU  410              T 000/18!a           1:3 410 not allowed if AACR2
157=BDFMPU  410:2=1          T 110                5:9 410 calls for 110 field
924=BDFMPSU 410/t=*_;*       T 410/v              3:5 410 needs $v code
441=BDFMPSU 410/x            T 000/18={ai}        5:9 410 $x only if ISBD or AACR2
613=BDFMPSU 410/x            T <10:410/x>         3:5 Invalid ISSN in 410 field
# tests 306 and 200 are redundant with 40; allowed to stand until
#   review of all rules for format-based restrictions is complete
40=BDFMPSU  411              T 000/18!a           5:9 411 not allowed if AACR2
306=BDFMPSU 411:1=1          T 000/18!a           5:9 411 1st indicator 1 not if AACR2
159=BDFMPSU 411:2=1          T 111                5:9 411 field calls for 111 field
925=BDFMPSU 411/t=*_;*       T 411/v              3:5 410 needs $v code
200=BDFMPSU 411/b            T 000/18!a           5:9 411 $b not allowed if AACR2
442=BDFMPSU 411/x            T 000/18={ai}        5:9 411 $x only if ISBD or AACR2
611=BDFMPSU 411/x            T <10:411/x>         3:5 Invalid ISSN in 411 field
355=U       440              T 000/18!a           5:9 440 not allowed if AACR2
926=BDFMPSU 440/a=*_;*       T 440/v              3:5 440 needs $v code
443=BDFMPSU 440/x            T 000/18={ai}        5:9 440 $x only if ISBD or AACR2
612=BDFMPSU 440/x            T <10:440/x>         3:5 Invalid ISSN in 440 field
356=U       490              T 000/18!a           5:9 490 not allowed if AACR2
202=BDFMPSU 490:1=1          T <14:8XX,>,0>       5:9 490:1=1 calls for 8XX field
927=BDFMPSU 490/a=*_;* AND <11:1980,>> T 490/v    3:5 490 needs $v code
614=BDFMPSU 490/x            T <10:490/x>         3:5 Invalid ISSN in 490 field
203=BDFMPSU 505              T 505/a OR 505/t     5:9 505 calls for $a or $t
327=BDFMPSU 505:2=_          T 505/g! AND 505/r! AND 505/t! 5:9 If 505 2nd indicator blank, no $g or $r
325=BDFMPSU 505:2=0          T 505/a!             5:9 If 505 2nd indicator 0, no $a
326=BDFMPSU 505/a            T 505:2=_            5:9 If 505 $a present, 2nd indicator must be blank
# here's one that LC missed; clean up premarc complete-contents notes:
#   BDFMPSU 505/a AND 505:1=0 T <23:505/a,.->
204=BDFMPSU 505/t            T 505:2=0            5:9 If 505 $t present, 2nd indicator must be 0
# test 34 is probably LC-specific
#34 P       507              T 000/17!{17}
207=BDFMPSU 507              T 000/18!a           5:9 507 not allowed if AACR2
357=BDFMPSU 510:1=4          T 510/c
615=BDFMPSU 534/x            T <10:534/x>
616=BDFMPSU 534/z            T <10:534/z>
209=BDFMPSU 536              T 536/a OR 536/b OR 536/c OR 536/d
358=BDFMPSU 546              T 041                0:1 If 546 present, 041 required
210=BDFMPSU 551              T 551/a OR 551/o
617=BDFMPSU 556/z            T <10:556/z>
211=BDFMPSU 562              T 562/a OR 562/b OR 562/c OR 562/d OR 562/e
212=BDFMPSU 583              T 583/a OR 583/b
213=BDFMPSU 584              T 584/a OR 584/b
373=B       600/x=Biography OR 600/v=Biography T 008/34!_  1:3 600 'biography' field present; Biography code may need adjusted
215=BDFMPSU 600:2=7          T 600/2              5:9 600 2nd indicator 7 calls for subfield $2  
359=BDFMPSU 600/b AND 000/18=a T 600:1=0          5:9 600 $b calls for 1st indicator 0
# 328 is covered by CompareSubjectsTo043 property
#328 BDFMPSU 600/z AND 600:2={024} T 043
# 331 is now covered by CompareSubjectsTo043 property
#331 BDFMPSU 610:1=1 AND 610:2={024} T 043
218=BDFMPSU 610:2=7          T 610/2              5:9 610 2nd indicator 7 calls for subfield $2  
#329 is covered by CompareSubjectsTo043 property
#329 BDFMPSU 610/z  AND 610:2={024} T 043
307=BDFMPSU 611:1=1          T 000/18!a           5:9 611 1st indicator 1 not if AACR2
221=BDFMPSU 611:2=7          T 611/2              5:9 610 2nd indicator 7 calls for subfield $2  
223=BDFMPSU 611/b            T 000/18!a           5:9 611 $b not allowed if AACR2
#330 is covered by CompareSubjectsTo043 property
#330 BDFMPSU 611/z AND 611:2={024} T 043
225=BDFMPSU 630:2=7          T 630/2              5:9 630 2nd indicator 7 calls for subfield $2  
#332 is covered by CompareSubjectsTo043 property
#332 BDFMPSU 630/z AND 630:2={024} T 043
228=BDFMPSU 650:2=7          T 650/2              5:9 650 2nd indicator 7 calls for subfield $2  
362=BDFMPSU 650/b            T 000/18!a           5:9 Cannot have 650 $b if AACR2
#333 is covered by CompareSubjectsTo043 property
#333 BDFMPSU 650/z AND 650:2={024} T 043
233=BDFMSU  651              T 651/a
234=P       651              T 651/a AND 651/v    5:9 For maps, $a and $v required in 651
#334 is covered by CompareSubjectsTo043 property
#334 BDFMPSU 651 AND 651:2={024} T 043
231=BDFMPSU 651:2=7          T 651/2              5:9 630 2nd indicator 7 calls for subfield $2  
702=BDFMPSU 655              T 655/2              5:9 655 field requires subfield $2
363=BDFMPSU 700:1=3          T 000/18!a           5:9 700 1st indicator not 3 if AACR2
361=BDFMPSU 700/b AND 000/18=a T 700:1=0          1:3 In AACR2 records, 700/b allowed only if 1st indicator 0
620=BDFMPSU 700/x            T <10:700/x>         1:3 Invalid ISSN in 700 field
621=BDFMPSU 710/x            T <10:710/x>         1:3 Invalid ISSN in 710 field
308=BDFMPSU 711:1=1          T 000/18!a           5:9 711 1st indicator 1 not if AACR2
235=BDFMPSU 711/b            T 000/18!a           5:9 711 $b not allowed if AACR2
622=BDFMPSU 711/x            T <10:711/x>
623=BDFMPSU 730/x            T <10:730/x>
237=BDFMPSU 753              T 753/a OR 753/b OR 753/c
624=BDFMPSU 760/x            T <10:760/x>         1:3 Invalid ISSN in 760$x
625=BDFMPSU 762/x            T <10:762/x>         1:3 Invalid ISSN in 762 $x
626=BDFMPSU 765/x            T <10:765/x>         1:3 Invalid ISSN in 765 $x
627=BDFMPSU 765/z            T <10:765/z>         1:3 Invalid ISBN in 765 $z
629=BDFMPSU 767/x            T <10:767/x>         1:3 Invalid ISSN in 767 $x
630=BDFMPSU 767/z            T <10:767/z>         1:3 Invalid ISBN in 766 $z
631=BDFMPSU 770/x            T <10:770/x>         1:3 Invalid ISSN in 770 $x
632=BDFMPSU 770/z            T <10:770/z>         1:3 Invalid ISBN in 770 $z
633=BDFMPSU 772/x            T <10:772/x>         1:3 Invalid ISSN in 772 $x
634=BDFMPSU 772/z            T <10:772/z>         1:3 Invalid ISBN in 772 $z
# our rule 422 replaces rules 238 and 239
422=BDFMP   773              T 000/07={abd}       3:5 If 773 present, Record type must be a, b or d
#238 DP     773              T 000/07={abd}
#239 FM     773              T 000/07={ad}
635=BDFMPSU 774/x            T <10:774/x>         1:3 Invalid ISSN in 774 $x
636=BDFMPSU 774/z            T <10:774/z>         1:3 Invalid ISBN in 774 $z
637=BDFMPSU 775/x            T <10:775/x>         1:3 Invalid ISSN in 775 $x
638=BDFMPSU 775/z            T <10:775/z>         1:3 Invalid ISBN in 775 $z
639=BDFMPSU 776/x            T <10:776/x>         1:3 Invalid ISSN in 776 $x
640=BDFMPSU 776/z            T <10:776/z>         1:3 Invalid ISBN in 776 $z
641=BDFMPSU 777/x            T <10:777/x>         1:3 Invalid ISSN in 777 $x
642=BDFMPSU 777/z            T <10:777/z>         1:3 Invalid ISBN in 777 $z
643=BDFMPSU 780/x            T <10:780/x>         1:3 Invalid ISSN in 780 $x
644=BDFMPSU 780/z            T <10:780/z>         1:3 Invalid ISBN in 780 $z
645=BDFMPSU 785/x            T <10:785/x>         1:3 Invalid ISSN in 785 $x
646=BDFMPSU 785/z            T <10:785/z>         1:3 Invalid ISBN in 785 $z
647=BDFMPSU 786/x            T <10:786/x>         1:3 Invalid ISSN in 786 $x
648=BDFMPSU 786/z            T <10:786/z>         1:3 Invalid ISBN in 786 $z
649=BDFMPSU 787/x            T <10:787/x>         1:3 Invalid ISSN in 787 $x
650=BDFMPSU 787/z            T <10:787/z>         1:3 Invalid ISBN in 787 $z
364=BDFMPSU 800:1=3          T 000/18!a           5:9 800 1st indicator not 3 if AACR2
365=BDFMPSU 800/b AND 000/18=a T 800:1=0          1:3 In AACR2 records, 800/b allowed only if 1st indicator 0
930=BDFMPSU 800/t=*_;*       T 800/v              3:5 800 needs $v code
934=BDFMPSU 800/v AND 000/18={iapr} T 800/t=*_;* OR 800/n=*_;* OR 800/p=*_;* OR 800/s=*_;* OR 800/f=*_;* 3:5 800 needs space-semicolon?
931=BDFMPSU 810/t=*_;*       T 810/v              3:5 810 needs $v code
935=BDFMPSU 810/v AND 000/18={iapr} T 810/t=*_;* OR 810/n=*_;* OR 810/p=*_;* 3:5 810 needs space-semicolon?
309=BDFMPSU 811:1=1          T 000/18!a           5:9 811 1st indicator 1 not if AACR2
240=BDFMPSU 811/b            T 000/18!a           5:9 811 $b not allowed if AACR2
932=BDFMPSU 811/t=*_;*       T 811/v              3:5 811 needs $v code
936=BDFMPSU 811/v AND 000/18={iapr} T 811/t=*_;* OR 811/n=*_;* OR 811/p=*_;* 3:5 811 needs space-semicolon?
933=BDFMPSU 830/a=*_;*       T 830/v              3:5 830 needs $v code
936=BDFMPSU 830/v AND 000/18={iapr} T 830/a=*_;* OR 830/n=*_;* OR 830/p=*_;* 3:5 830 needs space-semicolon?
# tests 33, 35 and 36 are LC-specific
#33 B       905              T 000/17=8
#35 P       952              T 000/17!1
#36 P       957              T 000/17!1

[FieldOrder]
0=Generic
1=Tag
2=Tag
3=Tag
4=Generic
5=Generic
6=Indicator2
7=Tag
8=Generic
9=Tag

[SubfieldOrder]
010=abz
013=6a{#bcdef}
015=a6
016=az2
017=6ab
# 018 a
020=6{#abcz}
022=6{#ayz}
024=6{#acdz}2
#025 a
027=az
028=6ab
030=6az
032=6ab
033=6abc3
034=6a{#bcdefghjkmnpst}
035=6az
036=6ab
037=6a{#bcfgn}
040=6abcde
041=6a{#bdefgh}
#042 a
043=ab2
044=abc2
045=abc
046=abcde
#047 a
048=ab
050={#ab}3
051={#abc}
052=ab
055=ab2
060={#ab}
061={#abc}
066={abc}
070={#ab}
071={#abc}
072=6ax2
074=az
#080 a
082={#ab}2
084=6{#ab}2
086=6{#az}2
088=6az
#
100=6a{#bcdgq}{eu4}{!tfgklnp}
110=6a{#bcdgkn}{eu4}{!tdfghlkmnoprs}
111=6a{#bcdegnq}{u4}{!tfhklnps}
130=6a{#dfghklmnoprst}
#
210=6ab
222=6ab
240=6a{#dfghklmnoprs}
242=6a{#bchnpy}
243=6a{#dfghklmnoprs}
245=6a{#bcfghknps}
246=6{i}{!abfghnp}5
247=6a{#bfghnpx}
250=6ab
254=6a
255=6abcdefg
256=6a
257=6a
260=6{#abcdefg}
261=6{#abdef}
262=6{#abckl}
#263 a
270=6{#abcdefghijklmnpqrz4}
#
300=6{#abcefg}3
#306 a
307=6ab
310=6ab
321=6ab
340=6{#abcdefhi}3
342=6{#abcdefghijklmnopqrstuvw}2
343=6{#abcdefghi}
351=6{#abc}3
352=6{#abcdefgi}
355=6{#abcdefghj}
357=6{#abcg}
362=6az
#
400=6a{#qbcdek}{u4}{!tkfghlmnoprs}{#vx}
410=6a{#bcdgkn}{eu4}{!tfhldgknmoprs}{#vx}
411=6a{#bqdceng}{u4}{!tnfhklps}{#vx}
440=6{#anpxv}
490=6{#alvx}
500=6a35
501=6a5
502=6a
504=6ab
505=6{#agrt}
506=6a{#bcde}35
507=6ab
508=6a
510=6a{#bcx}36
511=6a
513=6ab
514=6a{#bcdefghijkm}
515=6a
516=6a
518=6a3
520=6ab3
521=6ab3
522=6a
524=6a23
525=6a
530=6abcd3
533=6a{#bcd}efmn37
534=6patbmceflnzxk
535=6a{#bcdg}3
536=6a{#bcdefgh}
538=6a
540=6abcd35
541=6abcdefhno35
544=6{#abcden}3
545=6ab
546=6ab3
547=6a
550=6a
551=6a{#bcdefghijklmnop}
555=6a{#bcd}3
556=6az
561=6a35
562=6{#abcde}35
565=6a{#bcde}3
567=6a
580=6a
581=6az3
583=6a{#bcdefhijklnoxz}35
584=6ab35
585=6a35
586=6a3
#
600=6a{#bcdgq}{eu4}{!tfgklnp}{#vxyz}23
610=6a{#bcdgkn}{eu4}{!tfhldgknmoprs}{#vxyz}23
611=6a{#bqdceng}{u4}{!tnfhklps}{#vxyz}23
630=6a{#nplfksdhmorgt}{#vxyz}23
650=6a{#bcde}{#vxyz}23
651=6a{#vxyz}23
653=6a
654={#abcvyz}23
655=6a{#bc}{#vxyz}235
656=6ak{#vxyz}23
657=6a{#vxyz}23
658=6a{#bcd}2
#
700=6a{#qbcdek}{u4}{!tkfghlmnoprsx}35
710=6a{#bcdgkn}{eu4}{!tfhldgknmoprsx}35
711=6a{#bqdceng}{u4}{!tnfhklpsx}35
720=6a{e4}
730=6a{#nplfksdhmorgtx}35
740=6a{#hnp}5
752=6abcd
753=6abc
754=6a2
760=67{#abcdghimnoswxy}
762=67{#abcdghimnostwxy}
765=67{#abcdghikmnorstvwxyz}
767=67{#abcdghikmnorstuwxyz}
770=67{#abcdghikmnorstuwxyz}
772=67{#abcdghikmnorstuwxyz}
773=67{#abdghikmnoprstuwxyz}3
774=67{#abcdghikmnorstuwxyz}
775=67{#abcdefghikmnorstuwxyz}
776=76{#abcdghikmnorstuwxyz}
777=67{#abcdghikmnostwxy}
780=67{#abcdghikmnorstuwxyz}
785=67{#abcdghikmnorstuwxyz}
786=67{#abcdghijkmnorstuvwxyz}
787=67{#abcdghikmnorstuwxyz}
#
800=6a{#qbcdek}{u4}{!tkfghlmnoprs}v
810=6a{#bcdgkn}{eu4}{!tfhldgknmoprs}v
811=6a{#bqdceng}{u4}{!tnfhklps}v
830=6a{#nplfksdhmorgt}v
# no subfield-order definitions for 841-88X

[BuiltInErrors]
FfdUndefined=1:3
FfdObsolete=0:0
TagObsolete=0:0
IndicatorObsolete=0:0
SubfieldCodeObsolete=0:0
TagUndefined=9:9
IndicatorUndefined=1:9
SubfieldUndefined=9:9
SubfieldRepeated=1:3
MandatorySubfield=9:9
FieldNotRepeatable=1:9
SubjectsDontMatch043=5:9
MandatoryField=9:9
RelatorNotDefined=0:3
RelatorObsolete=0:1
SubfieldIn041NotMultipleOf3=5:9
CodeInCodedFieldNotDefined=5:9
SubfieldIn041HasOver6Codes=5:9
CodeIn041BAppearsIn041A=5:9
SubfieldRepeatedTooMuch=5:9
CodeObsolete=0:0
New043Codes=1:9
Move010AToZ=0:0
IndicatorOf4xxShouldBe1=5:9
SecondIndicatorOf4xxImproperly1=5:9
Need1xxFor4xx=5:9
TagOf4xxDoesNotMatch1xx=5:9
PccElAnd042Disagree=1:3
PccSrcAnd042Disagree=1:3
PccElAndSrcCallFor042=1:3
SeriesVXOutOfOrder=1:3
InitialArticle=5:9
InitialArticleOrNumeral=5:9
ImproperControlSubfield=5:9
EmptySubfield=9:9
SubfieldsOutOfOrder=3:5
FieldsOutOfOrder=3:5
SubfieldBlank=9:9