1

我正在尝试将文件从我的电脑上传到大型机。我正在尝试使用 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 名称或类似名称的数据集。

如果您能帮我解决这个问题,我将不胜感激。

4

2 回答 2

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)'方面无效,the和. 尝试缩短名称并重新传输。SITEUPLOAD2009102600000

这是证明:

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.
于 2009-10-29T02:17:23.243 回答
0

您确定不需要将其存储为根目录中的世代数据集吗?像这样:

'ABC.SITEUPLOAD.UPLOAD.2009102600000(+1)'
于 2009-11-06T02:24:32.547 回答