从 VB.net 将文件上传到大型机
我正在尝试将文件从我的电脑上传到大型机。我正在尝试使用 Chilkat FTP2 上传它。下面是代码。
我尝试上传的文件是 2009102600000
Dim ftp As New Chilkat.Ftp2()
Dim success As Boolean
' Any string unlocks the component for the 1st 30-days.'
success = ftp.UnlockComponent("Anything for 30-day trial")
If (success <> true) Then
MsgBox(ftp.LastErrorText)
Exit Sub
End If
ftp.Hostname = "www.myside.com"
ftp.Username = "****"
ftp.Password = "****"
' The default data transfer mode is "Active" as opposed to "Passive".'
' Change it to Passive by setting the Passive property:'
ftp.Passive = true
' Connect and login to the FTP server.'
success = ftp.Connect()
If (success <> true) Then
MsgBox(ftp.LastErrorText)
Exit Sub
End If
' Change to the remote directory where the file will be uploaded.'
success = ftp.ChangeRemoteDir("ABC.SITEUPLOAD.UPLOAD")
If (success <> true) Then
MsgBox(ftp.LastErrorText)
Exit Sub
End If
' Upload a file.'
Dim localFilename As String
localFilename = "c:\2009102600000"
Dim remoteFilename As String
remoteFilename = "2009102600000"
success = ftp.PutFile(localFilename,remoteFilename)
If (success <> true) Then
MsgBox(ftp.LastErrorText)
Exit Sub
End If
ftp.Disconnect()
MsgBox("File Uploaded!")
我收到的错误是找不到数据集,使用 MVS dsn 名称或类似名称。
如果您能帮我解决这个问题,我将不胜感激。
I am trying to upload a file from my pc to mainframes. I am trying to upload it using Chilkat FTP2. Below is the code.
The file I am trying to upload is 2009102600000
Dim ftp As New Chilkat.Ftp2()
Dim success As Boolean
' Any string unlocks the component for the 1st 30-days.'
success = ftp.UnlockComponent("Anything for 30-day trial")
If (success <> true) Then
MsgBox(ftp.LastErrorText)
Exit Sub
End If
ftp.Hostname = "www.myside.com"
ftp.Username = "****"
ftp.Password = "****"
' The default data transfer mode is "Active" as opposed to "Passive".'
' Change it to Passive by setting the Passive property:'
ftp.Passive = true
' Connect and login to the FTP server.'
success = ftp.Connect()
If (success <> true) Then
MsgBox(ftp.LastErrorText)
Exit Sub
End If
' Change to the remote directory where the file will be uploaded.'
success = ftp.ChangeRemoteDir("ABC.SITEUPLOAD.UPLOAD")
If (success <> true) Then
MsgBox(ftp.LastErrorText)
Exit Sub
End If
' Upload a file.'
Dim localFilename As String
localFilename = "c:\2009102600000"
Dim remoteFilename As String
remoteFilename = "2009102600000"
success = ftp.PutFile(localFilename,remoteFilename)
If (success <> true) Then
MsgBox(ftp.LastErrorText)
Exit Sub
End If
ftp.Disconnect()
MsgBox("File Uploaded!")
The error I am getting is dataset not found use MVS dsn name or something like that.
I would really appreciate if you can help me out with this one please.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我完全不确定您是否可以将数据集前缀视为目录。当我使用 ftp 上传到大型机时,我总是只指定完整的目标名称。我将完全删除该
部分,只需将:更改
为:
如果它是顺序数据集,或者:
如果它是成员(在这种情况下,数据集必须首先存在)。
如果您更改
MsgBox
语句,使其包含有关实际导致错误的原因的指示,也会有所帮助。大致如下:而不是通用的:
另一点:您会注意到我在上面的目标周围加了单引号。这是因为 z/OS 习惯(有时)为成员添加登录名前缀。可能是:
实际上正在尝试将其放入
yourname.upload(xyz)
中。引用它可以防止这种情况发生。更新:你知道,我刚刚注意到一些在我第一次读到这个问题时完全没有注意到的事情。错误消息清楚地说明了这一点。
分区数据集中的数据集名称段和成员名称限制为 8 个字符。因此,您的
'ABC.SITEUPLOAD.UPLOAD(2009102600000)'
在SITEUPLOAD
和2009102600000
两个计数中无效>。尝试缩短名称并重新传输。证明如下:
I'm not at all sure you can treat data set prefixes as directories. When I'm doing uploads to the mainframe with ftp, I always just specify the full target name. I would get rid of the
section altogether and just change:
to:
if it's a sequesntial data set, or:
if it's a member (in which case the data set will have to exist first).
It would also help if you changed the
MsgBox
statements so that they included an indication as to what is actually causing the error. Something along the lines of:instead of the generic:
One other point: you'll notice I've put single quotes around the targets above. That's because z/OS has a habit of (sometimes) prefixing your login name to members. It may be that:
is actually trying to put it into
yourname.upload(xyz)
. Quoting it will prevent that.Update: You know, I just noticed something that totally escaped me the first time I read this question. The error message spells it out plainly.
Data set name segments and member names within partitioned data sets are limited to 8 characters. Hence your
'ABC.SITEUPLOAD.UPLOAD(2009102600000)'
is invalid on two counts, theSITEUPLOAD
and the2009102600000
. Try shortening the names and re-transferring.Here's the proof:
您确定不需要将其存储为根目录中的世代数据集吗?像这样:
Are you sure you don't need to store it as a generational dataset from the root directory? Like this: