我如何“启动”在 vb.net 2008 中使用 FTP 的大型机上的 jcl 流
以下是将字节数组上传到大型机上的文件 DSN 中的代码。它运作得很好。我想做的是上传 jcl,然后它应该开始执行。这就是我坚持的部分。我以前可以通过 WININET 来完成此操作,但我想摆脱它并使用 vb.net 中更好的 FTP 命令
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
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
如果您希望上传的文件被视为 JCL 作业,只需将以下内容放入
FTP 命令中即可。
这将指示 JES 将传入数据集视为 JCL 并自动提交。
如何使用 VB 实现这一目标不在我的域内,但以下内容可以在 cmd.exe 中正常工作:
使用
bigiron.ftp
包含:如果由于某种原因,您无法在 VB 中执行此操作,我的下一步行动是在 z/OS 下运行一个启动任务,该任务监视特定数据集并提交出现在那里的任何新成员。
我将使用哨兵方法来确保您不会尝试提交半上传的作业:
实际上,当 sysprogs 不热衷于允许这些外部计算机直接访问 JES(尽管有密码)时,我们实际上已经使用过这种方法。
经过一番搜索后更新:
对于
“报价网站”
解决方案来说,它看起来不太好。 这篇文章从 2006 年开始(但更新到 2009 年)似乎表明 MS 不允许实施“引用站点”,因为这会暴露其代码的内部工作原理。我不会评论该论点的有效性,他们的推理可能已经改变,但我在当前文档中看不到任何表明他们添加了此功能的内容。所以我猜您只能使用外部 FTP 解决方案。
If you want your uploaded file to be treated as a JCL job, it's a simple matter to put:
into the FTP commands.
This will direct JES to treat the incoming dataset as JCL and automatically submit it.
How you would achieve that with VB is not within my domain but the following works fine from cmd.exe:
with
bigiron.ftp
containing:If, for some reason, you can't do this from within VB, my next move would be to have a started task running under z/OS which monitored a specific data set and submitted any new members that appeared there.
I'd use the sentinel method to ensure you're not trying to submit half-uploaded jobs:
We've actually used this method before when sysprogs weren't keen on allowing those foreign machines direct access to JES (despite passwords).
Update, after a bit of searching:
It doesn't look good for the
"quote site"
solution. This post from 2006 (but with updates well into 2009) seems to indicate MS won't allow"quote site"
to be implemented since it would expose the inner workings of their code. I won't comment of the validity of that argument and their reasoning may have changed, but I can't see anything in the current docs that indicates they've added this feature.So I guess you're stuck with an external FTP solution.