byrne1
01-24-2002, 07:45 AM
I am having trouble using the GetChunk command. I am attempting to transfer an ASCII file from the mainframe to my PC. When I issue the GET command the file comes over as binary. When I use the GetChunk command in the icResponseCompleted event, there is no data for me to get. What I end up with is a binary file that's 296KB and an empty text file (tesstt.txt).
My code is as follows:
Sub Get_Data()
Inet1.URL = Text2
Inet1.UserName = txtUserID
Inet1.Password = txtPword
Inet1.OpenURL
Inet1.Execute , "get '" & HostDSN & "'" & " " & PCFile
End Sub
Sub Inet1_StateChanged(ByVal State As Integer)
Select Case State
Case icResponseCompleted
Dim vtData As Variant ' Data variable.
Dim strData As String: strData = ""
Dim bDone As Boolean: bDone = False
Me.lblResponse.Caption = "GetChunking"
'Get first chunk.
vtData = Inet1.GetChunk(1024, icString)
DoEvents
Do While Not bDone
strData = strData & vtData
DoEvents
' Get next chunk.
vtData = Inet1.GetChunk(1024, icString)
If Len(vtData) = 0 Then
bDone = True
End If
Open "c:\tesstt.txt" For Append As #1
Print #1, strData
Close #1
Loop
Me.lblResponse.Caption = "GotChunked"
End Select
End Sub
My code is as follows:
Sub Get_Data()
Inet1.URL = Text2
Inet1.UserName = txtUserID
Inet1.Password = txtPword
Inet1.OpenURL
Inet1.Execute , "get '" & HostDSN & "'" & " " & PCFile
End Sub
Sub Inet1_StateChanged(ByVal State As Integer)
Select Case State
Case icResponseCompleted
Dim vtData As Variant ' Data variable.
Dim strData As String: strData = ""
Dim bDone As Boolean: bDone = False
Me.lblResponse.Caption = "GetChunking"
'Get first chunk.
vtData = Inet1.GetChunk(1024, icString)
DoEvents
Do While Not bDone
strData = strData & vtData
DoEvents
' Get next chunk.
vtData = Inet1.GetChunk(1024, icString)
If Len(vtData) = 0 Then
bDone = True
End If
Open "c:\tesstt.txt" For Append As #1
Print #1, strData
Close #1
Loop
Me.lblResponse.Caption = "GotChunked"
End Select
End Sub