我如何“启动”在 vb.net 2008 中使用 FTP 的大型机上的 jcl 流

发布于 08-02 10:48 字数 1056 浏览 3 评论 0原文

以下是将字节数组上传到大型机上的文件 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

没︽人懂的悲伤2024-08-09 10:48:12

如果您希望上传的文件被视为 JCL 作业,只需将以下内容放入

quote site filetype=jes

FTP 命令中即可。

这将指示 JES 将传入数据集视为 JCL 并自动提交。

如何使用 VB 实现这一目标不在我的域内,但以下内容可以在 cmd.exe 中正常工作:

ftp -n bigiron.com -s:bigiron.ftp

使用 bigiron.ftp 包含:

user MYNAME MYPASSWORD
quote site filetype=jes
quote site jeslrecl=80
put commands.jcl
bye

如果由于某种原因,您无法在 VB 中执行此操作,我的下一步行动是在 z/OS 下运行一个启动任务,该任务监视特定数据集并提交出现在那里的任何新成员。

我将使用哨兵方法来确保您不会尝试提交半上传的作业:

  • 客户端将成员上传到日期数据集(例如“DATA.MYJOB”)。
  • 然后客户端将虚拟成员上传到哨兵数据集中(例如“SENTINEL.MYJOB”)。
  • 启动的任务不断在哨兵数据集中寻找新成员。
  • 如果找到,则将等效数据成员提交给 JES 并删除哨兵和数据成员。

实际上,当 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:

quote site filetype=jes

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:

ftp -n bigiron.com -s:bigiron.ftp

with bigiron.ftp containing:

user MYNAME MYPASSWORD
quote site filetype=jes
quote site jeslrecl=80
put commands.jcl
bye

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:

  • client uploads member into date dataset (e.g., "DATA.MYJOB").
  • client then uploads dummy member into sentinel dataset (e.g., "SENTINEL.MYJOB").
  • started task continuously looks for new members in sentinel dataset.
  • if found, submits the equivalent data member to JES and deletes both sentinel and data members.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文