'MacroName:upgrade151 'MacroDescription:adds 043 and 781 to geographic authority records 'written by John Lavalie, Apr. 25, 2005 Sub Main Dim CS As Object Set CS = CreateObject("Connex.Client") dim stfull(100) as String dim stALA(100) as String subfieldz$ = chr$(223) + "z" bool = CS.getfield(781, 1, heading$) if heading$ = "" then bool = CS.getfield(151, 1, heading$) bool = CS.getfield(410, 1, tag410$) bool = CS.getfixedfield("Subj use", subj$) pos = instr(heading$, "(") if subj$ <> "b" and tag410$ = "" then if pos <>0 then 'city state$ = mid$(rtrim(heading$), pos + 1, len(heading$) - pos - 1) city$ = rtrim(mid$(heading$, 6, pos - 6)) pos1 = instr(state$, ":") pos2 = instr(state$, ",") if pos1 <> 0 and pos2 <> 0 then 'ex.: Vernon (Lake County, Ill. : Township) statebegin = pos2 + 1 stateend = pos1 - 2 qual$ = left$(state$, statebegin - 2) + mid$(state$, stateend + 1) state$ = mid$(state$, statebegin + 1, stateend - statebegin) else if pos1 <> 0 then 'ex.: Maine (Ill. : Township) qual$ = mid$(state$, pos1 + 2) state$ = left$(state$, pos1 - 2) else if pos2 <> 0 then 'ex.: Lake Villa (Lake County, Ill.) qual$ = left$(state$, pos2 - 1) state$ = mid$(state$, pos2 + 2) end if end if end if stALA(1) = "Ala." : stFull(1) = "Alabama" stALA(2) = "Ariz." : stFull(2) = "Arizona" stALA(3) = "Ark." : stFull(3) = "Arkansas" stALA(4) = "Calif." : stFull(4) = "California" stALA(5) = "Colo." : stFull(5) = "Colorado" stALA(6) = "Conn" : stFull(6) = "Connecticut" stALA(7) = "Del." : stFull(7) = "Delaware" stALA(8) = "Fla." : stFull(8) = "Florida" stALA(9) = "Ga." : stFull(9) = "Georgia" stALA(10) = "Ill." : stFull(10) = "Illinois" stALA(11) = "Ind." : stFull(11) = "Indiana" stALA(12) = "Kan." : stFull(12) = "Kansas" stALA(13) = "Ky." : stFull(13) = "Kentucky" stALA(14) = "La." : stFull(14) = "Louisiana" stALA(15) = "Me." : stFull(15) = "Maine" stALA(16) = "Md." : stFull(16) = "Maryland" stALA(17) = "Mass." : stFull(17) = "Massachusetts" stALA(18) = "Mich." : stFull(18) = "Michigan" stALA(19) = "Minn." : stFull(19) = "Minnesota" stALA(20) = "Miss." : stFull(20) = "Mississippi" stALA(21) = "Mo." : stFull(21) = "Missouri" stALA(22) = "Mont." : stFull(22) = "Montana" stALA(23) = "Neb." : stFull(23) = "Nebraska" stALA(24) = "Nev." : stFull(24) = "Nevada" stALA(25) = "N.H." : stFull(25) = "New Hampshire" stALA(26) = "N.J." : stFull(26) = "New Jersey" stALA(27) = "N.M." : stFull(27) = "New Mexico" stALA(28) = "N.Y." : stFull(28) = "New York (State)" stALA(29) = "N.C." : stFull(29) = "North Carolina" stALA(30) = "N.D." : stFull(30) = "North Dakota" stALA(31) = "Okla." : stFull(31) = "Oklahoma" stALA(32) = "Or." : stFull(32) = "Oregon" stALA(33) = "Pa." : stFull(33) = "Pennsylvania" stALA(34) = "R.I." : stFull(34) = "Rhode Island" stALA(35) = "S.C." : stFull(35) = "South Carolina" stALA(36) = "S.D." : stFull(36) = "South Dakota" stALA(37) = "Tenn." : stFull(37) = "Tennessee" stALA(38) = "Tex." : stFull(38) = "Texas" stALA(39) = "Vt." : stFull(39) = "Vermont" stALA(40) = "Va." : stFull(40) = "Virginia" stALA(41) = "Wash." : stFull(41) = "Washington (State)" stALA(42) = "W. Va." : stFull(42) = "West Virginia" stALA(43) = "Wis." : stFull(43) = "Wisconsin" stALA(44) = "Wyo." : stFull(44) = "Wyoming" stALA(45) = "P.R." : stFull(45) = "Puerto Rico" stALA(46) = "Alta." : stFull(46) = "Alberta" stALA(47) = "B.C." : stFull(47) = "British Columbia" stALA(48) = "Man." : stFull(48) = "Manitoba" stALA(49) = "N.B." : stFull(49) = "New Brunswick" stALA(50) = "Nfld." : stFull(50) = "New Foundland" stALA(51) = "N.L." : stFull(51) = "New Foundland and Labrador" stALA(52) = "N.T." : stFull(52) = "Northwest Territory" stALA(53) = "N.S." : stFull(53) = "Nova Scotia" stALA(54) = "Ont." : stFull(54) = "Ontario" stALA(55) = "P.E.I." : stFull(55) = "Prince Edward Island" stALA(56) = "Sask." : stFull(56) = "Saskatchewan" stALA(57) = "Yukon" : stFull(57) = "Yukon Territory" stALA(58) = "A.C.T." : stFull(58) = "Australian Capital Territory" stALA(59) = "N.S.W." : stFull(59) = "New South Wales" stALA(60) = "Qld." : stFull(60) = "Queensland" stALA(61) = "Sask." : stFull(61) = "Saskatchewan" stALA(62) = "S. Aust." : stFull(62) = "South Australia" stALA(63) = "W.A." : stFull(63) = "Western Australia" stALA(64) = "Tas." : stFull(64) = "Tasmania" stALA(65) = "N.Z." : stFull(65) = "New Zealand" stALA(66) = "V.I." : stFull(66) = "Virgin Islands" stALA(67) = "Vic." : stFull(67) = "Victoria" for x = 1 to 67 if state$ = stALA(x) then state$ = stFull(x) end if next tag781$ = "781 0" + subfieldz$ + " " + state$ + " " if qual$ <> "" then if tag410$ = "" then tag781$ = tag781$ + subfieldz$ + " " + city$ + " (" + qual$ + ")" end if else tag781$ = tag781$ + subfieldz$ + " " + city$ end if else 'country tag781$ = "781 0" + subfieldz$ + " " + mid$(heading$, 5) end if else MsgBox "781 is not valid for this record." end if end if bool = CS.SetFieldLine (99, tag781$) bool = CS.getfield("043", 1, heading$) if heading$ = "" then CS.RunMacro "DPK!Add043" end if End Sub