Attribute VB_Name = "Module1"
Option Explicit
Option Base 0

Public Type nagstrg
    name As String * 250
End Type

Public Declare Sub data_conv Lib "esys.dll" (ByVal data_name As String, _
ByVal data_file As String, ByVal xml_file As String, _
ByVal xsl_file As String, ByVal xdr_file As String, _
ByVal n As Long, ByVal m As Long, ByVal del_type As Long, _
ByVal head As Long, ByVal name_ptr As Long, v_type As Long, _
n_cat As Long, cat_val As Long, ByVal max_cat As Long, info As Long)
 
Public Declare Sub xml_data_size Lib "esys.dll" (ByVal xdr_file As String, _
n As Long, m As Long, max_name As Long, info As Long)
 
Public Declare Sub xml_read Lib "esys.dll" (ByVal xml_file As String, _
ByVal xdr_file As String, ByVal miss_val As Double, ByVal n As Long, _
ByVal m As Long, data As Double, ByVal name_ptr As Long, n_cat As Long, _
cat_val As Long, ByVal max_cat As Long, ByVal mset As Long, nmiss As Long, info As Long)
 
Public Declare Sub xml_update Lib "esys.dll" (ByVal xml_file As String, _
ByVal xdr_file As String, ByVal xsl_file As String, ByVal miss_val As Double, _
ByVal n As Long, ByVal m As Long, ByVal u_status As Long, _
nrepl As Long, irow As Long, icol As Long, rval As Double, info As Long)
 
Public Declare Sub simp Lib "esys.dll" (ByVal n As Long, ByVal m As Long, _
data As Double, n_cat As Long, cat_val As Long, ByVal max_cat As Long, _
ByVal miss_val As Double, nimp As Long, irow As Long, icol As Long, _
rval As Double, info As Long)
 
Public Declare Sub gen_imp Lib "esys.dll" (srtype As Long, ByVal rand_selec As Long, _
ByVal n_match As Long, ByVal match_all As Long, ByVal reuse As Long, _
ByVal min_wt As Double, wts As Double, R As Double, dist_type As Long, _
user_dist As Double, ByVal n As Long, ByVal m As Long, _
data As Double, n_cat As Long, cat_val As Long, ByVal max_cat As Long, _
ByVal miss_val As Double, nimp As Long, irow As Long, icol As Long, _
rval As Double, info As Long)
 
Public Declare Sub list_names Lib "esys.dll" (ptr As Long, _
ByVal n As Long, ByVal i As Long, ByVal i_name As String)

Public Declare Sub alloc_names Lib "esys.dll" (ptr As Long, _
ByVal n As Long, ByVal i As Long, ByVal maxname As Long)

Public Declare Sub get_names Lib "esys.dll" (ptr As Long, _
ByVal i As Long, i_name As nagstrg)

Public Declare Sub free_list Lib "esys.dll" (ptr As Long, _
ByVal n As Long)

Public cat_val() As Long, n_cat() As Long
Public var_name() As String
Public n As Long, m As Long, maxname As Long, maxcat As Long, name_ptr As Long
Public nmiss As Long, data_set As Long, opt_set As Long, var_num As Long
Public mset As Long
Public miss_val As Double
Public data() As Double, wts() As Double, R() As Double, user_dist() As Double
Public dist_type() As Long, srtype(2) As Long
Public rand_selec As Long, n_match As Long, match_all As Long, reuse As Long
Public min_wt As Double
Public data_file As String, xml_file As String, xdr_file As String
Public xsl_file As String, r_file As String
Public work_dir As String, data_name As String

Public Sub view_xml()
Dim launch_browser As String, disp_file As String, linetxt As String
Dim chunk_file As String
Dim i As Long, k As Long
Dim RetVal
chunk_file = work_dir & "\chunk.xml"
Open xml_file For Input As #3
Open chunk_file For Output Shared As #4
k = 5000 / m + 4
If k > n Then
    k = n + 3
Else
    k = k + 3
End If
For i = 1 To k
    Line Input #3, linetxt
    Print #4, linetxt
Next i
Print #4, "</esys_data>"
Close #3
Close #4

launch_browser = """c:\Program Files\Internet Explorer\IEXPLORE.EXE""" & " " & chunk_file
RetVal = Shell(launch_browser, vbNormalFocus)

End Sub

