FTP is not wroking :-(



FTP is not wroking :-(

Postby ramesh_017 » Tue Apr 06, 2010 3:07 pm

Hi i ned to download a mainframe file to local PC.. i am using VB.net application which will cinnect thru command prompt.. but the ocde having some problem:-(
it is copying the command prompt messages to note pad and based on the messages from notepad it will validate the process. but in notepad it is showing the file was not found after issuing the 'put'
Can any one help me..

Sub Create_File1(ByVal MF_UID_Parm, ByVal MF_PWD_Parm, ByVal strfilename_Parm, ByVal MF_File_Parm)

Dim MF_UID, MF_PWD, FTP_Cmd, strfilename, MF_File As String
MF_File = Trim(MF_File_Name_TxtBox.Text)
Dim Log_File As StreamReader = New StreamReader(App_Path & "\Log.txt")
Dim Log_Content As String = Log_File.ReadToEnd()
Dim DS_Found As String
DS_Found = "NO DATA SETS FOUND"
Dim fi As New FileInfo(App_Path & "\start.bat")
Dim fs As FileStream = fi.Create()
strfilename = Trim(Win_FileName_TxtBox.Text)
fs.Close()

Dim fi2 As New FileInfo(App_Path & "\FTP_Cmd.txt")
Dim fs2 As FileStream = fi.Create()
fs2.Close()

MF_UID = MF_UID_Parm
MF_PWD = MF_PWD_Parm
MF_File = MF_File_Parm
strfilename = strfilename_Parm

Dim sw1 As StreamWriter = New StreamWriter(App_Path & "\start.bat")
Dim sw2 As StreamWriter = New StreamWriter(App_Path & "\FTP_Cmd.txt")

IP = Trim(IP_Addr_TxtBox.Text)

sw1.Write("rmdir " & Chr(34) & App_Path & "\Completed" & Chr(34))
sw1.WriteLine()
'sw1.Write("ftp -n -s:" & Chr(34) & App_Path & "\FTP_Cmd.txt" & Chr(34) & " 162.44.246.7 > " & Chr(34) & App_Path & "\Log.txt" & Chr(34))
sw1.Write("ftp -n -s:" & Chr(34) & App_Path & "\FTP_Cmd.txt" & Chr(34) & " " & IP & " > " & Chr(34) & App_Path & "\Log.txt" & Chr(34))
sw1.WriteLine()
sw1.Write("mkdir " & Chr(34) & App_Path & "\Completed\" & Chr(34))
sw1.WriteLine()

FTP_Cmd = "user " & MF_UID & " " & MF_PWD
sw2.Write(FTP_Cmd)
sw2.WriteLine()
FTP_Cmd = "ascii "
sw2.Write(FTP_Cmd)
sw2.WriteLine()
FTP_Cmd = "lcd C:\Documents and Settings\175943\Desktop"
sw2.Write(FTP_Cmd)
sw2.WriteLine()
FTP_Cmd = "put" & " " & strfilename & ".txt" & " " & MF_File
MsgBox(FTP_Cmd)
sw2.Write(FTP_Cmd)
sw2.WriteLine()
sw2.WriteLine()
sw2.Write("close")
sw2.WriteLine()
sw2.Write("bye")
sw2.WriteLine()
ramesh_017
 
Posts: 1
Joined: Tue Apr 06, 2010 1:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: FTP is not wroking :-(

Postby Robert Sample » Tue Apr 06, 2010 4:50 pm

If you are connecting your PC to the mainframe for an FTP session, the mainframe is the server and your PC is the client. Doing a PUT in this situation will take a file off your PC and put it on the mainframe. Your claim is that you are wanting to take a mainframe file to the PC, which would require a GET. Either you are completely confused about what you are attempting to do, or your FTP command does not match what you say you want to do.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times


Return to Stupid Questions