📄 marcdata.frm
字号:
Else
ddf = Asc(Right(linestring, 1))
End If
If ddf <> 29 Then
tempstring = linestring
aa:
If EOF(1) Then
Close (1)
' MsgBox "数据转换完成,共转换:" & currecord & "条数据" & loadrecord
GoTo xy2
End If
Line Input #1, linestring
If Len(tempstring) = 0 Then
tempstring = tempstring & "" & linestring
Else
tempstring = tempstring & " " & linestring
End If
If Len(linestring) = 0 Then
ddf = 1
Else
ddf = Asc(Right(linestring, 1))
End If
If ddf <> 29 Then GoTo aa
linestring = tempstring
End If
marc = linestring
' MsgBox Asc(Left(linestring, 1))
header = Left(linestring, 24) '头标区
' aab = Mid(linestring, 23, 1)
mcleng = Mid(header, 13, 5)
mcq = Mid(linestring, 25, Val(mcleng) - 24 - 1) '目次区
bb = Len(mcq)
aa = LenB(StrConv(linestring, vbFromUnicode))
dataq = Mid(linestring, Val(mcleng) + 1, aa - Val(mcleng)) '数据区
For i = 1 To bb / 12
zd = Mid(mcq, (i - 1) * 12 + 1, 12)
'读取每个字段的值
first1 = Mid(zd, 1, 3) '字段名
second1 = Mid(zd, 4, 4) '字符长度
third1 = Mid(zd, 8, 5) '数据字段区开始的位置
'data11为取得的字段值
data11 = MidB(StrConv(dataq, vbFromUnicode), Val(third1) + 1, Val(second1) - 1)
data12 = StrConv(data11, vbUnicode)
'MsgBox first1 & ":" & StrConv(data11, vbUnicode)
data13 = Replace(data12, Chr(31), "@")
If first1 = "010" Then
' price = "" chr(31)d
If Len(isbn) = 0 Then
isbn = Left(LTrim(isbndel(Getfield(data13, "@a"))), 10)
If Len(isbn) <> 10 Or Left(isbn, 1) <> "7" Then
errisbnnum = errisbnnum + 1
errisbn = errisbn & "/" & Getfield(data13, "@a")
End If
price = Getfield(data13, "@d")
price = RTrim(LTrim(pricedel(price)))
End If
End If
If first1 = "200" Then
bookname = ""
author = ""
tempbook = ""
bookname = Getfield(data13, "@a")
tempbook = Getfield(data13, "@d")
If Len(Trim(tempbook)) <> 0 Then bookname = bookname + "=" + tempbook
tempbook = Getfield(data13, "@e")
If Len(Trim(tempbook)) <> 0 Then bookname = bookname + "." + tempbook
tempbook = Getfield(data13, "@h")
If Len(Trim(tempbook)) <> 0 Then bookname = bookname + "." + tempbook
tempbook = Getfield(data13, "@i")
If Len(Trim(tempbook)) <> 0 Then bookname = bookname + "." + tempbook
author = Getfield(data13, "@f")
End If
If first1 = "210" Then
cbs = ""
cbn = ""
cbs = Getfield(data13, "@c")
cbn = Getfield(data13, "@d")
End If
If first1 = "215" Then
kanben = ""
pagenum = ""
kanben = RTrim(LTrim(Getfield(data13, "@d")))
pagenum = RTrim(LTrim(Getfield(data13, "@a")))
End If
If first1 = "000" Then
marcrecordnum = ""
marcrecordnum = Trim(data13)
End If
If first1 = "330" Then
context = ""
context = Getfield(data13, "@a")
End If
If first1 = "690" Then
classnum = ""
classnum = Getfield(data13, "@a")
End If
If first1 = "905" Then
bjh = ""
bjh = Getfield(data13, "@f")
End If
If first1 = "801" Then
provide = ""
bly801 = ""
provide = Getfield(data13, "@b")
bly801 = "true"
End If
If first1 = "906" Then
loc1 = 1
loc2 = 1
Do While (loc2 <> 0)
loc2 = InStr(loc1, data13, "@a")
If loc2 <> 0 Then
fbl = fbl + 1
End If
loc1 = loc2 + 1
Loop
'fbl = Getfield(data13, "@a")
End If
Next i
'将数据写入数据库
'写入MARC
Data1.Recordset.AddNew
Data1.Recordset("bookname") = LTrim$(RTrim$(Left$(bookname, 50)))
Data1.Recordset("author") = LTrim$(RTrim$(Left$(author, 25)))
Data1.Recordset("isbn") = LTrim$(RTrim$(Left$(isbn, 15)))
Data1.Recordset("bms") = LTrim$(RTrim$(Left$(cbs, 25)))
Data1.Recordset("bmn") = LTrim$(RTrim$(Left$(cbn, 10)))
Data1.Recordset("context") = context
' Data1.Recordset("marc") = marc
Data1.Recordset("kanben") = LTrim$(RTrim$(Left$(kanben, 20)))
Data1.Recordset("pagenum") = LTrim$(RTrim$(Left$(pagenum, 20)))
Data1.Recordset("jg") = LTrim$(RTrim$(Left$(price, 15)))
Data1.Recordset("modidate") = Now()
Data1.Recordset("marcrecordnum") = Trim(Left(marcrecordnum, 20))
Data1.Recordset("class") = Trim(Left(classnum, 20))
Data1.Recordset("bjh") = Trim(Left(bjh, 20))
Data1.Recordset("provide") = Trim(Left(provide, 25))
Data1.Recordset("fbl") = fbl
Data1.Recordset.Update
loadrecord = loadrecord + 1
bly801 = ""
isbn = "" 'chr(31) a
price = "" 'chr(31)d
bookname = ""
author = ""
isbn = ""
cbs = ""
cbn = ""
context = ""
price = ""
marc = ""
marcrecordnum = ""
provide = ""
bjh = ""
fbl = 0
classnum = ""
kanben = ""
pagenum = ""
linestring = ""
currecord = currecord + 1
Me.Caption = "正在处理第:" & currecord & "条记录"
If currecord > maxrecord Then
MsgBox banben & "版只能转入记录" & currecord & "条。请使用高级版!"
Close (1)
GoTo xy1
End If
Loop
xy1:
MsgBox "MARC数据转入馆藏完成!共处理:" & currecord & "条数据"
Text3.Text = "MARC数据转入馆藏完成!共处理:" & currecord & "条数据"
End If
'------------------------------------------------------------------------------
'Marc数据转入预采库
If worktok = "预采库" Then
Open isofile For Binary As #1
Do Until EOF(1)
Line Input #1, linestring
If Len(linestring) = 0 Then
ddf = 1
Else
ddf = Asc(Right(linestring, 1))
End If
If ddf <> 29 Then
tempstring = linestring
bb:
If EOF(1) Then
Close (1)
' MsgBox "数据转换完成,共转换:" & currecord & "条数据" & loadrecord
GoTo xy2
End If
Line Input #1, linestring
If Len(tempstring) = 0 Then
tempstring = tempstring & "" & linestring
Else
tempstring = tempstring & " " & linestring
End If
If Len(linestring) = 0 Then
ddf = 1
Else
ddf = Asc(Right(linestring, 1))
End If
If ddf <> 29 Then GoTo bb
linestring = tempstring
End If
marc = linestring
' MsgBox Asc(Left(linestring, 1))
header = Left(linestring, 24) '头标区
' aab = Mid(linestring, 23, 1)
mcleng = Mid(header, 13, 5)
mcq = Mid(linestring, 25, Val(mcleng) - 24 - 1) '目次区
bb = Len(mcq)
aa = LenB(StrConv(linestring, vbFromUnicode))
dataq = Mid(linestring, Val(mcleng) + 1, aa - Val(mcleng)) '数据区
For i = 1 To bb / 12
zd = Mid(mcq, (i - 1) * 12 + 1, 12)
'读取每个字段的值
first1 = Mid(zd, 1, 3) '字段名
second1 = Mid(zd, 4, 4) '字符长度
third1 = Mid(zd, 8, 5) '数据字段区开始的位置
'data11为取得的字段值
data11 = MidB(StrConv(dataq, vbFromUnicode), Val(third1) + 1, Val(second1) - 1)
data12 = StrConv(data11, vbUnicode)
'MsgBox first1 & ":" & StrConv(data11, vbUnicode)
data13 = Replace(data12, Chr(31), "@")
If first1 = "010" Then
' price = "" chr(31)d
If Len(isbn) = 0 Then
isbn = Left(LTrim(isbndel(Getfield(data13, "@a"))), 10)
If Len(isbn) <> 10 Or Left(isbn, 1) <> "7" Then
errisbnnum = errisbnnum + 1
errisbn = errisbn & "/" & Getfield(data13, "@a")
End If
price = Getfield(data13, "@d")
price = RTrim(LTrim(pricedel(price)))
End If
End If
If first1 = "200" Then
bookname = ""
author = ""
tempbook = ""
bookname = Getfield(data13, "@a")
tempbook = Getfield(data13, "@d")
If Len(Trim(tempbook)) <> 0 Then bookname = bookname & "=" & tempbook
tempbook = Getfield(data13, "@e")
If Len(Trim(tempbook)) <> 0 Then bookname = bookname & "." & tempbook
tempbook = Getfield(data13, "@h")
If Len(Trim(tempbook)) <> 0 Then bookname = bookname & "." & tempbook
tempbook = Getfield(data13, "@i")
If Len(Trim(tempbook)) <> 0 Then bookname = bookname & "." & tempbook
author = Getfield(data13, "@f")
End If
If first1 = "210" Then
cbs = ""
cbn = ""
cbs = Getfield(data13, "@c")
cbn = Getfield(data13, "@d")
End If
If first1 = "215" Then
kanben = ""
pagenum = ""
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -