<!--  #include file="data2.asp"-->
<%
dim recordset
SID=request.QueryString("SID")
 
Function bin2str(binstr)    Dim varlen,clow,ccc,skipflag
    skipflag=0
    ccc = ""
    varlen=LenB(binstr)    For i=1 To varlen
        If skipflag=0 Then
            clow = MidB(binstr,i,1)
            If AscB(clow) > 127 Then
                ccc =ccc & Chr(AscW(MidB(binstr,i+1,1) & clow))
                skipflag=1
            Else
                ccc = ccc & Chr(AscB(clow))
            End If
        Else
            skipflag=0
        End If
    Next    bin2str = ccc
End Functionsql="select * from PC_SEISMIC_ACQUISITION_SPS where id='" & SID  &"'"
set recordset=dataconn.Execute(sql)cexianhao=trim(recordset("cexianhao"))
flName= cexianhao +".txt"Response.Buffer = true
strData = (recordset("daohang").value)tmps1=bin2str(strData)
cd=len(tmps1)
row=cd/47
str=recordset("DAOHANGSHUOMING")
str=str  & vbcrLfcxname="S"+trim(recordset("cexianhao"))
kg=20-len(cxname)for j=1 to kg
    cxname=cxname+" "
next for i=1 to row  shot=mid(tmps1,(i-1)*(47)+1, 5)
  weidu=mid(tmps1,(i-1)*47+7,9)
  jingdu=mid(tmps1,(i-1)*47+17,10)
  x=mid(tmps1,(i-1)*47+29,8)
  y= mid(tmps1,(i-1)*47+38,9)
  str=str +cxname+shot+weidu+"N"+jingdu+"E "+ x + y & vbcrLf
next 
Response.Clear
 
%>
<%Response.AddHeader "Content-Disposition", "attachment; filename="&flName
Response.AddHeader "Content-Length",flsize
Response.ContentType = ContentTypeResponse.Write str
Response.Flush
response.Clear()response.end%>