G'day all
below is a CMD screen shot, of a file Upload to an IBM IS390 Mainframe,
via Command Prompt window (CMD.exe is s must, as .NET Class FTPWebRequest, doesnt cater for IBM IS390 Mainframe Authentication.).
VB code for the Process (should read p.output, into a msgbox):Code:H:\>ftp ftp> OPEN 188.66.122.110 Connected to 188.66.122.110. 220-FTPD1 IBM FTP CS V1R4 at MVSHOST2, 08:55:45 on 2007-10-05. 220 Connection will close if idle for more than 5 minutes. User (188.66.122.110:(none)): 501 User name missing from USER command Login failed. ftp> USER STRuSER strPassword 331 Send password please. 230 STRuSER is logged on. Working directory is "STRuSER.". ftp> PUT "C:\JSE Margins\JSE Margins Calculator\20070918_TMAP.PPRD.MARGIN\TMAP.P PRD.MARGIN.INPUT" 'tmap.pprd.margin.input' 200 Port request OK. 125 Storing data set TMAP.PPRD.MARGIN.INPUT 250 Transfer completed successfully. ftp: 4330380 bytes sent in 70.90Seconds 61.07Kbytes/sec. ftp> BYE
vb Code:
Dim p As System.Diagnostics.Process Dim pwrite As New ProcessStartInfo Dim output As String, sr As StreamReader pwrite.UseShellExecute = False pwrite.CreateNoWindow = False 'True = no window pwrite.RedirectStandardOutput = True '= no output to read--> can create a problem pwrite.FileName = "cmd.exe" pwrite.Arguments = "/K ftp -n -s:autoftp.txt" Try MsgBox("ok to start process") p = Process.Start(pwrite) output = p.StandardOutput.ReadToEnd While Not p.HasExited p.Refresh() Thread.Sleep(100) output = output & p.StandardOutput.ReadToEnd End While MsgBox("Success Upload") MsgBox("output: " & vbNewLine & output) Catch ex As Exception MsgBox(ex.Message) Finally MsgBox("got to finally, Closing Process!") If Not p Is Nothing Then p.Close() End If End Try
RESULT:
msgbox pops, showing the text in "AutoFTP.txt" script.
TODO:
how to read output to ensure successfull upload?? (2 red lines in cmd..)
thanks in advance for any suggestion.
Happy Friday
-J.



Reply With Quote