| Products | Minisoft News | Events | Downloads | Product Manuals
 
  News

Minisoft Releases PCI Compliant Versions of ODBC, JDBC, and OLE DB

Demo and Updates

Register for your download

Documentation

NFT Release Notes

Frequently Asked Questions

Product Review

User definable translation tables

 
   

  Network File Transfer

 Perform file transfer functions to and from a wide variety of hosts.

 

Using Host Command

This sample streams a job and waits for it to complete before downloading a file.

Option Explicit

Const gcUpload = 0
Const gcDownload = 1
Const gcASCII = 0
Const gcBinary = 1

Dim FTSession As Object


Private Sub cmdExit_Click()

On Error Resume Next

If FTSession.ConnectStatus = True Then
FTSession.Disconnect
End If
Set FTSession = Nothing
Unload Me
End

End Sub


Private Sub cmdStream_Click()

Dim ii As Integer
Dim TempStr As String

On Error GoTo Egress1

Screen.MousePointer = 11
StatusLine = "Begin..."
Set FTSession = CreateObject("NetFT.Session")
StatusLine = "Object Created - Request Connection..."
FTSession.HostAddress = "204.250.148.132"
FTSession.Port = 30001
FTSession.LoginUser = "MGR"
TempStr = tPassword.Text
If (Len(TempStr) > 1) Then
FTSession.UserPassword = TempStr
End If
FTSession.LoginGroup = "PUB"
FTSession.GroupPassword = ""
FTSession.LoginAccount = "MINISOFT"
FTSession.AccountPassword = ""
FTSession.JobName = "SAMPLE"
If (Not FTSession.Connect) Then
MsgBox "1 - " & FTSession.ErrorMessage
GoTo Egress1
End If
ii = 0
StatusLine = "Connection Established - Logging on..."
FTSession.HostLogin
TempStr = FTSession.LoginInfo
If (Len(TempStr) <> 24) Then
MsgBox "2 - " & FTSession.ErrorMessage
GoTo Egress1
End If

CIERR = FTSession.HostCommand("PURGE " & tDLName)
If (CIERR <> 0) Then
MsgBox ("MPE Error")
End If
CIERR = FTSession.HostCommand("PURGE " & tHFName)
If (CIERR <> 0) Then
MsgBox ("MPE Error")
End If
CIERR = FTSession.HostCommand("BUILD " & tHFName)
If (CIERR <> 0) Then
MsgBox ("MPE Error")
End If
CIERR = FTSession.HostCommand("STREAM " & tSTREAM)
If (CIERR <> 0) Then
MsgBox ("MPE Error")
End If

Timer1.Interval = 1000
GoTo Egress2

Egress1:
On Error Resume Next
MsgBox "Error Exit"
If FTSession.ConnectStatus = True Then
FTSession.Disconnect
End If
Set FTSession = Nothing
Egress2:
StatusLine = "Ready"
Screen.MousePointer = 0

End Sub


Private Sub Timer1_Timer()

Dim TempStr As String

On Error GoTo Egress1

Timer1.Interval = 0
StatusLine = "Checking..."
List1.Text = ""
List1.Text = FTSession.HostFileList(tHFName)
If (Len(List1.Text) = 0) Then
DownloadFile
Else
Timer1.Interval = 1000
End If

GoTo Egress2

Egress1:
On Error Resume Next
MsgBox "Error Exit"
If FTSession.ConnectStatus = True Then
FTSession.Disconnect
End If
Set FTSession = Nothing
Egress2:
StatusLine = "Ready"

End Sub


Private Sub DownloadFile()

Dim TempStr As String

StatusLine = "Transfering..."
FTSession.DisplayStats = True
FTSession.Direction = gcDownload
FTSession.ExistsAction = 1
TempStr = tDLName.Text
If (Len(TempStr) > 1) Then
FTSession.LocalFile = TempStr
End If
TempStr = tDLName.Text
If (Len(TempStr) > 1) Then
FTSession.HostFile = TempStr
End If
FTSession.RecordSize = 80
FTSession.TransferMode = gcASCII
StatusLine = "Logon Successful - Transfering..."
If (FTSession.StartTransfer <> 0) Then
MsgBox "3 - " & FTSession.ErrorMessage
GoTo Egress1
End If
StatusLine = "Transfer Complete."

GoTo Egress2

Egress1:
On Error Resume Next
MsgBox "Error Exit"
If FTSession.ConnectStatus = True Then
FTSession.Disconnect
End If
Set FTSession = Nothing
Egress2:
StatusLine = "Ready"
Screen.MousePointer = 0

End Sub


!JOB VBJOB2,MGR/password.MINISOFT
!CONTINUE
!PURGE VBJOB3
!COPY NPREADME,VBJOB3
!PURGE VBJOB1
!SET STDLIST=DELETE
!EOJ