The following is the code that uploades a bytearray into a file DSN on our mainframe. It works very well. What I want to do is upload the jcl which should then start to execute. That's the part I am stuck on. I used to be able to do it through WININET, but I want to get away from that and use the better FTP commands in vb.net
Public Shared Sub UploadToMainFrame( _
ByVal ftpHost As String, _
ByVal ftpMainframeDSN As String, _
ByVal UserName As String, _
ByVal Password As String, _
ByVal DataToUpload As String)
Dim ftpRequest As FtpWebRequest
Dim ftpFullMainframePath = String.Format("ftp://{2}//'{3}'", ftpHost, ftpMainframeDSN)
ftpRequest = WebRequest.Create(ftpFullMainframePath)
ftpRequest.Credentials = New NetworkCredential(UserName, Password)
ftpRequest.KeepAlive = True
ftpRequest.UseBinary = False
ftpRequest.Method = WebRequestMethods.Ftp.UploadFile
ftpRequest.
Dim byteArray() As Byte = StrToByteArray(DataToUpload)
ftpRequest.ContentLength = byteArray.Length
Dim ftpStream As Stream = ftpRequest.GetRequestStream()
ftpStream.Write(byteArray, 0, byteArray.Length)
ftpStream.Close()
ftpStream = Nothing
ftpRequest = Nothing
End Sub
Public Shared Sub UploadToMainFrame( _
ByVal ftpHost As String, _
ByVal ftpMainframeDSN As String, _
ByVal UserName As String, _
ByVal Password As String, _
ByVal DataToUpload As String)
Dim ftpRequest As FtpWebRequest
Dim ftpFullMainframePath = String.Format("ftp://{2}//'{3}'", ftpHost, ftpMainframeDSN)
ftpRequest = WebRequest.Create(ftpFullMainframePath)
ftpRequest.Credentials = New NetworkCredential(UserName, Password)
ftpRequest.KeepAlive = True
ftpRequest.UseBinary = False
ftpRequest.Method = WebRequestMethods.Ftp.UploadFile
ftpRequest.
Dim byteArray() As Byte = StrToByteArray(DataToUpload)
ftpRequest.ContentLength = byteArray.Length
Dim ftpStream As Stream = ftpRequest.GetRequestStream()
ftpStream.Write(byteArray, 0, byteArray.Length)
ftpStream.Close()
ftpStream = Nothing
ftpRequest = Nothing
End Sub