我正在尝试将文件从我的电脑上传到大型机。我正在尝试使用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名称或类似的东西。
如果你能帮我解决这个问题,我将非常感激。
答案 0 :(得分:2)
我完全不确定您是否可以将数据集前缀视为目录。当我使用ftp上传到大型机时,我总是只指定完整的目标名称。我会摆脱
ftp.ChangeRemoteDir("ABC.SITEUPLOAD.UPLOAD")
部分完全改变:
remoteFilename = "2009102600000"
为:
remoteFilename = "'ABC.SITEUPLOAD.UPLOAD.2009102600000'"
如果它是一个有形的数据集,或者:
remoteFilename = "'ABC.SITEUPLOAD.UPLOAD(2009102600000)'"
如果它是成员(在这种情况下,数据集必须首先存在)。
如果您更改了MsgBox
语句,它们也会有所帮助,以便它们包含 实际导致错误的指示。有点像:
MsgBox("Connect error: " & ftp.LastErrorText)
MsgBox("ChangeRemoteDir error: " & ftp.LastErrorText)
MsgBox("PutFile error: " & ftp.LastErrorText)
而不是通用:
MsgBox(ftp.LastErrorText)
还有一点:你会注意到我在上面的目标周围放了单引号。那是因为z / OS习惯(有时)将您的登录名前缀添加到成员。可能是:
put xyz.txt upload(xyz)
实际上是想把它放进yourname.upload(xyz)
。引用它会阻止这种情况。
更新:你知道,我刚刚注意到第一次看到这个问题时完全逃脱了我的事情。错误信息清楚地表明了这一点。
分区数据集中的数据集名称段和成员名称限制为8个字符。因此,'ABC.SITEUPLOAD.UPLOAD(2009102600000)'
在两个计数,SITEUPLOAD
和2009102600000
上无效。尝试缩短名称并重新转移。
以下是证据:
C:\Documents and Settings\Pax> ftp bigiron
Connected to bigiron.box.com.
220-FTPD1 IBM FTP CS V1R9 at BIGIRON.BOX.COM, 02:15:23 on 2009-11-06.
220 Connection will close if idle for more than 5 minutes.
User (bigiron.box.com:(none)): pax
331 Send password please.
Password:
230 PAX is logged on. Working directory is "PAX.".
ftp> put test.txt 'pax.siteupload'
200 Port request OK.
501 Invalid data set name "'pax.siteupload'". Use MVS Dsname conventions.
ftp> put test.txt 'pax.siteupld'
200 Port request OK.
125 Storing data set PAX.SITEUPLD
250 Transfer completed successfully.
ftp: 177 bytes sent in 0.00Seconds 177000.00Kbytes/sec.
ftp> put test.txt 'pax.jcl(abcdefghi)'
200 Port request OK.
501 Invalid data set name "'pax.jcl(abcdefghi)'". Use MVS Dsname conventions.
ftp> put test.txt 'pax.jcl(abcdefgh)'
200 Port request OK.
125 Storing data set PAX.JCL(ABCDEFGH)
250 Transfer completed successfully.
ftp: 177 bytes sent in 0.00Seconds 177000.00Kbytes/sec.
ftp> bye
221 Quit command received. Goodbye.
答案 1 :(得分:0)
您确定不需要将其存储为根目录中的世代数据集吗?像这样:
'ABC.SITEUPLOAD.UPLOAD.2009102600000(+1)'