MARCXML COM Stream Example

Dim objMM
Dim xmarc

dim path

path = "C:\Users\Terry\OneDrive\MarcEdit Downloads\xmltest\"
path2 = "C:\Users\Terry\Desktop\"

Set objMM=CreateObject("MARCEngine5.MARC21")

dim fso
dim f1

Set fso = CreateObject("Scripting.filesystemobject")
Set f1 = fso.opentextfile(path + "enc_1.txt", 1)
xmarc = f1.ReadAll
f1.close

Dim output

  output = objMM.ReadMARC21XMLStream(xmarc,"C:\Program Files\MarcEdit 6\xslt\MARC21slim2Mnemonic.xsl",0,2)
  

tmp = output
do
  if len(tmp) > 500 then
     msgbox(mid(tmp,1,500))
     tmp = mid(tmp, 500)
  else
     msgbox(tmp)
     exit do
  end if
loop

'this seems to be where the data get's changed.
  output = objMM.MARC2Stream(output, 2)
tmp = output
do
  if len(tmp) > 500 then
     msgbox(mid(tmp,1,500))
     tmp = mid(tmp, 500)
  else
     msgbox(tmp)
     exit do
  end if
loop


  noutput = objMM.Mnemonic2Stream(output, 2)

tmp = noutput
do
  if len(tmp) > 500 then
     msgbox(mid(tmp,1,500))
     tmp = mid(tmp, 500)
  else
     msgbox(tmp)
     exit do
  end if
loop

  noutput = objMM.MARC2MARC21XML_Stream(noutput, 0,2)

tmp = noutput
do
  if len(tmp) > 500 then
     msgbox(mid(tmp,1,500))
     tmp = mid(tmp, 500)
  else
     msgbox(tmp)
     exit do
  end if
loop

  '


Dim objf
Dim fs 

dim i
do
  if len(noutput) > 500 then
     msgbox(mid(noutput,1,500))
     noutput = mid(noutput, 500)
  else
     msgbox(noutput)
     wscript.quit
  end if
loop
msgbox("finished")