Jump to content
Xtreme .Net Talk

vb.net FTP kick-starting JCL on mainframe from vb.net program


Recommended Posts

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...